@Override protected QuerySolutionMap getQuerySolutionMap(Boolean t) { QuerySolutionMap map = new QuerySolutionMap(); map.add(VALUE, model.createTypedLiteral(t)); return map; }
@Override public String toString() { String tmp = "" ; String sep = "" ; for ( Iterator<String> iter = varNames() ; iter.hasNext() ; ) { String varName = iter.next() ; RDFNode n = _get(varName) ; String nStr = FmtUtils.stringForRDFNode(n) ; tmp = tmp+sep+"( ?"+varName+", "+nStr+" )" ; } return tmp ; }
public ArqRowItem(int rowNumber, QuerySolution soln) { myRowNumber = rowNumber; // Must consume the soln. mySolutionCopy = new QuerySolutionMap(); mySolutionCopy.addAll(soln); } @Override protected Literal getLiteralVal(Ident fieldID, boolean throwOnFailure) {
public QueryParameters(QuerySolution initialBinding) { this(); if (initialBinding == null) initialBinding = new QuerySolutionMap(); for (Iterator iter = initialBinding.varNames(); iter.hasNext(); ) { String varName = (String)iter.next(); ATermAppl key = ATermUtils.makeVar(varName); ATermAppl value = JenaUtils.makeATerm(initialBinding.get( varName )); parameters.put( key, value ); } }
private List<Triple> resolveParameterization(List<?> triples) { if( triples == null ) throw new NullPointerException( "The set of triples cannot be null" ); // Ensure that the initial binding is not a null pointer if( initialBinding == null ) initialBinding = new QuerySolutionMap(); List<Triple> ret = new ArrayList<Triple>(); for( final Triple t : triples.toArray( new Triple[triples.size()] ) ) { if( !triples.contains( t ) ) { continue; } Node s = resolveParameterization( t.getSubject() ); Node p = resolveParameterization( t.getPredicate() ); Node o = resolveParameterization( t.getObject() ); ret.add( Triple.create( s, p, o ) ); } return ret; }
@Override protected QuerySolutionMap getQuerySolutionMap(Triple t) { QuerySolutionMap map = new QuerySolutionMap(); map.add(SUBJECT, model.asRDFNode(t.getSubject())); map.add(PREDICATE, model.asRDFNode(t.getPredicate())); map.add(OBJECT, model.asRDFNode(t.getObject())); return map; }
@Override public String toString() { String tmp = "" ; String sep = "" ; for ( Iterator<String> iter = varNames() ; iter.hasNext() ; ) { String varName = iter.next() ; RDFNode n = _get(varName) ; String nStr = FmtUtils.stringForRDFNode(n) ; tmp = tmp+sep+"( ?"+varName+", "+nStr+" )" ; } return tmp ; }
public static Resource findRootByType(Model model, Resource atype) { String s = StrUtils.strjoin("\n", "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" , "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>", "SELECT DISTINCT ?root { { ?root rdf:type ?ATYPE } UNION { ?root rdf:type ?t . ?t rdfs:subClassOf ?ATYPE } }") ; Query q = QueryFactory.create(s) ; QuerySolutionMap qsm = new QuerySolutionMap() ; qsm.add("ATYPE", atype) ; QueryExecution qExec = QueryExecutionFactory.create(q, model, qsm); Resource r = (Resource)QueryExecUtils.getOne(qExec, "root") ; return r; }
public static Resource findRootByType(Model model, Resource atype) { String s = StrUtils.strjoin("\n", "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>" , "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>", "SELECT DISTINCT ?root { { ?root rdf:type ?ATYPE } UNION { ?root rdf:type ?t . ?t rdfs:subClassOf ?ATYPE } }") ; Query q = QueryFactory.create(s) ; QuerySolutionMap qsm = new QuerySolutionMap() ; qsm.add("ATYPE", atype) ; QueryExecution qExec = QueryExecutionFactory.create(q, model, qsm); Resource r = (Resource)QueryExecUtils.getOne(qExec, "root") ; return r; }
ResultSetRewindable results, String joinVars, int pos) { QuerySolutionMap initialBinding = new QuerySolutionMap(); QuerySolution s = new QuerySolutionMap(); initialBinding.add(st, s.get(st));
ResultSetRewindable results, String joinVars, int pos) { QuerySolutionMap initialBinding = new QuerySolutionMap(); QuerySolution s = new QuerySolutionMap(); initialBinding.add(st, s.get(st));
final List<T> parseCollection() { List<T> result=null; QuerySolutionMap parameters = new QuerySolutionMap(); parameters.add(this.targetVariable,this.resource); QueryExecution queryExecution=QueryExecutionFactory.create(this.query,this.model); queryExecution.setInitialBinding(parameters); try { ResultSet results = queryExecution.execSelect(); result=processResults(results); } finally { queryExecution.close(); } return result; }
new com.hp.hpl.jena.query.QuerySolutionMap(); if (pattern.getContext() != null) { initialBindings.add("c", this.dataset.getDefaultModel() .createResource(context)); initialBindings.add("s", this.dataset.getDefaultModel().createResource(subject)); initialBindings.add("p", this.dataset.getDefaultModel().createResource(predicate)); initialBindings.add("o", this.dataset.getDefaultModel().createResource(object));
public Object processPreQuery(InternalParamCollection params, int queryLevel) throws DataServiceFault { try { ResultSet results; QuerySolutionMap queryMap = new QuerySolutionMap(); Model model = this.getModelForValidation(); /* process the query params */ for (InternalParam param : params.getParams()) { /* set parameters to the query map */ queryMap.add(param.getName(), convertTypeLiteral(model, param)); } QueryExecution qe = this.getQueryExecution(); qe.setInitialBinding(queryMap) ; /* execute query as a select query */ results = qe.execSelect(); return results; } catch (Exception e) { throw new DataServiceFault(e, "Error in 'SparqlQueryBase.processQuery'"); } }
private Object processPreQuery(InternalParamCollection params, int queryLevel) throws DataServiceFault { try { ResultSet results; QuerySolutionMap queryMap = new QuerySolutionMap(); Model model = this.getConfig().createRDFModel(); /* process the query params */ for (InternalParam param : params.getParams()) { /* set parameters to the querry map */ queryMap.add(param.getName(), convertTypeLiteral(model, param)); } QueryExecution qe = QueryExecutionFactory.create(this.getQuery(), model); qe.setInitialBinding(queryMap) ; /* execute querry as a select querry */ results = qe.execSelect(); return results; } catch (Exception e) { throw new DataServiceFault(e, "Error in 'SPARQLQuery.processQuery'"); } }
QuerySolutionMap qsm = new QuerySolutionMap() ; qsm.add("x", r) ; QueryExecution qExec = QueryExecutionFactory.create(qs, r.getModel(), qsm) ; ResultSet rs = qExec.execSelect() ;
QuerySolutionMap qsm = new QuerySolutionMap() ; qsm.add("s", r) ; QueryExecution qExec = QueryExecutionFactory.create(query, dataset, qsm) ; ResultSet rs = qExec.execSelect() ;
QuerySolutionMap qsm = new QuerySolutionMap() ; qsm.add("s", r) ; QueryExecution qExec = QueryExecutionFactory.create(query, dataset, qsm) ; ResultSet rs = qExec.execSelect() ;