/** * Parses the supplied SPARQL update sequence and builds a syntax tree from it. * * @param sequence A SPARQL update sequence string. * @return The root of the syntax tree. * @throws TokenMgrError If the update sequence was syntactically incorrect. * @throws ParseException If the update sequence was syntactically incorrect. */ public static ASTUpdateSequence parseUpdateSequence(String sequence) throws TokenMgrError, ParseException { SyntaxTreeBuilder stb = new SyntaxTreeBuilder( new StringReader(sequence) ); ASTUpdateSequence seq = stb.UpdateSequence(); seq.setSourceString(sequence); return seq; }
final public void NumericFunction() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case RAND: Rand(); break; case ABS: Abs(); break; case CEIL: Ceil(); break; case FLOOR: Floor(); break; case ROUND: Round(); break; default: jj_la1[129] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }
final public void Update() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LOAD: Load(); break; case CLEAR: Clear(); break; case DROP: Drop(); break; case ADD: Add(); break; case MOVE: Move(); break; case COPY: Copy(); break; case CREATE: Create(); break; default: jj_la1[159] = jj_gen; if (jj_2_5(2)) { InsertData(); } else if (jj_2_6(2)) { DeleteData(); } else if (jj_2_7(2)) {
final public void Query() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case SELECT: SelectQuery(); break; case CONSTRUCT: ConstructQuery(); break; case DESCRIBE: DescribeQuery(); break; case ASK: AskQuery(); break; default: jj_la1[4] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }
final public void Aggregate() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case COUNT: Count(); break; case SUM: Sum(); break; case MIN: Min(); break; case MAX: Max(); break; case AVG: Avg(); break; case SAMPLE: Sample(); break; case GROUP_CONCAT: GroupConcat(); break; default: jj_la1[117] = jj_gen; jj_consume_token(-1); throw new ParseException(); } }
final public void PrimaryExpression() throws ParseException { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case LPAREN: BrackettedExpression(); break; case EXISTS: case SHA384: case SHA512: BuiltInCall(); break; default: jj_la1[115] = jj_gen; if (jj_2_4(2)) { FunctionCall(); } else { switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case Q_IRI_REF: case PNAME_NS: case PNAME_LN: IRIref(); break; case STRING_LITERAL1: case STRING_LITERAL_LONG1: case STRING_LITERAL_LONG2: RDFLiteral(); break; case INTEGER:
public static ParsedQuery parseQuery(final String string, @Nullable final String baseURI, @Nullable final Map<String, String> namespaces) throws MalformedQueryException { try { final ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(string); StringEscapesProcessor.process(qc); BaseDeclProcessor.process(qc, baseURI);
final public void Concat() throws ParseException { /*@bgen(jjtree) Concat */ ASTConcat jjtn000 = new ASTConcat(JJTCONCAT); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(CONCAT); ArgList(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }
/** * Parses the supplied SPARQL query and builds a syntax tree from it. * * @param query A SPARQL query string. * @return The root of the syntax tree. * @throws TokenMgrError If the query was syntactically incorrect. * @throws ParseException If the query was syntactically incorrect. */ public static ASTQueryContainer parseQuery(String query) throws TokenMgrError, ParseException { SyntaxTreeBuilder stb = new SyntaxTreeBuilder( new StringReader(query) ); // Set size of tab to 1 to force tokenmanager to report correct column // index for substring splitting of service graph pattern. stb.jj_input_stream.setTabSize(1); ASTQueryContainer container = stb.QueryContainer(); container.setSourceString(query); return container; }
final public void FunctionCall() throws ParseException { /*@bgen(jjtree) FunctionCall */ ASTFunctionCall jjtn000 = new ASTFunctionCall(JJTFUNCTIONCALL); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { IRIref(); ArgList(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }
final public void NumericExpression() throws ParseException { AdditiveExpression(); }
ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); StringEscapesProcessor.process(qc); BaseDeclProcessor.process(qc, baseURI);
final public void In() throws ParseException { /*@bgen(jjtree) In */ ASTIn jjtn000 = new ASTIn(JJTIN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(IN); ArgList(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }
static ParsedQuery parse(final String queryStr, final String baseURI) throws MalformedQueryException { try { final ASTQueryContainer qc = SyntaxTreeBuilder.parseQuery(queryStr); StringEscapesProcessor.process(qc); BaseDeclProcessor.process(qc, baseURI);
final public void NotIn() throws ParseException { /*@bgen(jjtree) NotIn */ ASTNotIn jjtn000 = new ASTNotIn(JJTNOTIN); boolean jjtc000 = true; jjtree.openNodeScope(jjtn000); try { jj_consume_token(NOT_IN); ArgList(); } catch (Throwable jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } if (jjte000 instanceof RuntimeException) { {if (true) throw (RuntimeException)jjte000;} } if (jjte000 instanceof ParseException) { {if (true) throw (ParseException)jjte000;} } {if (true) throw (Error)jjte000;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }