Search in sources :

Example 16 with ValueConstant

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

the class UpdateExprBuilder method visit.

@Override
public Move visit(ASTMove node, Object data) throws VisitorException {
    Move move = new Move();
    move.setSilent(node.isSilent());
    ASTGraphOrDefault sourceNode = (ASTGraphOrDefault) node.jjtGetChild(0);
    if (sourceNode.jjtGetNumChildren() > 0) {
        ValueConstant sourceGraph = (ValueConstant) sourceNode.jjtGetChild(0).jjtAccept(this, data);
        move.setSourceGraph(sourceGraph);
    }
    ASTGraphOrDefault destinationNode = (ASTGraphOrDefault) node.jjtGetChild(1);
    if (destinationNode.jjtGetNumChildren() > 0) {
        ValueConstant destinationGraph = (ValueConstant) destinationNode.jjtGetChild(0).jjtAccept(this, data);
        move.setDestinationGraph(destinationGraph);
    }
    return move;
}
Also used : ASTMove(org.eclipse.rdf4j.query.parser.sparql.ast.ASTMove) Move(org.eclipse.rdf4j.query.algebra.Move) ValueConstant(org.eclipse.rdf4j.query.algebra.ValueConstant) ASTGraphOrDefault(org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphOrDefault)

Example 17 with ValueConstant

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

the class UpdateExprBuilder method visit.

@Override
public Clear visit(ASTDrop node, Object data) throws VisitorException {
    // implementing drop as a synonym of clear, in Sesame this is really the
    // same thing, as empty
    // graphs are not recorded.
    Clear clear = new Clear();
    clear.setSilent(node.isSilent());
    ASTGraphRefAll graphRef = node.jjtGetChild(ASTGraphRefAll.class);
    if (graphRef.jjtGetNumChildren() > 0) {
        ValueConstant graph = (ValueConstant) graphRef.jjtGetChild(0).jjtAccept(this, data);
        clear.setGraph(graph);
    } else {
        if (graphRef.isDefault()) {
            clear.setScope(Scope.DEFAULT_CONTEXTS);
        } else if (graphRef.isNamed()) {
            clear.setScope(Scope.NAMED_CONTEXTS);
        }
    }
    return clear;
}
Also used : ASTGraphRefAll(org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphRefAll) ValueConstant(org.eclipse.rdf4j.query.algebra.ValueConstant) ASTClear(org.eclipse.rdf4j.query.parser.sparql.ast.ASTClear) Clear(org.eclipse.rdf4j.query.algebra.Clear)

Example 18 with ValueConstant

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

the class UpdateExprBuilder method visit.

@Override
public Add visit(ASTAdd node, Object data) throws VisitorException {
    Add add = new Add();
    add.setSilent(node.isSilent());
    ASTGraphOrDefault sourceNode = (ASTGraphOrDefault) node.jjtGetChild(0);
    if (sourceNode.jjtGetNumChildren() > 0) {
        ValueConstant sourceGraph = (ValueConstant) sourceNode.jjtGetChild(0).jjtAccept(this, data);
        add.setSourceGraph(sourceGraph);
    }
    ASTGraphOrDefault destinationNode = (ASTGraphOrDefault) node.jjtGetChild(1);
    if (destinationNode.jjtGetNumChildren() > 0) {
        ValueConstant destinationGraph = (ValueConstant) destinationNode.jjtGetChild(0).jjtAccept(this, data);
        add.setDestinationGraph(destinationGraph);
    }
    return add;
}
Also used : Add(org.eclipse.rdf4j.query.algebra.Add) ASTAdd(org.eclipse.rdf4j.query.parser.sparql.ast.ASTAdd) ValueConstant(org.eclipse.rdf4j.query.algebra.ValueConstant) ASTGraphOrDefault(org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphOrDefault)

Example 19 with ValueConstant

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

the class UpdateExprBuilder method visit.

@Override
public Load visit(ASTLoad node, Object data) throws VisitorException {
    ValueConstant source = (ValueConstant) node.jjtGetChild(0).jjtAccept(this, data);
    Load load = new Load(source);
    load.setSilent(node.isSilent());
    if (node.jjtGetNumChildren() > 1) {
        ValueConstant graph = (ValueConstant) node.jjtGetChild(1).jjtAccept(this, data);
        load.setGraph(graph);
    }
    return load;
}
Also used : Load(org.eclipse.rdf4j.query.algebra.Load) ASTLoad(org.eclipse.rdf4j.query.parser.sparql.ast.ASTLoad) ValueConstant(org.eclipse.rdf4j.query.algebra.ValueConstant)

Example 20 with ValueConstant

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

the class TupleExprBuilder method visit.

@Override
public Object visit(ASTFunctionCall node, Object data) throws VisitorException {
    ValueConstant uriNode = (ValueConstant) node.jjtGetChild(0).jjtAccept(this, null);
    IRI functionURI = (IRI) uriNode.getValue();
    FunctionCall functionCall = new FunctionCall(functionURI.toString());
    for (int i = 1; i < node.jjtGetNumChildren(); i++) {
        Node argNode = node.jjtGetChild(i);
        functionCall.addArg((ValueExpr) argNode.jjtAccept(this, null));
    }
    return functionCall;
}
Also used : IRI(org.eclipse.rdf4j.model.IRI) ValueConstant(org.eclipse.rdf4j.query.algebra.ValueConstant) QueryModelNode(org.eclipse.rdf4j.query.algebra.QueryModelNode) IsBNode(org.eclipse.rdf4j.query.algebra.IsBNode) FunctionCall(org.eclipse.rdf4j.query.algebra.FunctionCall)

Aggregations

ValueConstant (org.eclipse.rdf4j.query.algebra.ValueConstant)23 ValueExpr (org.eclipse.rdf4j.query.algebra.ValueExpr)7 Var (org.eclipse.rdf4j.query.algebra.Var)7 StatementPattern (org.eclipse.rdf4j.query.algebra.StatementPattern)6 IRI (org.eclipse.rdf4j.model.IRI)4 Compare (org.eclipse.rdf4j.query.algebra.Compare)4 Extension (org.eclipse.rdf4j.query.algebra.Extension)4 ExtensionElem (org.eclipse.rdf4j.query.algebra.ExtensionElem)4 MultiProjection (org.eclipse.rdf4j.query.algebra.MultiProjection)4 ProjectionElem (org.eclipse.rdf4j.query.algebra.ProjectionElem)4 ProjectionElemList (org.eclipse.rdf4j.query.algebra.ProjectionElemList)4 TupleExpr (org.eclipse.rdf4j.query.algebra.TupleExpr)4 ArrayList (java.util.ArrayList)3 BNodeGenerator (org.eclipse.rdf4j.query.algebra.BNodeGenerator)3 EmptySet (org.eclipse.rdf4j.query.algebra.EmptySet)3 Projection (org.eclipse.rdf4j.query.algebra.Projection)3 Reduced (org.eclipse.rdf4j.query.algebra.Reduced)3 ASTValueExpr (org.eclipse.rdf4j.query.parser.serql.ast.ASTValueExpr)3 ASTGraphOrDefault (org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphOrDefault)3 HashMap (java.util.HashMap)2