本文整理了Java中com.hp.hpl.jena.query.ResultSet.next
方法的一些代码示例,展示了ResultSet.next
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.next
方法的具体详情如下:
包路径:com.hp.hpl.jena.query.ResultSet
类名称:ResultSet
方法名:next
[英]Moves onto the next result.
[中]转到下一个结果。
代码示例来源:origin: fr.inria.eventcloud/eventcloud-api
/**
* {@inheritDoc}
*/
@Override
public QuerySolution next() {
return super.object.next();
}
代码示例来源:origin: spaziocodice/SolRDF
@Override
public QuerySolution next() {
return resultset.next();
}
代码示例来源:origin: com.github.ansell.pellet/pellet-query
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();
}
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-jenaTDB
@Override
public Term next() {
QuerySolution next = this.rs.next();
return createTerm(next.get("?x"));
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples where the object belongs to the given class.
* @param cls
* @return
*/
public int getOccurencesInObjectPosition(NamedClass cls){
log.trace(String.format("Computing number of occurences in object position for %s", cls.getName()));
String query = String.format("SELECT (COUNT(?s) AS ?cnt) WHERE {?o a <%s>. ?s ?p ?o.}", cls.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int classOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return classOccurenceCnt;
}
代码示例来源:origin: de.unibonn.iai.eis/luzzu-io
@Override
public Integer call() throws Exception {
int size = qe.execSelect().next().get("count").asLiteral().getInt();
System.out.println(size);
return size;
}
});
代码示例来源:origin: AskNowQA/AutoSPARQL
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;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number triples with the given property as predicate.
* @param prop
* @return
*/
public int getOccurences(Property prop){
log.trace(String.format("Computing number of occurences as predicate for %s", prop.getName()));
String query = String.format("SELECT (COUNT(*) AS ?cnt) WHERE {?s <%s> ?o}", prop.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int propOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return propOccurenceCnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples where the subject belongs to the given class.
* @param cls
* @return
*/
public int getOccurencesInSubjectPosition(NamedClass cls){
log.trace(String.format("Computing number of occurences in subject position for %s", cls.getName()));
String query = String.format("SELECT (COUNT(?s) AS ?cnt) WHERE {?s a <%s>. ?s ?p ?o.}", cls.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int classOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return classOccurenceCnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples where the subject or object belongs to the given class.
* (This is not the same as computing the number of instances of the given class {@link SPARQLEndpointMetrics#getPopularity(NamedClass)})
* @param cls
* @return
*/
public int getOccurences(NamedClass cls){
log.trace(String.format("Computing number of occurences in subject or object position for %s", cls.getName()));
String query = String.format("SELECT (COUNT(?s) AS ?cnt) WHERE {?s a <%s>.{?s ?p1 ?o1.} UNION {?o2 ?p2 ?s} }", cls.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int classOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return classOccurenceCnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
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;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples where the given individual is in object position(in-going links).
* @param cls
* @return
*/
public int getOccurencesInObjectPosition(Individual ind){
log.trace(String.format("Computing number of occurences in object position for %s", ind.getName()));
String query = String.format("SELECT (COUNT(*) AS ?cnt) WHERE {?s ?p <%s>.}", ind.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int classOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return classOccurenceCnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of instances of the given class.
* @param cls
* @return
*/
public int getPopularity(NamedClass cls){
String query = String.format("SELECT (COUNT(?s) AS ?cnt) WHERE {?s a <%s>.{?s ?p1 ?o1.} UNION {?o2 ?p2 ?s} }", cls.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int classOccurenceCnt = rs.next().getLiteral("cnt").getInt();
return classOccurenceCnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples with the given property as predicate and where the subject belongs to the given class.
* @param cls
* @return
*/
public int getOccurencesSubjectPredicate(NamedClass cls, Property prop){
log.trace(String.format("Computing number of occurences as subject and predicate for [%s, %s]", cls.getName(), prop.getName()));
String query = String.format("SELECT (COUNT(*) AS ?cnt) WHERE {?s a <%s>. ?s <%s> ?o}", cls.getName(), prop.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int cnt = rs.next().getLiteral("cnt").getInt();
return cnt;
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples with the given property as predicate and where the object belongs to the given class.
* @param cls
* @return
*/
public int getOccurencesPredicateObject(Property prop, NamedClass cls){
log.trace(String.format("Computing number of occurences as predicate and object for [%s, %s]", prop.getName(), cls.getName()));
String query = String.format("SELECT (COUNT(*) AS ?cnt) WHERE {?o a <%s>. ?s <%s> ?o}", cls.getName(), prop.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int cnt = rs.next().getLiteral("cnt").getInt();
return cnt;
}
代码示例来源:origin: fr.lirmm.graphik/graal-store-jenaTDB
@Override
public Atom next() {
QuerySolution next = this.rs.next();
Predicate predicate = this.predicate;
if(predicate == null)
predicate = createPredicate(next.get("?p"), 2);
Term subject = this.subject;
if(subject == null)
subject = createTerm(next.get("?s"));
Term object = this.object;
if (object == null)
object = createTerm(next.get("?o"));
return new DefaultAtom(predicate, subject, object);
}
代码示例来源:origin: AskNowQA/AutoSPARQL
/**
* Returns the number of triples with the first given class as subject and the second given class as object.
* @param cls
* @return
*/
public int getOccurencesSubjectObject(NamedClass subject, NamedClass object){
log.trace(String.format("Computing number of occurences as subject and object for [%s, %s]", subject.getName(), object.getName()));
String query = String.format("SELECT (COUNT(*) AS ?cnt) WHERE {?s a <%s>. ?s ?p ?o. ?o a <%s>}", subject.getName(), object.getName());
ResultSet rs = SparqlQuery.convertJSONtoResultSet(cache.executeSelectQuery(endpoint, query));
int cnt = rs.next().getLiteral("cnt").getInt();
return cnt;
}
代码示例来源:origin: de.unibonn.iai.eis/luzzu-io
@Override
public Integer call() throws Exception{
String query = "SELECT DISTINCT (count(?s) AS ?count) { { ?s ?p ?o . } UNION { GRAPH ?g { ?s ?p ?o .} } }";
QueryEngineHTTP qe = (QueryEngineHTTP) QueryExecutionFactory.sparqlService(sparqlEndPoint,query);
int size = qe.execSelect().next().get("count").asLiteral().getInt();
return size;
}
});
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq
/** 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() ;
}
代码示例来源:origin: de.unibonn.iai.eis/luzzu-operations
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;
}
内容来源于网络,如有侵权,请联系作者删除!