@Override public Object visit(ASTSelect node, Object data) throws VisitorException { selectClauses.add(node); return super.visit(node, data); } }
@Override public Object visit(ASTBasicGraphPattern node, Object data) throws VisitorException { // The same Blank node ID cannot be used across Graph Patterns usedBNodeIDs.addAll(conversionMap.keySet()); // Blank nodes are scoped to Basic Graph Patterns conversionMap.clear(); return super.visit(node, data); }
@Override public Not visit(ASTNot node, Object data) throws VisitorException { ValueExpr arg = (ValueExpr)super.visit(node, null); return new Not(arg); }
@Override public Var visit(ASTBlankNodePropertyList node, Object data) throws VisitorException { Var bnodeVar = createAnonVar(); super.visit(node, bnodeVar); return bnodeVar; }
@Override public Object visit(ASTServiceGraphPattern node, Object data) throws VisitorException { node.setPrefixDeclarations(prefixMap); return super.visit(node, data); }
@Override public Object visit(ASTConstraint node, Object data) throws VisitorException { ValueExpr valueExpr = (ValueExpr)super.visit(node, null); graphPattern.addConstraint(valueExpr); return valueExpr; }
@Override public Object visit(ASTVar node, Object data) throws VisitorException { if (!node.isAnonymous()) { variableNames.add(node.getName()); } return super.visit(node, data); } }
@Override public Object visit(ASTCollection node, Object data) throws VisitorException { node.setVarName(createAnonVarName()); return super.visit(node, data); } }
@Override public Object visit(ASTBlankNodePropertyList node, Object data) throws VisitorException { node.setVarName(createAnonVarName()); return super.visit(node, data); }
@Override public Object visit(ASTIRIFunc node, Object data) throws VisitorException { node.setBaseURI(parsedBaseURI.toString()); return super.visit(node, data); }
@Override public Object visit(ASTServiceGraphPattern node, Object data) throws VisitorException { node.setBaseURI(parsedBaseURI.toString()); return super.visit(node, data); } }
@Override public Object visit(ASTProjectionElem node, Object data) throws VisitorException { // only include the actual alias from a projection element in a // subselect, not any variables used as // input to a function String alias = node.getAlias(); if (alias != null) { variableNames.add(alias); return null; } else { return super.visit(node, data); } }
@Override public Object visit(ASTString stringNode, Object data) throws VisitorException { String value = stringNode.getValue(); try { value = SPARQLUtil.decodeString(value); stringNode.setValue(value); } catch (IllegalArgumentException e) { // Invalid escape sequence throw new VisitorException(e.getMessage()); } return super.visit(stringNode, data); } }
@Override public Object visit(ASTIRI node, Object data) throws VisitorException { ParsedURI resolvedURI = parsedBaseURI.resolve(node.getValue()); node.setValue(resolvedURI.toString()); return super.visit(node, data); }
@Override public Object visit(ASTOptionalGraphPattern node, Object data) throws VisitorException { GraphPattern parentGP = graphPattern; graphPattern = new GraphPattern(parentGP); super.visit(node, null); // remove filter conditions from graph pattern for inclusion as // conditions // in the OptionalTE List<ValueExpr> optionalConstraints = graphPattern.removeAllConstraints(); TupleExpr optional = graphPattern.buildTupleExpr(); graphPattern = parentGP; graphPattern.addOptionalTE(optional, optionalConstraints); return null; }
@Override public Object visit(ASTBlankNode node, Object data) throws VisitorException { String bnodeID = node.getID(); String varName = findVarName(bnodeID); if (varName == null) { varName = createAnonVarName(); if (bnodeID != null) { conversionMap.put(bnodeID, varName); } } ASTVar varNode = new ASTVar(SyntaxTreeBuilderTreeConstants.JJTVAR); varNode.setName(varName); varNode.setAnonymous(true); node.jjtReplaceWith(varNode); return super.visit(node, data); }
super.visit(node, null); TupleExpr constructExpr = graphPattern.buildTupleExpr();
super.visit(node, null);