org.apache.jena.rdf.model.ResIterator.hasNext()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(76)

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

ResIterator.hasNext介绍

暂无

代码示例

代码示例来源:origin: google/data-transfer-project

private List<VCard> parseAddressBook(Resource selfResource, SolidUtilities utilities)
  throws IOException {
 String peopleUri = selfResource.getProperty(NAME_EMAIL_INDEX_PROPERTY).getResource().getURI();
 Model peopleModel = utilities.getModel(peopleUri);
 List<VCard> vcards = new ArrayList<>();
 ResIterator subjects = peopleModel.listSubjects();
 while (subjects.hasNext()) {
  Resource subject = subjects.nextResource();
  Model personModel = utilities.getModel(subject.getURI());
  Resource personResource = SolidUtilities.getResource(subject.getURI(), personModel);
  if (personResource == null) {
   throw new IllegalStateException(subject.getURI() + " not found in " + subject.toString());
  }
  vcards.add(parsePerson(personResource));
 }
 return vcards;
}

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

@Override
  public boolean hasNext() {
    if (modelListSubjects().hasNext())
      codeCoverage[7]++;
    return false;
  }
}, backStop };

代码示例来源:origin: org.apache.jena/jena-core

@Override
  public boolean hasNext() {
    if (modelListSubjects().hasNext())
      codeCoverage[7]++;
    return false;
  }
}, backStop };

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

public static Resource getResourceByType(Model model, Resource type) {
  ResIterator sIter = model.listSubjectsWithProperty(RDF.type, type) ;
  if ( !sIter.hasNext() )
    return null ;
  Resource r = sIter.next();
  if ( sIter.hasNext() )
    throw new TypeNotUniqueException(r) ;
  return r ;
}

代码示例来源:origin: io.github.luzzu/luzzu-annotations

/**
 * Checks if a category uri exists in the metadata
 * 
 * @param categoryType - The URI of the Category Type
 * @return The URI if exists or null
 */
private Resource categoryExists(Resource categoryType){
  ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, categoryType);
  if (resIte.hasNext()){
    return resIte.next();
  }
  return null;
}

代码示例来源:origin: io.github.luzzu/luzzu-annotations

/**
   * Checks if a metric uri exists in the metadata
   * 
   * @param metricType - The URI of the Metric Type
   * @return The URI if exists or null
   */
  private Resource metricExists(Resource metricType){
    ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, metricType);
    if (resIte.hasNext()){
      return resIte.next();
    }
    return null;
  }
}

代码示例来源:origin: io.github.luzzu/luzzu-annotations

/**
 * Checks if a dimension uri exists in the metadata
 * 
 * @param dimensionType - The URI of the Dimension Type
 * @return The URI if exists or null
 */
private Resource dimensionExists(Resource dimensionType){
  ResIterator resIte = this.metadata.listSubjectsWithProperty(RDF.type, dimensionType);
  if (resIte.hasNext()){
    return resIte.next();
  }
  return null;
}

代码示例来源:origin: com.powsybl/powsybl-triple-store-impl-jena

private static Resource[] subjectsTypes(Model model) {
  Set<Resource> types = new HashSet<>();
  ResIterator rs = model.listSubjects();
  while (rs.hasNext()) {
    Resource r = rs.nextResource();
    Statement s = type(r);
    if (s != null) {
      types.add(s.getObject().asResource());
    }
  }
  return types.toArray(new Resource[0]);
}

代码示例来源:origin: at.researchstudio.sat/won-utils-conversation

public Set<URI> getPendingCancellationProposalUris(){
  Model cancellations = pendingProposals.getDefaultModel();
  if (cancellations == null) {
    return Collections.EMPTY_SET;
  }
  Set ret = new HashSet<URI>();
  ResIterator it = cancellations.listSubjectsWithProperty(WONAGR.PROPOSES_TO_CANCEL);
  while(it.hasNext()) {
    String uri = it.next().asResource().getURI();
    ret.add(URI.create(uri));
  }
  return ret;
}

代码示例来源:origin: org.apache.jena/jena-core

protected void writeRDFStatements( Model model, PrintWriter writer )
  {
  ResIterator rIter = model.listSubjects();
  while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(), writer );
  }

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

protected void writeRDFStatements( Model model, PrintWriter writer )
  {
  ResIterator rIter = model.listSubjects();
  while (rIter.hasNext()) writeRDFStatements( model, rIter.nextResource(), writer );
  }

代码示例来源:origin: semantic-integration/hypergraphql

private Set<String> findRootIdentifiers(Model model, TypeConfig targetName) {
  Set<String> identifiers = new HashSet<>();
  Model currentmodel = ModelFactory.createDefaultModel();
  Resource res = currentmodel.createResource(targetName.getId());
  Property property = currentmodel.createProperty(RDF_TYPE);
  ResIterator iterator = model.listResourcesWithProperty(property, res);
  while (iterator.hasNext()) {
    identifiers.add(iterator.nextResource().toString());
  }
  return identifiers;
}

代码示例来源:origin: semantic-integration/hypergraphql

private Set<String> findRootIdentifiers(Model model, TypeConfig targetName) {
  Set<String> identifiers = new HashSet<>();
  Model currentmodel = ModelFactory.createDefaultModel();
  Resource res = currentmodel.createResource(targetName.getId());
  Property property = currentmodel.createProperty(RDF_TYPE);
  ResIterator iterator = model.listResourcesWithProperty(property, res);
  while (iterator.hasNext()) {
    identifiers.add(iterator.nextResource().toString());
  }
  return identifiers;
}

代码示例来源:origin: at.researchstudio.sat/won-matcher-service

/**
 * Get the won node URI from a {@link Dataset}
 *
 * @param ds Dataset which holds won node information
 * @return
 */
private String getWonNodeUriFromDataset(Dataset ds) {
 if (ds.listNames().hasNext()) {
  Model model = ds.getNamedModel(ds.listNames().next());
  if (model.listSubjectsWithProperty(WON.HAS_URI_PATTERN_SPECIFICATION).hasNext()) {
   return model.listSubjectsWithProperty(WON.HAS_URI_PATTERN_SPECIFICATION).nextResource().toString();
  }
 }
 return null;
}

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

/**
 * Return a list of all test names defined in the manifest for this test harness.
 */
public List<String> listTests() {
  List<String> testList = new ArrayList<>();
  ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, testClass);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  return testList;
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Return a list of all test names defined in the manifest for this test harness.
 */
public List<String> listTests() {
  List<String> testList = new ArrayList<>();
  ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, testClass);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  return testList;
}

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

/**
 * Return a list of all test names defined in the manifest for this test harness.
 */
public List<String> listTests() {
  List<String> testList = new ArrayList<>();
  ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, PositiveEntailmentTest);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  tests = testManifest.listResourcesWithProperty(RDF.type, NegativeEntailmentTest);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  return testList;
}

代码示例来源:origin: org.apache.jena/jena-core

/**
 * Return a list of all test names defined in the manifest for this test harness.
 */
public List<String> listTests() {
  List<String> testList = new ArrayList<>();
  ResIterator tests = testManifest.listResourcesWithProperty(RDF.type, PositiveEntailmentTest);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  tests = testManifest.listResourcesWithProperty(RDF.type, NegativeEntailmentTest);
  while (tests.hasNext()) {
    testList.add(tests.next().toString());
  }
  return testList;
}

代码示例来源:origin: ORCID/ORCID-Source

private Individual getCountry(String countryCode) {
  ResIterator hasCountryCode = getCountries().listSubjectsWithProperty(Geonames.countryCode, countryCode);
  if (hasCountryCode.hasNext()) {
    return getCountries().getIndividual(hasCountryCode.next().getURI());
  }
  return null;
}

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

/**
   * Report of functor literals leaking out of inference graphs and raising CCE
   * in iterators.
   */
  public void testFunctorCCE() {
    Model base = ModelFactory.createDefaultModel();
    base.read("file:testing/reasoners/bugs/cceTest.owl");
    InfModel test = ModelFactory.createInfModel(ReasonerRegistry.getOWLReasoner(), base);

//        boolean b =
      anyInstancesOfNothing(test);
    ResIterator rIter = test.listSubjects();
    while (rIter.hasNext()) {
//            Resource res =
        rIter.nextResource();
    }
  }

相关文章