Search in sources :

Example 1 with ASTEdge

use of org.eclipse.rdf4j.query.parser.serql.ast.ASTEdge in project rdf4j by eclipse.

the class AnonymousVarGenerator method visit.

@Override
public Object visit(ASTReifiedStat node, Object data) throws VisitorException {
    if (node.jjtGetChild(0) instanceof ASTEdge) {
        // subject node is missing
        ASTNodeElem nodeElem = createNodeElem();
        nodeElem.jjtSetParent(node);
        node.jjtInsertChild(nodeElem, 0);
    }
    if (node.jjtGetNumChildren() <= 2) {
        // object node is missing
        ASTNodeElem nodeElem = createNodeElem();
        nodeElem.jjtSetParent(node);
        node.jjtAppendChild(nodeElem);
    }
    if (node.getID() == null) {
        node.setID(createAnonymousVar());
    }
    return super.visit(node, data);
}
Also used : ASTEdge(org.eclipse.rdf4j.query.parser.serql.ast.ASTEdge) ASTNodeElem(org.eclipse.rdf4j.query.parser.serql.ast.ASTNodeElem)

Aggregations

ASTEdge (org.eclipse.rdf4j.query.parser.serql.ast.ASTEdge)1 ASTNodeElem (org.eclipse.rdf4j.query.parser.serql.ast.ASTNodeElem)1