use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Object visit(ASTConstraint node, Object data) throws VisitorException {
ValueExpr valueExpr = (ValueExpr) super.visit(node, null);
graphPattern.addConstraint(valueExpr);
return valueExpr;
}
use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public Or visit(ASTOr node, Object data) throws VisitorException {
ValueExpr leftArg = (ValueExpr) node.jjtGetChild(0).jjtAccept(this, null);
ValueExpr rightArg = (ValueExpr) node.jjtGetChild(1).jjtAccept(this, null);
return new Or(leftArg, rightArg);
}
use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.
the class TupleExprBuilder method visit.
@Override
public MathExpr visit(ASTMath node, Object data) throws VisitorException {
ValueExpr leftArg = (ValueExpr) node.jjtGetChild(0).jjtAccept(this, null);
ValueExpr rightArg = (ValueExpr) node.jjtGetChild(1).jjtAccept(this, null);
return new MathExpr(leftArg, rightArg, node.getOperator());
}
use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.
the class BasicGroup method filteredTuple.
private TupleExpr filteredTuple(TupleExpr theExpr) {
TupleExpr aExpr = theExpr;
for (ValueExpr aValEx : mFilters) {
Filter aFilter = new Filter();
aFilter.setCondition(aValEx);
aFilter.setArg(aExpr);
aExpr = aFilter;
}
return aExpr;
}
use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.
the class GraphPattern method buildTupleExpr.
/**
* Builds a combined tuple expression from the tuple expressions and constraints in this graph pattern.
*
* @return A tuple expression for this graph pattern.
*/
public TupleExpr buildTupleExpr() {
TupleExpr result;
if (requiredTEs.isEmpty()) {
result = new SingletonSet();
} else {
result = requiredTEs.get(0);
for (int i = 1; i < requiredTEs.size(); i++) {
TupleExpr te = requiredTEs.get(i);
// if (containsProjection(te) || containsProjection(result))
// {
// result = new BottomUpJoin(result, te);
// }
// else {
result = new Join(result, te);
// }
}
}
for (Map.Entry<TupleExpr, List<ValueExpr>> entry : optionalTEs) {
List<ValueExpr> constraints = entry.getValue();
if (constraints != null && !constraints.isEmpty()) {
ValueExpr condition = constraints.get(0);
for (int i = 1; i < constraints.size(); i++) {
condition = new And(condition, constraints.get(i));
}
result = new LeftJoin(result, entry.getKey(), condition);
} else {
result = new LeftJoin(result, entry.getKey());
}
}
for (ValueExpr constraint : constraints) {
result = new Filter(result, constraint);
}
return result;
}
Aggregations