Search in sources :

Example 1 with Or

use of org.eclipse.rdf4j.query.algebra.Or 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);
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) Or(org.eclipse.rdf4j.query.algebra.Or)

Example 2 with Or

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

the class QueryModelBuilder method visit.

@Override
public ValueExpr visit(ASTInList node, Object data) throws VisitorException {
    ValueExpr leftArg = (ValueExpr) node.getValueExpr().jjtAccept(this, null);
    ValueExpr result = null;
    for (ASTValueExpr argExpr : node.getArgList().getElements()) {
        ValueExpr rightArg = (ValueExpr) argExpr.jjtAccept(this, null);
        if (result == null) {
            // First argument
            result = new SameTerm(leftArg, rightArg);
        } else {
            SameTerm sameTerm = new SameTerm(leftArg.clone(), rightArg);
            result = new Or(result, sameTerm);
        }
    }
    assert result != null;
    return result;
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) Or(org.eclipse.rdf4j.query.algebra.Or) ASTOr(org.eclipse.rdf4j.query.parser.serql.ast.ASTOr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) ASTSameTerm(org.eclipse.rdf4j.query.parser.serql.ast.ASTSameTerm) SameTerm(org.eclipse.rdf4j.query.algebra.SameTerm)

Example 3 with Or

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

the class QueryModelBuilder method visit.

@Override
public ValueExpr visit(ASTOr node, Object data) throws VisitorException {
    Iterator<ASTBooleanExpr> iter = node.getOperandList().iterator();
    ValueExpr result = (ValueExpr) iter.next().jjtAccept(this, null);
    while (iter.hasNext()) {
        ValueExpr operand = (ValueExpr) iter.next().jjtAccept(this, null);
        result = new Or(result, operand);
    }
    return result;
}
Also used : ValueExpr(org.eclipse.rdf4j.query.algebra.ValueExpr) ASTValueExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr) ASTBooleanExpr(org.eclipse.rdf4j.query.parser.serql.ast.ASTBooleanExpr) Or(org.eclipse.rdf4j.query.algebra.Or) ASTOr(org.eclipse.rdf4j.query.parser.serql.ast.ASTOr)

Aggregations

Or (org.eclipse.rdf4j.query.algebra.Or)3 ValueExpr (org.eclipse.rdf4j.query.algebra.ValueExpr)3 ASTOr (org.eclipse.rdf4j.query.parser.serql.ast.ASTOr)2 ASTValueExpr (org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr)2 SameTerm (org.eclipse.rdf4j.query.algebra.SameTerm)1 ASTBooleanExpr (org.eclipse.rdf4j.query.parser.serql.ast.ASTBooleanExpr)1 ASTSameTerm (org.eclipse.rdf4j.query.parser.serql.ast.ASTSameTerm)1