/** Add all of the solutions from one QuerySolution into this QuerySolutionMap */ public void addAll(QuerySolution other) { Iterator<String> iter = other.varNames() ; for ( ; iter.hasNext(); ) { String vName = iter.next() ; RDFNode rdfNode = other.get(vName) ; map.put(vName, rdfNode); } }
/** Add all of the solutions from one QuerySolution into this QuerySolutionMap */ public void addAll(QuerySolution other) { Iterator<String> iter = other.varNames() ; for ( ; iter.hasNext(); ) { String vName = iter.next() ; RDFNode rdfNode = other.get(vName) ; map.put(vName, rdfNode); } }
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 ); } }
/** This operation faithfully walks the results but does nothing with them. * @return The count of the number of solutions. */ public static int consume(ResultSet resultSet) { int count = 0 ; for ( ; resultSet.hasNext() ; ) { // Force nodes to be materialized. QuerySolution result = resultSet.nextSolution() ; for ( Iterator<String> iter = result.varNames() ; iter.hasNext() ; ) { String vn = iter.next(); RDFNode n = result.get(vn) ; } count++ ; } return count ; }
public HashMapSolutionMapping(QuerySolution querySolution) { final Iterator<String> varNames = querySolution.varNames(); while (varNames.hasNext()) { final String varName = varNames.next(); put(new Variable(varName), toRDFTerm(querySolution.get(varName))); } } @Override
private Binding copyToBinding(QuerySolution qs) { BindingMap b = BindingFactory.create() ; for ( Iterator<String> iter = qs.varNames() ; iter.hasNext() ; ) { String varName = iter.next() ; RDFNode rn = qs.get(varName) ; b.add(Var.alloc(varName), rn.asNode()) ; } return b ; }
/** This operation faithfully walks the results but does nothing with them. * @return The count of the number of solutions. */ public static int consume(ResultSet resultSet) { int count = 0 ; for ( ; resultSet.hasNext() ; ) { // Force nodes to be materialized. QuerySolution result = resultSet.nextSolution() ; for ( Iterator<String> iter = result.varNames() ; iter.hasNext() ; ) { String vn = iter.next(); RDFNode n = result.get(vn) ; } count++ ; } return count ; }
private Binding copyToBinding(QuerySolution qs) { BindingMap b = new BindingMap() ; for ( Iterator<String> iter = qs.varNames() ; iter.hasNext() ; ) { String varName = iter.next() ; RDFNode rn = qs.get(varName) ; b.add(Var.alloc(varName), rn.asNode()) ; } return b ; }
public static void addToBinding(Binding binding, QuerySolution qSolution) { if ( qSolution == null ) return ; for ( Iterator<String> iter = qSolution.varNames() ; iter.hasNext() ; ) { String n = iter.next() ; RDFNode x = qSolution.get(n) ; //XXX if ( Var.isBlankNodeVarName(n) ) continue ; try { binding.add(Var.alloc(n), x.asNode()) ; } catch (Exception ex) { System.err.println("!!!") ; } } }
private int loadPopularity(String uri, EntityType entityType){ String query; if(entityType == EntityType.CLASS){ query = String.format("SELECT COUNT(?s) WHERE {?s a <%s>}", uri); } else if(entityType == EntityType.PROPERTY){ query = String.format("SELECT COUNT(*) WHERE {?s <%s> ?o}", uri); } else { query = String.format("SELECT COUNT(*) WHERE {?s ?p <%s>}", uri); } int pop = 0; ResultSet rs = queryable.query(query); QuerySolution qs; String projectionVar; while(rs.hasNext()){ qs = rs.next(); projectionVar = qs.varNames().next(); pop = qs.get(projectionVar).asLiteral().getInt(); } return pop; }
public static void addToBinding(BindingMap binding, QuerySolution qSolution) { if ( qSolution == null ) return ; for ( Iterator<String> iter = qSolution.varNames() ; iter.hasNext() ; ) { String n = iter.next() ; RDFNode x = qSolution.get(n) ; if ( Var.isBlankNodeVarName(n) ) continue ; try { binding.add(Var.alloc(n), x.asNode()) ; } catch (ARQInternalErrorException ex) { // bad binding attempt. Log.warn(BindingUtils.class, "Attempt to bind " + n + " when already bound") ; } } }
public void toInteractions(ResultSet results) throws StudyImporterException { final InteractionListener listener = new InteractionListenerImpl(nodeFactory, getGeoNamesService(), getLogger()); while (results.hasNext()) { QuerySolution next = results.next(); Iterator<String> nameIter = next.varNames(); Map<String, String> props = new TreeMap<>(); while (nameIter.hasNext()) { String key = nameIter.next(); RDFNode rdfNode = next.get(key); if (rdfNode.isURIResource()) { props.put(key, next.getResource(key).getURI()); } else { props.put(key, next.getLiteral(key).getString()); } } props.put(StudyImporterForTSV.STUDY_SOURCE_CITATION, getDataset().getCitation()); listener.newLink(props); } }
for (; results.hasNext();) { QuerySolution soln = results.nextSolution(); Iterator<String> varNames = soln.varNames(); RDFNode lastNode = null; for (; varNames.hasNext(); ) {
rBind.varNames() : resultSet.getResultVars().iterator() ;
rBind.varNames() : resultSet.getResultVars().iterator() ;