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

x33g5p2x  于2022-01-24 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(117)

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

Model.listResourcesWithProperty介绍

[英]Answer an iterator [with no duplicates] over all the resources in this model that have property p. remove() is not implemented on this iterator.
[中]回答一个迭代器[没有重复项],该迭代器覆盖此模型中所有属性为[$0$]的资源。remove()未在此迭代器上实现。

代码示例

代码示例来源:origin: AKSW/RDFUnit

public Set<Component> getComponentsFromModel(Model model) {
  ComponentReader cr = ComponentReader.create();
  // get all instances of SHACL.ConstraintComponent and return then as Component instances
  return model.listResourcesWithProperty(RDF.type, SHACL.ConstraintComponent)
      .toSet().stream()
      .distinct()
      .map(cr::read)
      .collect(Collectors.toSet());
}

代码示例来源:origin: org.aksw.rdfunit/rdfunit-model

public Set<Component> getComponentsFromModel(Model model) {
  ComponentReader cr = ComponentReader.create();
  // get all instances of SHACL.ConstraintComponent and return then as Component instances
  return model.listResourcesWithProperty(RDF.type, SHACL.ConstraintComponent)
      .toSet().stream()
      .distinct()
      .map(cr::read)
      .collect(Collectors.toSet());
}

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

/**
  Answer a Set of the objects in the full expansion of the assembler
  specification <code>model</code> which have rdf:type <code>type</code>,
  which <i>must</i> be a subtype of <code>ja:Object</code>.
*/
public static Set<Resource> findAssemblerRoots( Model model, Resource type )
  { return fullModel( model ).listResourcesWithProperty( RDF.type, type ).toSet(); }

代码示例来源:origin: AKSW/RDFUnit

public Collection<TestGenerator> getTestGeneratorsFromModel(Model model) {
  return getTestGeneratorsFromResourceList(
      model.listResourcesWithProperty(RDF.type, RDFUNITv.TestGenerator).toList()
  );
}

代码示例来源:origin: AKSW/RDFUnit

public Collection<Pattern> getPatternsFromModel(Model model) {
  return getPatternsFromResourceList(
      model.listResourcesWithProperty(RDF.type, RDFUNITv.Pattern).toList()
  );
}

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

/**
  Answer a Set of the objects in the full expansion of the assembler
  specification <code>model</code> which have rdf:type <code>type</code>,
  which <i>must</i> be a subtype of <code>ja:Object</code>.
*/
public static Set<Resource> findAssemblerRoots( Model model, Resource type )
  { return fullModel( model ).listResourcesWithProperty( RDF.type, type ).toSet(); }

代码示例来源:origin: org.aksw.rdfunit/rdfunit-model

public Collection<TestGenerator> getTestGeneratorsFromModel(Model model) {
  return getTestGeneratorsFromResourceList(
      model.listResourcesWithProperty(RDF.type, RDFUNITv.TestGenerator).toList()
  );
}

代码示例来源:origin: org.aksw.rdfunit/rdfunit-model

public Collection<Pattern> getPatternsFromModel(Model model) {
  return getPatternsFromResourceList(
      model.listResourcesWithProperty(RDF.type, RDFUNITv.Pattern).toList()
  );
}

代码示例来源:origin: SmartDataAnalytics/jena-sparql-api

public static List<Resource> loadTestSuites(Model testSuitesModel, String baseFile) throws IOException {
  List<Resource> result = testSuitesModel
      .listResourcesWithProperty(RDF.type, SparqlQcVocab.TestSuite).toList();
  for (Resource testSuite : result) {
    loadTestSuite(testSuite, baseFile);
  }
  enrichTestCasesWithLabels(testSuitesModel);
  return result;
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final RDFNode o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, o));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final double o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final long o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final char o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final float o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final Object o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

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

@Override
public SecuredResIterator listResourcesWithProperty(final Property p, final boolean o)
    throws ReadDeniedException, AuthenticationRequiredException {
  checkRead();
  ExtendedIterator<Resource> rIter = holder.getBaseItem().listResourcesWithProperty(p, o);
  if (!canRead(Triple.ANY)) {
    rIter = rIter.filterKeep(new ResourceFilter(p, ResourceFactory.createTypedLiteral(o)));
  }
  return new SecuredResIterator(holder.getSecuredItem(), rIter);
}

相关文章

Model类方法