@Override public ValueConstant visit(ASTTrue node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(true)); }
@Override public ValueConstant visit(ASTFalse node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(false)); }
@Override public ValueConstant visit(ASTFalse node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(false)); }
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 ValueConstant visit(ASTBooleanConstant node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(node.getValue())); }
public void visitCreate(Resource query) throws RDF4JException { Value graph = TripleSources.singleValue(query, SP.GRAPH_IRI_PROPERTY, store); Create create = new Create(new ValueConstant(graph)); boolean isSilent = TripleSources.booleanValue(query, SP.SILENT_PROPERTY, store); create.setSilent(isSilent); updateRoot = create; }
@Override public ValueConstant visit(ASTURI node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createIRI(node.getValue())); }
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; }
public void visitClear(Resource query) throws RDF4JException { Value graph = TripleSources.singleValue(query, SP.GRAPH_IRI_PROPERTY, store); Clear clear = new Clear(new ValueConstant(graph)); boolean isSilent = TripleSources.booleanValue(query, SP.SILENT_PROPERTY, store); clear.setSilent(isSilent); updateRoot = clear; }
@Override public ValueConstant visit(ASTURI node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createIRI(node.getValue())); }
@Override public ValueConstant visit(ASTBooleanConstant node, Object data) throws VisitorException { return new ValueConstant(valueFactory.createLiteral(node.getValue())); }
@Override public ValueConstant visit(ASTIRI node, Object data) throws VisitorException { IRI uri; try { uri = valueFactory.createIRI(node.getValue()); } catch (IllegalArgumentException e) { // invalid URI throw new VisitorException(e.getMessage()); } return new ValueConstant(uri); }
@Override public ValueConstant visit(ASTNumericLiteral node, Object data) throws VisitorException { Literal literal = valueFactory.createLiteral(node.getValue(), node.getDatatype()); return new ValueConstant(literal); }
@Override public void meet(Var var) { if (!(var.getParentNode() instanceof NAryValueOperator)) { if (!var.isConstant() && hMap.containsKey(var.getName())) { String val = hMap.get(var.getName()); if (VarNameUtils.isConstant(val)) { var.replaceWith(new ValueConstant(valMap.get(val))); } else { var.setName(val); } } } }
@Override public void meet(Bound bound) { super.meet(bound); if (bound.getArg().hasValue()) { // variable is always bound bound.replaceWith(new ValueConstant(BooleanLiteral.TRUE)); } }
@Override public void meet(Bound bound) { super.meet(bound); if (bound.getArg().hasValue()) { // variable is always bound bound.replaceWith(new ValueConstant(BooleanLiteral.TRUE)); } }
public static LangMatches langMatches(String theVar, String theLang) { return new LangMatches(new Lang(new Var(theVar)), new ValueConstant(SimpleValueFactory.getInstance().createLiteral(theLang))); }
public GroupBuilder<T, E> regex(ValueExpr theExpr, String thePattern, String theFlags) { Regex aRegex = new Regex(); aRegex.setArg(theExpr); aRegex.setPatternArg(new ValueConstant(SimpleValueFactory.getInstance().createLiteral(thePattern))); if (theFlags != null) { aRegex.setFlagsArg(new ValueConstant(SimpleValueFactory.getInstance().createLiteral(theFlags))); } return filter(aRegex); } }
@Test public void periodicNodeNotPresentTest() throws Exception { List<ValueExpr> values = Arrays.asList(new Var("time"), new ValueConstant(VF.createLiteral(12.0)), new ValueConstant(VF.createLiteral(6.0)), new ValueConstant(VF.createIRI(PeriodicQueryUtil.temporalNameSpace + "hours"))); FunctionCall func = new FunctionCall("uri:func", values); Optional<PeriodicQueryNode> node1 = PeriodicQueryUtil.getPeriodicQueryNode(func, new Join()); Assert.assertEquals(false, node1.isPresent()); }
@Override public void meet(final FunctionCall call) { final IRI fnUri = VF.createIRI(call.getURI()); final Var resultVar = IndexingFunctionRegistry.getResultVarFromFunctionCall(fnUri, call.getArgs()); if (resultVar != null && resultVar.getName().equals(matchVar)) { addFilter(VF.createIRI(call.getURI()), extractArguments(matchVar, call)); if (call.getParentNode() instanceof Filter || call.getParentNode() instanceof And || call.getParentNode() instanceof LeftJoin) { call.replaceWith(new ValueConstant(VF.createLiteral(true))); } else { throw new IllegalArgumentException("Query error: Found " + call + " as part of an expression that is too complex"); } } }