use of org.eclipse.rdf4j.query.algebra.Var in project rdf4j by eclipse.
the class ConstructorBuilder method getConstructVars.
/**
* Gets the set of variables that are relevant for the constructor. This method accumulates all subject,
* predicate and object variables from the supplied statement patterns, but ignores any context variables.
*/
private Set<Var> getConstructVars(Collection<StatementPattern> statementPatterns) {
Set<Var> vars = new LinkedHashSet<Var>(statementPatterns.size() * 2);
for (StatementPattern sp : statementPatterns) {
vars.add(sp.getSubjectVar());
vars.add(sp.getPredicateVar());
vars.add(sp.getObjectVar());
}
return vars;
}
use of org.eclipse.rdf4j.query.algebra.Var in project rdf4j by eclipse.
the class GroupBuilder method valueToVar.
public static Var valueToVar(Value theValue) {
Var aVar = new Var("var" + cnt++, theValue);
aVar.setAnonymous(true);
return aVar;
}
use of org.eclipse.rdf4j.query.algebra.Var in project rdf4j by eclipse.
the class GroupBuilder method filter.
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;
}
use of org.eclipse.rdf4j.query.algebra.Var in project rdf4j by eclipse.
the class ContextCollector method meet.
/**
* @inheritDoc
*/
@Override
public void meet(final Filter theFilter) throws Exception {
theFilter.getArg().visit(this);
if (mContexts.containsKey(theFilter.getArg())) {
Var aCtx = mContexts.get(theFilter.getArg());
mContexts.remove(theFilter.getArg());
mContexts.put(theFilter, aCtx);
}
}
use of org.eclipse.rdf4j.query.algebra.Var in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Object visit(ASTPropertyListPath propListNode, Object data) throws VisitorException {
ValueExpr subject = (ValueExpr) data;
ValueExpr verbPath = (ValueExpr) propListNode.getVerb().jjtAccept(this, data);
if (verbPath instanceof Var) {
@SuppressWarnings("unchecked") List<ValueExpr> objectList = (List<ValueExpr>) propListNode.getObjectList().jjtAccept(this, null);
Var subjVar = mapValueExprToVar(subject);
Var predVar = mapValueExprToVar(verbPath);
for (ValueExpr object : objectList) {
Var objVar = mapValueExprToVar(object);
graphPattern.addRequiredSP(subjVar, predVar, objVar);
}
} else {
// path is a single IRI or a more complex path. handled by the
// visitor.
}
ASTPropertyListPath nextPropList = propListNode.getNextPropertyList();
if (nextPropList != null) {
nextPropList.jjtAccept(this, subject);
}
return null;
}
Aggregations