public Value evaluate(ValueConstant valueConstant, BindingSet bindings) throws ValueExprEvaluationException, QueryEvaluationException { return valueConstant.getValue(); }
@Override public ValueConstant visit(ASTFalse node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(false)); }
@Override public void meet(final Filter node) throws Exception { super.meet(node); final ValueExpr arg = node.getCondition(); if (arg instanceof FunctionCall) { final FunctionCall fc = (FunctionCall) arg; if (RANGE.stringValue().equals(fc.getURI())) { //range(?var, start, end) final List<ValueExpr> valueExprs = fc.getArgs(); if (valueExprs.size() != 3) { throw new QueryEvaluationException("org.apache:range must have 3 parameters: variable, start, end"); } final Var var = (Var) valueExprs.get(0); final ValueConstant startVc = (ValueConstant) valueExprs.get(1); final ValueConstant endVc = (ValueConstant) valueExprs.get(2); final Value start = startVc.getValue(); final Value end = endVc.getValue(); rangeValues.put(var, new RangeValue(start, end)); node.setCondition(new ValueConstant(BooleanLiteralImpl.TRUE)); } } }
public ValueConstant(Value value) { setValue(value); }
@Override public void meet(ValueConstant node) { if (predicate.equals(SeRQO.VALUE)) { node.setValue(object); } else { super.meet(node); } }
@Override public boolean equals(Object other) { if (other instanceof ValueConstant) { ValueConstant o = (ValueConstant)other; return value.equals(o.getValue()); } return false; }
@Override public ValueConstant visit(ASTTrue node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(true)); }
public GroupBuilder<T, E> filter(String theVar, Compare.CompareOp theOp, Value theValue) { Compare aComp = new Compare(new Var(theVar), new ValueConstant(theValue), theOp); mGroup.addFilter(aComp); return this; }
@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); } }
public void visitCreate(Resource query) throws OpenRDFException { Value graph = Statements.singleValue(query, SP.GRAPH_IRI_PROPERTY, store); Create create = new Create(new ValueConstant(graph)); boolean isSilent = Statements.booleanValue(query, SP.SILENT_PROPERTY, store); create.setSilent(isSilent); updateRoot = create; }
@Override public void meet(ValueConstant vc) throws UnsupportedRdbmsOperatorException { result = valueOf(vc.getValue()); }
@Override public ValueConstant visit(ASTURI node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createIRI(node.getValue())); }
/** * @inheritDoc */ @Override public void meet(ValueConstant theVal) throws Exception { mBuffer.append(RenderUtils.getSPARQLQueryString(theVal.getValue())); }
public void visitClear(Resource query) throws OpenRDFException { Value graph = Statements.singleValue(query, SP.GRAPH_IRI_PROPERTY, store); Clear clear = new Clear(new ValueConstant(graph)); boolean isSilent = Statements.booleanValue(query, SP.SILENT_PROPERTY, store); clear.setSilent(isSilent); updateRoot = clear; }
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 ValueConstant visit(ASTBooleanConstant node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(node.getValue())); }
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 ValueConstant visit(ASTBNode node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createBNode(node.getID())); }