Search in sources :

Example 1 with ValueExpr

use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.

the class GraphPattern method addOptionalTE.

public void addOptionalTE(GraphPattern gp) {
    List<ValueExpr> constraints = gp.removeAllConstraints();
    TupleExpr tupleExpr = gp.buildTupleExpr();
    OptionalTupleExpr optTE;
    if (constraints.isEmpty()) {
        optTE = new OptionalTupleExpr(tupleExpr);
    } else {
        ValueExpr constraint = constraints.get(0);
        for (int i = 1; i < constraints.size(); i++) {
            constraint = new And(constraint, constraints.get(i));
        }
        optTE = new OptionalTupleExpr(tupleExpr, constraint);
    }
    optionalTEs.add(optTE);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) And(org.eclipse.rdf4j.query.algebra.And) TupleExpr(org.eclipse.rdf4j.query.algebra.TupleExpr)

Example 2 with ValueExpr

use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.

the class QueryModelBuilder method visit.

@Override
public Like visit(ASTLike node, Object data) throws VisitorException {
    ValueExpr expr = (ValueExpr) node.getValueExpr().jjtAccept(this, null);
    String pattern = (String) node.getPattern().jjtAccept(this, null);
    boolean caseSensitive = !node.ignoreCase();
    return new Like(expr, pattern, caseSensitive);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) Like(org.eclipse.rdf4j.query.algebra.Like) ASTLike(org.eclipse.rdf4j.query.parser.serql.ast.ASTLike) ASTString(org.eclipse.rdf4j.query.parser.serql.ast.ASTString)

Example 3 with ValueExpr

use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.

the class QueryModelBuilder method visit.

@Override
public CompareAny visit(ASTCompareAny node, Object data) throws VisitorException {
    ValueExpr valueExpr = (ValueExpr) node.getLeftOperand().jjtAccept(this, null);
    TupleExpr tupleExpr = (TupleExpr) node.getRightOperand().jjtAccept(this, null);
    CompareOp op = node.getOperator().getValue();
    return new CompareAny(valueExpr, tupleExpr, op);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) CompareOp(org.eclipse.rdf4j.query.algebra.Compare.CompareOp) CompareAny(org.eclipse.rdf4j.query.algebra.CompareAny) ASTCompareAny(org.eclipse.rdf4j.query.parser.serql.ast.ASTCompareAny) TupleExpr(org.eclipse.rdf4j.query.algebra.TupleExpr)

Example 4 with ValueExpr

use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.

the class QueryModelBuilder method visit.

@Override
public Compare visit(ASTCompare node, Object data) throws VisitorException {
    ValueExpr leftArg = (ValueExpr) node.getLeftOperand().jjtAccept(this, null);
    ValueExpr rightArg = (ValueExpr) node.getRightOperand().jjtAccept(this, null);
    CompareOp operator = node.getOperator().getValue();
    return new Compare(leftArg, rightArg, operator);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) ASTCompare(org.eclipse.rdf4j.query.parser.serql.ast.ASTCompare) Compare(org.eclipse.rdf4j.query.algebra.Compare) CompareOp(org.eclipse.rdf4j.query.algebra.Compare.CompareOp)

Example 5 with ValueExpr

use of org.eclipse.rdf4j.query.algebra.ValueExpr in project rdf4j by eclipse.

the class QueryModelBuilder method visit.

@Override
public In visit(ASTIn node, Object data) throws VisitorException {
    ValueExpr valueExpr = (ValueExpr) node.getLeftOperand().jjtAccept(this, null);
    TupleExpr tupleExpr = (TupleExpr) node.getRightOperand().jjtAccept(this, null);
    return new In(valueExpr, tupleExpr);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) In(org.eclipse.rdf4j.query.algebra.In) ASTIn(org.eclipse.rdf4j.query.parser.serql.ast.ASTIn) TupleExpr(org.eclipse.rdf4j.query.algebra.TupleExpr)

Aggregations

ValueExpr (org.eclipse.rdf4j.query.algebra.ValueExpr)55 TupleExpr (org.eclipse.rdf4j.query.algebra.TupleExpr)19 Var (org.eclipse.rdf4j.query.algebra.Var)19 ASTValueExpr (org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr)14 ProjectionElemList (org.eclipse.rdf4j.query.algebra.ProjectionElemList)10 ArrayList (java.util.ArrayList)9 Extension (org.eclipse.rdf4j.query.algebra.Extension)9 ExtensionElem (org.eclipse.rdf4j.query.algebra.ExtensionElem)9 And (org.eclipse.rdf4j.query.algebra.And)7 ValueConstant (org.eclipse.rdf4j.query.algebra.ValueConstant)7 Filter (org.eclipse.rdf4j.query.algebra.Filter)6 Projection (org.eclipse.rdf4j.query.algebra.Projection)6 ProjectionElem (org.eclipse.rdf4j.query.algebra.ProjectionElem)6 StatementPattern (org.eclipse.rdf4j.query.algebra.StatementPattern)6 List (java.util.List)5 Compare (org.eclipse.rdf4j.query.algebra.Compare)5 MultiProjection (org.eclipse.rdf4j.query.algebra.MultiProjection)5 Reduced (org.eclipse.rdf4j.query.algebra.Reduced)5 BNodeGenerator (org.eclipse.rdf4j.query.algebra.BNodeGenerator)4 Distinct (org.eclipse.rdf4j.query.algebra.Distinct)4