/** * 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(final String sequence) throws TokenMgrError, ParseException { final SyntaxTreeBuilder stb = new SyntaxTreeBuilder( new StringReader(sequence) ); final ASTUpdateSequence seq = stb.UpdateSequence(); seq.setSourceString(sequence); return seq; }
/** * 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(final String sequence) throws TokenMgrError, ParseException { final SyntaxTreeBuilder stb = new SyntaxTreeBuilder( new StringReader(sequence) ); final ASTUpdateSequence seq = stb.UpdateSequence(); seq.setSourceString(sequence); return seq; }
/** * 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(final String query) throws TokenMgrError, ParseException { final 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); final ASTQueryContainer container = stb.QueryContainer(); container.setSourceString(query); return container; }
/** * 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(final String query) throws TokenMgrError, ParseException { final 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); final ASTQueryContainer container = stb.QueryContainer(); container.setSourceString(query); return container; }