/** * Gets whether we can peek * @return True if we can peek, false otherwise */ private boolean canPeek() { return this.results.hasNext(); }
/** * {@inheritDoc} */ @Override public boolean hasNext() { return super.object.hasNext(); }
/** * {@inheritDoc} */ public boolean hasNext() { return row < limit && results.hasNext(); }
@Override protected boolean hasNextBinding() { return resultSet.hasNext() ; } @Override
@Override public boolean hasNext() { return resultSet.hasNext(); }
@Override public boolean hasNext() { if (this.rs.hasNext()) { return true; } else { this.close(); return false; } }
@Override public boolean hasNext() { if (this.rs.hasNext()) { return true; } else { this.close(); return false; } }
public SlicedResultSet( ResultSet results, long offset, long limit ) { this.results = results; this.row = 0; this.limit = limit; for( int i = 0; i < offset && results.hasNext(); i++ ) { results.next(); } }
@Override public boolean hasNext() { return resultSet.getRowNumber() < (offset + size) && resultSet.hasNext(); }
public ResultSetWrapper(final ResultSet jenaResultSet) { final List<QuerySolution> solutions = new ArrayList<QuerySolution>(); while (jenaResultSet.hasNext()) { solutions.add(jenaResultSet.nextSolution()); } solutionsIter = solutions.iterator(); resultVars = jenaResultSet.getResultVars(); }
@SuppressWarnings("unchecked") public SortedResultSet(ResultSet results, List<SortCondition> sortConditions) { resultVars = results.getResultVars(); sortedRows = new ArrayList<Binding>(); while( results.hasNext() ) { sortedRows.add( results.nextBinding() ); } BindingComparator cmp = new BindingComparator( sortConditions ); Collections.sort( sortedRows, cmp ); iterator = sortedRows.iterator(); row = 0; }
@Override public void processPostQuery(Object result, XMLStreamWriter xmlWriter, InternalParamCollection params, int queryLevel) throws DataServiceFault { ResultSet results = (ResultSet) result; DataEntry dataEntry; while (results != null && results.hasNext()) { dataEntry = this.getDataEntryFromRS(results); this.writeResultEntry(xmlWriter, dataEntry, params, queryLevel); } } }
@Override public void processPostQuery(Object result, XMLStreamWriter xmlWriter, InternalParamCollection params, int queryLevel) throws DataServiceFault { ResultSet results = (ResultSet) result; DataEntry dataEntry; while (results != null && results.hasNext()) { dataEntry = this.getDataEntryFromRS(results); this.writeResultEntry(xmlWriter, dataEntry, params, queryLevel); } } }
public Set<DatatypeProperty> getAllDataProperties() { Set<DatatypeProperty> properties = new TreeSet<DatatypeProperty>(); String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?p WHERE {?p a owl:DatatypeProperty}"; ResultSet q = queryable.query(query); while (q.hasNext()) { QuerySolution qs = q.next(); properties.add(new DatatypeProperty(qs.getResource("p").getURI())); } return properties; }
private List<T> processResults(ResultSet results) { List<T> result=Lists.newArrayList(); for(; results.hasNext();) { QuerySolution solution = results.nextSolution(); B builder = newBuilder(); solutionParser(). withSolution(solution). withBuilder(builder). parse(); result.add(builder.build()); } return result; }
public Set<ObjectProperty> getAllObjectProperties() { Set<ObjectProperty> properties = new TreeSet<ObjectProperty>(); String query = "PREFIX owl: <http://www.w3.org/2002/07/owl#> SELECT ?p WHERE {?p a owl:ObjectProperty}"; ResultSet q = queryable.query(query); while (q.hasNext()) { QuerySolution qs = q.next(); properties.add(new ObjectProperty(qs.getResource("p").getURI())); } return properties; }
/** Execute, expecting the result to be one row, one column. Return that one RDFNode or throw an exception */ public static RDFNode getExactlyOne(QueryExecution qExec, String varname) { try { ResultSet rs = qExec.execSelect() ; if ( ! rs.hasNext() ) throw new ARQException("Not found: var ?"+varname) ; QuerySolution qs = rs.nextSolution() ; RDFNode r = qs.get(varname) ; if ( rs.hasNext() ) throw new ARQException("More than one: var ?"+varname) ; return r ; } finally { qExec.close() ; } }
/** * {@inheritDoc} */ public boolean execAsk() { ensureQueryType( QueryType.ASK ); ResultSet results = exec(); return (results != null) ? results.hasNext() : QueryExecutionFactory.create( query, source, initialBinding ).execAsk(); }
/** Output a result set in BIO format */ public static void outputAsBIO(OutputStream out, ResultSet results) { List<Var> vars = Var.varList(results.getResultVars()) ; BindingOutputStream bout = new BindingOutputStream(out, vars) ; for ( ; results.hasNext() ; ) { Binding b = BindingUtils.asBinding(results.next()) ; bout.write(b) ; } bout.flush() ; }
public String getComputedOn(){ String selectQuery = "SELECT ?cOn { graph <"+currentGraphURI+"> { ?s <"+DAQ.computedOn.getURI()+"> ?cOn } }"; QueryExecution exec = QueryExecutionFactory.create(QueryFactory.create(selectQuery), dsLoader.getInternalDataset()); ResultSet set = exec.execSelect(); while(set.hasNext()){ QuerySolution qs = set.next(); Resource computedOn = qs.getResource("cOn"); return computedOn.getURI(); } return null; }