Search in sources :

Example 1 with Clear

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

the class UpdateExprBuilder method visit.

@Override
public Clear visit(ASTClear node, Object data) throws VisitorException {
    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 2 with Clear

use of org.eclipse.rdf4j.query.algebra.Clear 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)

Aggregations

Clear (org.eclipse.rdf4j.query.algebra.Clear)2 ValueConstant (org.eclipse.rdf4j.query.algebra.ValueConstant)2 ASTClear (org.eclipse.rdf4j.query.parser.sparql.ast.ASTClear)2 ASTGraphRefAll (org.eclipse.rdf4j.query.parser.sparql.ast.ASTGraphRefAll)2