/** Format the query * @param query The query * @param writer IndentedWriter */ static public void serialize(Query query, IndentedWriter writer) { Syntax s = query.getSyntax() ; if ( s == null ) s = Syntax.defaultQuerySyntax ; serialize(query, writer, s) ; }
/** Format the query * @param query The query * @param writer IndentedWriter */ static public void serialize(Query query, IndentedWriter writer) { Syntax s = query.getSyntax() ; if ( s == null ) s = Syntax.defaultQuerySyntax ; serialize(query, writer, s) ; }
/** Format the query into the buffer * @param query The query * @param buff IndentedLineBuffer */ static public void serialize(Query query, IndentedLineBuffer buff) { Syntax s = query.getSyntax() ; if ( s == null ) s = Syntax.defaultQuerySyntax ; serialize(query, buff, s) ; }
/** Format the query into the buffer * @param query The query * @param buff IndentedLineBuffer */ static public void serialize(Query query, IndentedLineBuffer buff) { Syntax s = query.getSyntax() ; if ( s == null ) s = Syntax.defaultQuerySyntax ; serialize(query, buff, s) ; }
/** * Makes a copy of this query. Copies by parsing a query from the serialized form of this query * @return Copy of this query */ public Query cloneQuery() { // A little crude. // Must use toString() rather than serialize() because we may not know how to serialize extended syntaxes String qs = this.toString(); return QueryFactory.create(qs, getSyntax()) ; }
private Element process(BasicPattern pattern) { // The different SPARQL versions use different internal structures for BGPs. if ( query.getSyntax() == Syntax.syntaxSPARQL_10 ) { ElementTriplesBlock e = new ElementTriplesBlock() ; for (Triple t : pattern) // Leave bNode variables as they are // Query serialization will deal with them. e.addTriple(t) ; return e ; } if ( query.getSyntax() == Syntax.syntaxSPARQL_11 || query.getSyntax() == Syntax.syntaxARQ ) { ElementPathBlock e = new ElementPathBlock() ; for (Triple t : pattern) // Leave bNode variables as they are // Query serialization will deal with them. e.addTriple(t) ; return e ; } throw new ARQInternalErrorException("Unrecognized syntax: "+query.getSyntax()) ; }
private Element process(BasicPattern pattern) { // The different SPARQL versions use different internal structures for BGPs. if ( query.getSyntax() == Syntax.syntaxSPARQL_10 ) { ElementTriplesBlock e = new ElementTriplesBlock() ; for (Triple t : pattern) // Leave bNode variables as they are // Query serialization will deal with them. e.addTriple(t) ; return e ; } if ( query.getSyntax() == Syntax.syntaxSPARQL_11 || query.getSyntax() == Syntax.syntaxARQ ) { ElementPathBlock e = new ElementPathBlock() ; for (Triple t : pattern) // Leave bNode variables as they are // Query serialization will deal with them. e.addTriple(t) ; return e ; } throw new ARQInternalErrorException("Unrecognized syntax: "+query.getSyntax()) ; }
syntaxURI = query.getSyntax() ; else query.setSyntax(syntaxURI) ;
syntaxURI = query.getSyntax() ; else query.setSyntax(syntaxURI) ;
private static void check(Query query, Collection<Var> vars) { // Check any expressions are assigned to fresh variables. checkExprListAssignment(vars, query.getProject()) ; // Check for SELECT * GROUP BY // Legal in ARQ, not in SPARQL 1.1 if ( ! Syntax.syntaxARQ.equals(query.getSyntax()) ) { if ( query.isQueryResultStar() && query.hasGroupBy() ) throw new QueryParseException("SELECT * not legal with GROUP BY", -1 , -1) ; } // Check any variable in an expression is in scope (if GROUP BY) checkExprVarUse(query) ; // Check GROUP BY AS // ENABLE if ( false && query.hasGroupBy() ) { VarExprList exprList2 = query.getGroupBy() ; checkExprListAssignment(vars, exprList2) ; // CHECK } }
private static void check(Query query, Collection<Var> vars) { // Check any expressions are assigned to fresh variables. checkExprListAssignment(vars, query.getProject()) ; // Check for SELECT * GROUP BY // Legal in ARQ, not in SPARQL 1.1 if ( ! Syntax.syntaxARQ.equals(query.getSyntax()) ) { if ( query.isQueryResultStar() && query.hasGroupBy() ) throw new QueryParseException("SELECT * not legal with GROUP BY", -1 , -1) ; } // Check any variable in an expression is in scope (if GROUP BY) checkExprVarUse(query) ; // Check GROUP BY AS // ENABLE if ( false && query.hasGroupBy() ) { VarExprList exprList2 = query.getGroupBy() ; checkExprListAssignment(vars, exprList2) ; // CHECK } }