com.hp.hpl.jena.query.ResultSet.hasNext()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(125)

本文整理了Java中com.hp.hpl.jena.query.ResultSet.hasNext方法的一些代码示例,展示了ResultSet.hasNext的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResultSet.hasNext方法的具体详情如下:
包路径:com.hp.hpl.jena.query.ResultSet
类名称:ResultSet
方法名:hasNext

ResultSet.hasNext介绍

[英]Is there another result?
[中]还有其他结果吗?

代码示例

代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-arq

/**
 * Gets whether we can peek
 * @return True if we can peek, false otherwise
 */
private boolean canPeek() {
  return this.results.hasNext();
}

代码示例来源:origin: fr.inria.eventcloud/eventcloud-api

/**
 * {@inheritDoc}
 */
@Override
public boolean hasNext() {
  return super.object.hasNext();
}

代码示例来源:origin: com.github.ansell.pellet/pellet-query

/**
 * {@inheritDoc}
 */
public boolean hasNext() {
  return row < limit && results.hasNext();
}

代码示例来源:origin: com.hp.hpl.jena/arq

@Override
protected boolean hasNextBinding()      { return resultSet.hasNext() ; }
@Override

代码示例来源:origin: apache/stanbol

@Override
public boolean hasNext() {
  return resultSet.hasNext();
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-jenaTDB

@Override
public boolean hasNext() {
  if (this.rs.hasNext()) {
    return true;
  } else {
    this.close();
    return false;
  }
}

代码示例来源:origin: fr.lirmm.graphik/graal-store-jenaTDB

@Override
public boolean hasNext() {
  if (this.rs.hasNext()) {
    return true;
  } else {
    this.close();
    return false;
  }
}

代码示例来源: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: spaziocodice/SolRDF

@Override
public boolean hasNext() {
  return resultSet.getRowNumber() < (offset + size) && resultSet.hasNext();
}

代码示例来源:origin: org.apache.clerezza/rdf.jena.sparql

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();
}

代码示例来源:origin: com.github.ansell.pellet/pellet-query

@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;
}

代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core

@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);
    }
  }
}

代码示例来源:origin: org.wso2.carbon.data/org.wso2.carbon.dataservices.core

@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);
    }
  }
}

代码示例来源: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: org.smartdeveloperhub.curator/sdh-curator-connector

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;
}

代码示例来源: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: com.hp.hpl.jena/arq

/** 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() ; }
}

代码示例来源:origin: com.github.ansell.pellet/pellet-query

/**
 * {@inheritDoc}
 */
public boolean execAsk() {
  ensureQueryType( QueryType.ASK );
  ResultSet results = exec();
  return (results != null)
    ? results.hasNext()
    : QueryExecutionFactory.create( query, source, initialBinding ).execAsk();
}

代码示例来源: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;
}

相关文章