public void visitConstructResultForm(Query query) { x ^= query.getConstructTemplate().hashCode() ; }
@Override public void visitConstructResultForm(Query query) { x ^= query.getConstructTemplate().hashCode() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { @Override public void exec(SPARQLParser11 parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { @Override public void exec(SPARQLParser10 parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { public void exec(SPARQLParser11 parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { public void exec(SPARQLParser10 parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { public void exec(ARQParser parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public static Template parseTemplate(String string) { final Query query = new Query () ; Action action = new Action() { @Override public void exec(ARQParser parser) throws Exception { Template t = parser.ConstructTemplate() ; query.setConstructTemplate(t) ; } } ; perform(query, string, action) ; return query.getConstructTemplate() ; }
public void visitConstructResultForm(Query query1) { check("Not both CONSTRUCT queries", query2.isConstructType()) ; check("CONSTRUCT templates", query1.getConstructTemplate().equalIso(query2.getConstructTemplate(), new NodeIsomorphismMap()) ) ; }
@Override public void visitConstructResultForm(Query query1) { check("Not both CONSTRUCT queries", query2.isConstructType()) ; check("CONSTRUCT templates", query1.getConstructTemplate().equalIso(query2.getConstructTemplate(), new NodeIsomorphismMap()) ) ; }
private void execute(String sparqlQuery) { Query sparql = QueryFactory.create(sparqlQuery); this.prefixes = new LinkedList<Prefix>(); for(Map.Entry<String,String> e : sparql.getPrefixMapping().getNsPrefixMap().entrySet()) { this.prefixes.add(new Prefix(e.getKey(), e.getValue())); } Rule rule = new DefaultRule(); if (sparql.isConstructType()) { Template template = sparql.getConstructTemplate(); for (Triple triple : template.getTriples()) { rule.getHead().add(SparqlUtils.triple2Atom(triple)); } } ElementVisitorImpl visitor = new ElementVisitorImpl(rule.getBody()); sparql.getQueryPattern().visit(visitor); this.rule = rule; }
public void visitConstructResultForm(Query query) { out.print("CONSTRUCT ") ; // if ( query.isQueryResultStar() ) // { // out.print("*") ; // out.newline() ; // } // else { out.incIndent(BLOCK_INDENT) ; out.newline() ; Template t = query.getConstructTemplate() ; fmtTemplate.format(t) ; out.decIndent(BLOCK_INDENT) ; } }
@Override public void visitConstructResultForm(Query query) { out.print("CONSTRUCT ") ; // if ( query.isQueryResultStar() ) // { // out.print("*") ; // out.newline() ; // } // else { out.incIndent(BLOCK_INDENT) ; out.newline() ; Template t = query.getConstructTemplate() ; fmtTemplate.format(t) ; out.decIndent(BLOCK_INDENT) ; } }
Template template = query.getConstructTemplate() ;
public RuleforJena(Query constructQuery, int id) { this.id = id; antecedent = Algebra.compile(constructQuery); // KAVITHA: the consequent should be a single triple List<Triple> list = constructQuery.getConstructTemplate().getBGP() .getList(); consequent = new OpTriple(list.get(0)); if (SPARQLRewriterForJena.GENERATE_TRACE == true) { Op bind = null; VarExprList expr = new VarExprList(); expr.add( Var.alloc("RULEID"), new NodeValueNode(Node_Literal.createLiteral(String .valueOf(id)))); bind = OpExtend.extend(antecedent, expr); antecedent = bind; } }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") public Model execConstruct(Model model) { ensureQueryType( QueryType.CONSTRUCT ); ResultSet results = exec(); if( results == null ) { QueryExecutionFactory.create( query, source, initialBinding ).execConstruct( model ); } else { model.setNsPrefixes( source.getDefaultModel() ); model.setNsPrefixes( query.getPrefixMapping() ); Set set = new HashSet(); Template template = query.getConstructTemplate(); while( results.hasNext() ) { Map bNodeMap = new HashMap(); Binding binding = results.nextBinding(); template.subst( set, bNodeMap, binding ); } for( Iterator iter = set.iterator(); iter.hasNext(); ) { Triple t = (Triple) iter.next(); Statement stmt = ModelUtils.tripleToStatement( model, t ); if( stmt != null ) model.add( stmt ); } close(); } return model; }
@Override public Iterator<Triple> execConstructTriples() { if ( ! query.isConstructType() ) throw new QueryExecException("Attempt to get a CONSTRUCT model from a "+labelForQuery(query)+" query") ; // This causes there to be no PROJECT around the pattern. // That in turn, exposes the initial bindings. query.setQueryResultStar(true) ; startQueryIterator() ; Template template = query.getConstructTemplate() ; return TemplateLib.calcTriples(template.getTriples(), queryIterator); }