use of org.eclipse.rdf4j.query.algebra.Not in project rdf4j by eclipse.
the class QueryModelBuilder method visit.
@Override
public List<Var> visit(ASTNode node, Object data) throws VisitorException {
List<Var> nodeVars = new ArrayList<Var>();
for (ASTNodeElem nodeElem : node.getNodeElemList()) {
Var nodeVar = (Var) nodeElem.jjtAccept(this, null);
nodeVars.add(nodeVar);
}
// Create any implicit unequalities
for (int i = 0; i < nodeVars.size() - 1; i++) {
Var var1 = nodeVars.get(i);
for (int j = i + 1; j < nodeVars.size(); j++) {
Var var2 = nodeVars.get(j);
// for the unequality to make any sense:
if (!var1.hasValue() || !var2.hasValue()) {
graphPattern.addConstraint(new Not(new SameTerm(var1, var2)));
}
}
}
return nodeVars;
}
use of org.eclipse.rdf4j.query.algebra.Not in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Not visit(ASTNotExistsFunc node, Object data) throws VisitorException {
GraphPattern parentGP = graphPattern;
graphPattern = new GraphPattern(parentGP);
Exists e = new Exists();
node.jjtGetChild(0).jjtAccept(this, e);
TupleExpr te = graphPattern.buildTupleExpr();
e.setSubQuery(te);
graphPattern = parentGP;
return new Not(e);
}
Aggregations