public Value evaluate(ValueConstant valueConstant, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { return valueConstant.getValue(); }
@Override public boolean equals(Object other) { if (other instanceof ValueConstant) { ValueConstant o = (ValueConstant)other; return value.equals(o.getValue()); } return false; }
@Override public void meet(ValueConstant node) throws RuntimeException { String key = node.getValue().toString(); if(constantMap.containsKey(key)) { int count = constantMap.get(key); count += 1; constantMap.put(key, count); } else { constantMap.put(key,1); } }
@Override public void meet(ValueConstant vc) throws UnsupportedRdbmsOperatorException { result = valueOf(vc.getValue()); }
/** * @inheritDoc */ @Override public void meet(ValueConstant theVal) throws Exception { mBuffer.append(RenderUtils.getSPARQLQueryString(theVal.getValue())); }
private Value getValue(ValueExpr valueExpr) { if (valueExpr instanceof ValueConstant) { return ((ValueConstant)valueExpr).getValue(); } else if (valueExpr instanceof Var) { return ((Var)valueExpr).getValue(); } else { return null; } }
private static Value getValue(ValueExpr v) { Value value = null; if(v instanceof ValueConstant) { value = ((ValueConstant)v).getValue(); } else if(v instanceof Var) { value = ((Var)v).getValue(); } return value; }
@Override public void meet(ValueConstant vc) { result = valueOf(vc.getValue()); }
private Value getValue(ValueExpr valueExpr) { if (valueExpr instanceof ValueConstant) { return ((ValueConstant)valueExpr).getValue(); } else if (valueExpr instanceof Var) { return ((Var)valueExpr).getValue(); } else { return null; } }
@Override public void meet(ValueConstant vc) { result = valueOf(vc.getValue()); }
@Override public void meet(final ValueConstant n) { emit(n.getValue()); }
protected boolean isResource(ValueExpr valueExpr) { if (valueExpr instanceof ValueConstant) { Value value = ((ValueConstant)valueExpr).getValue(); return value instanceof Resource; } if (valueExpr instanceof Var) { Value value = ((Var)valueExpr).getValue(); return value instanceof Resource; } return false; } }
/** * @inheritDoc */ @Override public void meet(ValueConstant theVal) throws Exception { mBuffer.append(RenderUtils.getSerqlQueryString(theVal.getValue())); }
@Override public void meet(IsURI node) throws RuntimeException { ValueExpr arg = node.getArg(); // operator must be a variable or a constant if(arg instanceof ValueConstant) { builder.append(Boolean.toString(((ValueConstant) arg).getValue() instanceof URI)); } else if(arg instanceof Var) { String var = getVariableAlias((Var) arg); Preconditions.checkState(var != null, "no alias available for variable"); builder.append(var).append(".ntype = 'uri'"); } }
@Override public void meet(IsBNode node) throws RuntimeException { ValueExpr arg = node.getArg(); // operator must be a variable or a constant if(arg instanceof ValueConstant) { builder.append(Boolean.toString(((ValueConstant) arg).getValue() instanceof BNode)); } else if(arg instanceof Var) { String var = getVariableAlias((Var) arg); builder.append(var).append(".ntype = 'bnode'"); } }
@Override public FunctionCall visit(ASTFunctionCall node, Object data) throws VisitorException { ValueConstant vc = (ValueConstant)node.getURI().jjtAccept(this, null); assert vc.getValue() instanceof IRI; FunctionCall functionCall = new FunctionCall(vc.getValue().toString()); for (ASTValueExpr argExpr : node.getArgList().getElements()) { functionCall.addArg((ValueExpr)argExpr.jjtAccept(this, null)); } return functionCall; }
private static double parseTemporalDuration(ValueConstant valConst) { Value val = valConst.getValue(); Preconditions.checkArgument(val instanceof Literal); Literal literal = (Literal) val; String stringVal = literal.getLabel(); URI dataType = literal.getDatatype(); Preconditions.checkArgument(dataType.equals(XMLSchema.DECIMAL) || dataType.equals(XMLSchema.DOUBLE) || dataType.equals(XMLSchema.FLOAT) || dataType.equals(XMLSchema.INTEGER) || dataType.equals(XMLSchema.INT)); return Double.parseDouble(stringVal); }
@Override public Object visit(ASTFunctionCall node, Object data) throws VisitorException { ValueConstant uriNode = (ValueConstant)node.jjtGetChild(0).jjtAccept(this, null); IRI functionURI = (IRI)uriNode.getValue(); FunctionCall functionCall = new FunctionCall(functionURI.toString()); for (int i = 1; i < node.jjtGetNumChildren(); i++) { Node argNode = node.jjtGetChild(i); functionCall.addArg((ValueExpr)argNode.jjtAccept(this, null)); } return functionCall; }