本文整理了Java中org.apache.jena.query.ResultSet.next
方法的一些代码示例,展示了ResultSet.next
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.next
方法的具体详情如下:
包路径:org.apache.jena.query.ResultSet
类名称:ResultSet
方法名:next
[英]Move to the next binding (low level)
[中]移动到下一个绑定(低级别)
代码示例来源:origin: com.github.galigator.openllet/openllet-jena
public SlicedResultSet(final ResultSet results, final long offset, final long limit)
{
_results = results;
_row = 0;
_limit = limit;
for (int i = 0; i < offset && results.hasNext(); i++)
results.next();
}
代码示例来源:origin: Galigator/openllet
public SlicedResultSet(final ResultSet results, final long offset, final long limit)
{
_results = results;
_row = 0;
_limit = limit;
for (int i = 0; i < offset && results.hasNext(); i++)
results.next();
}
代码示例来源:origin: Galigator/openllet
public SlicedResultSet(final ResultSet results, final long offset, final long limit)
{
_results = results;
_row = 0;
_limit = limit;
for (int i = 0; i < offset && results.hasNext(); i++)
results.next();
}
代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-cache
@Override
public Long call() throws Exception {
for(; resultSet.hasNext() && (maxResultRow == null || currentRow < maxResultRow) && !Thread.interrupted(); ++currentRow) {
resultSet.next();
//ResultSet
//ResultSetFactory.create
}
return currentRow;
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
@Override
public Long call() throws Exception {
for(; resultSet.hasNext() && (maxResultRow == null || currentRow < maxResultRow) && !Thread.interrupted(); ++currentRow) {
resultSet.next();
//ResultSet
//ResultSetFactory.create
}
return currentRow;
}
代码示例来源:origin: apache/jena
private static RDFNode getExactlyOne(ResultSet rs, String varname) {
if ( ! rs.hasNext() )
return null;
QuerySolution qs = rs.next();
if ( rs.hasNext() )
return null;
return qs.get(varname);
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static Multiset<QuerySolution> toMultisetQs(ResultSet rs) {
Multiset<QuerySolution> result = HashMultiset.create();
while(rs.hasNext()) {
QuerySolution original = rs.next();
QuerySolution wrapped = new QuerySolutionWithEquals(original);
result.add(wrapped);
}
return result;
}
代码示例来源:origin: org.apache.jena/jena-fuseki-core
private static RDFNode getExactlyOne(ResultSet rs, String varname) {
if ( ! rs.hasNext() )
return null;
QuerySolution qs = rs.next();
if ( rs.hasNext() )
return null;
return qs.get(varname);
}
代码示例来源:origin: AtomGraph/Core
public static long hashResultSet(ResultSet result)
{
long hash = 0;
while (result.hasNext()) hash ^= hashQuerySolution(result.next());
return hash;
}
代码示例来源:origin: org.openbase.bco/ontology.lib
private QuerySolution getQuerySolutionFromOntDB(final String queryExpression) throws IOException, NotAvailableException {
final ResultSet resultSet = SparqlHttp.sparqlQuery(queryExpression, OntConfig.getOntologyDbUrl());
if (resultSet == null || !resultSet.hasNext()) {
throw new NotAvailableException("Could not get resultSet of query, because query result is invalid! Query wrong?");
}
return resultSet.next();
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public SortedSet<OWLClassExpression> getMeaningfulClasses(OWLClassExpression index, SortedSet<OWLClassExpression> targetClasses) {
String query = buildMeaningfulClassesQuery(index, targetClasses);
if (logger.isDebugEnabled()) logger.debug(sparql_debug, query);
SortedSet<OWLClassExpression> meaningfulClasses = new TreeSet<>();
ResultSet rs = executeSelectQuery(query);
while(rs.hasNext()) {
QuerySolution qs = rs.next();
meaningfulClasses.add(df.getOWLClass(IRI.create(qs.getResource("concept").getURI())));
}
return meaningfulClasses;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public int getObjectCountForProperty(OWLObjectProperty p, long timeout, TimeUnit timeoutUnits){
int cnt = -1;
String query = String.format(
"SELECT (COUNT(DISTINCT ?o) AS ?cnt) WHERE {?s <%s> ?o.}",
p.toStringID());
ResultSet rs = executeSelectQuery(query, timeout, timeoutUnits);
if(rs.hasNext()){
cnt = rs.next().getLiteral("cnt").getInt();
}
return cnt;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public int getObjectCountForProperty(OWLObjectProperty p){
int cnt = -1;
String query = String.format(
"SELECT (COUNT(DISTINCT ?o) AS ?cnt) WHERE {?s <%s> ?o.}",
p.toStringID());
ResultSet rs = executeSelectQuery(query);
if(rs.hasNext()){
cnt = rs.next().getLiteral("cnt").getInt();
}
return cnt;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public int getSubjectCountForProperty(OWLProperty p){
int cnt = -1;
String query = String.format(
"SELECT (COUNT(DISTINCT ?s) AS ?cnt) WHERE {?s <%s> ?o.}",
p.toStringID());
ResultSet rs = executeSelectQuery(query);
if(rs.hasNext()){
cnt = rs.next().getLiteral("cnt").getInt();
}
return cnt;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public int getSubjectCountForProperty(OWLProperty p, long timeout, TimeUnit timeoutUnits){
int cnt = -1;
String query = String.format(
"SELECT (COUNT(DISTINCT ?s) AS ?cnt) WHERE {?s <%s> ?o.}",
p.toStringID());
ResultSet rs = executeSelectQuery(query, timeout, timeoutUnits);
if(rs.hasNext()){
cnt = rs.next().getLiteral("cnt").getInt();
}
return cnt;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public Set<OWLClass> getTypes(String namespace, boolean omitEmptyTypes) {
Set<OWLClass> types = new TreeSet<>();
String query = "SELECT DISTINCT ?cls WHERE {[] a ?cls ." +
(omitEmptyTypes ? "[] a ?cls ." : "" ) +
(namespace != null ? ("FILTER(REGEX(?cls,'^" + namespace + "'))") : "") + "}";
ResultSet rs = executeSelectQuery(query);
while(rs.hasNext()){
QuerySolution qs = rs.next();
types.add(df.getOWLClass(IRI.create(qs.getResource("cls").getURI())));
}
return types;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public SortedSet<OWLClass> getMostSpecificClasses() {
SortedSet<OWLClass> classes = new TreeSet<>();
String query = "SELECT ?cls WHERE {?cls a <http://www.w3.org/2002/07/owl#Class>. "
+ "FILTER NOT EXISTS{?sub <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?cls. FILTER(?sub != <http://www.w3.org/2002/07/owl#Nothing>)}}";
ResultSet rs = executeSelectQuery(query);
QuerySolution qs;
while(rs.hasNext()){
qs = rs.next();
classes.add(df.getOWLClass(IRI.create(qs.getResource("cls").getURI())));
}
return classes;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
public SortedSet<OWLObjectProperty> getInverseObjectProperties(OWLObjectProperty property){
SortedSet<OWLObjectProperty> inverseObjectProperties = new TreeSet<>();
String query = "SELECT ?p WHERE {" +
"{<%p> <%ax> ?p.} UNION {?p <%ax> <%p>}}".replace("%p", property.toStringID()).replace("%ax", OWL.inverseOf.getURI());
ResultSet rs = executeSelectQuery(query);
QuerySolution qs;
while(rs.hasNext()){
qs = rs.next();
inverseObjectProperties.add(df.getOWLObjectProperty(IRI.create(qs.getResource("p").getURI())));
}
return inverseObjectProperties;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
private SortedSet<String> getAllResources(String query){
SortedSet<String> resources = new TreeSet<>();
query = query + " LIMIT 1000";
QueryExecution qe = qef.createQueryExecution(query);
ResultSet rs = qe.execSelect();
QuerySolution qs;
while(rs.hasNext()){
qs = rs.next();
resources.add(qs.getResource("x0").getURI());
}
qe.close();
return resources;
}
代码示例来源:origin: SmartDataAnalytics/DL-Learner
@Override
public Map<OWLIndividual, SortedSet<OWLLiteral>> getDatatypeMembersImpl(OWLDataProperty dataProperty) {
Map<OWLIndividual, SortedSet<OWLLiteral>> subject2objects = new HashMap<>();
String query = String.format(SPARQLQueryUtils.SELECT_PROPERTY_RELATIONSHIPS_QUERY, dataProperty.toStringID());
ResultSet rs = executeSelectQuery(query);
while(rs.hasNext()){
QuerySolution qs = rs.next();
OWLIndividual sub = df.getOWLNamedIndividual(IRI.create(qs.getResource("var1").getURI()));
OWLLiteral obj = OwlApiJenaUtils.getOWLLiteral(qs.getLiteral("var2"));
subject2objects.computeIfAbsent(sub, k -> new TreeSet<>()).add(obj);
}
return subject2objects;
}
内容来源于网络,如有侵权,请联系作者删除!