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

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

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

Model.listSubjectsWithProperty介绍

[英]An alias for listResourcesWithProperty(Property), retained for backward compatibility. It may be deprecated in later releases.
[中]listResourcesWithProperty(Property)的别名,保留用于向后兼容。它可能在以后的版本中被弃用。

代码示例

代码示例来源:origin: vivo-project/Vitro

@Override
public ResIterator listSubjectsWithProperty(Property p, String o) {
  return inner.listSubjectsWithProperty(p, o);
}

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

public static List<Resource> listResourcesByType(Model model, Resource type) {
  return Iter.toList(model.listSubjectsWithProperty(RDF.type, type)) ;
}

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

private void addShapesAsSubjectsOf(Model model, ImmutableSet.Builder<Resource> shapes) {
  shapesAsSubjectsOf.forEach(r -> model.listSubjectsWithProperty(r).toSet().stream()
      .filter(RDFNode::isResource)
      .map(RDFNode::asResource)
      .forEach(shapes::add));
}

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

private void addShapesAsSubjectsOf(Model model, ImmutableSet.Builder<Resource> shapes) {
  shapesAsSubjectsOf.forEach(r -> model.listSubjectsWithProperty(r).toSet().stream()
      .filter(RDFNode::isResource)
      .map(RDFNode::asResource)
      .forEach(shapes::add));
}

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

private static String guessNamespace(Model temp) {
  List<Resource> res = temp.listSubjectsWithProperty(RDF.type, OWL.Ontology).toList();
  Map<String, Integer> tempMap = new HashMap<String, Integer>();
  for (Resource r : res) {
    String ns = r.getNameSpace();
    tempMap.put(ns, (tempMap.containsKey(ns)) ? (tempMap.get(ns) + 1) : 1);
  }
  
  if (tempMap.size() > 0)
    return (String) sortByValue(tempMap).keySet().toArray()[0];
  else
    return null;
}

代码示例来源:origin: org.aksw.sparqlify/obda-api-r2rml

public Collection<ViewDefinition> read(Model model) {
  List<TriplesMap> triplesMaps = model.listSubjectsWithProperty(RR.logicalTable).mapWith(r -> r.as(TriplesMap.class)).toList();

  List<ViewDefinition> result = triplesMaps.stream()
      .map(tm -> read(tm))
      .collect(Collectors.toList());

  return result;
}

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

public Collection<ViewDefinition> read(Model model) {
  List<TriplesMap> triplesMaps = model.listSubjectsWithProperty(RR.logicalTable).mapWith(r -> r.as(TriplesMap.class)).toList();

  List<ViewDefinition> result = triplesMaps.stream()
      .map(tm -> read(tm))
      .collect(Collectors.toList());

  return result;
}

代码示例来源: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: semantic-integration/hypergraphql

List<RDFNode> getSubjectsOfObjectProperty(String predicateURI, String objectURI) {
  ResIterator iterator = this.model.listSubjectsWithProperty(getPropertyFromUri(predicateURI), getResourceFromUri(objectURI));
  List<RDFNode> nodeList = new ArrayList<>();
  iterator.forEachRemaining(nodeList::add);
  return nodeList;
}

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

List<RDFNode> getSubjectsOfObjectProperty(String predicateURI, String objectURI) {
  ResIterator iterator = this.model.listSubjectsWithProperty(getPropertyFromUri(predicateURI), getResourceFromUri(objectURI));
  List<RDFNode> nodeList = new ArrayList<>();
  iterator.forEachRemaining(nodeList::add);
  return nodeList;
}

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

public static List<Resource> loadTestSuitesSqcf(String baseFile) {
  Model testSuitesModel = RDFDataMgr.loadModel(baseFile, Lang.TURTLE);
  normalizeSqcfModel(testSuitesModel);
  List<Resource> result = testSuitesModel.listSubjectsWithProperty(SparqlQcVocab.hasTest).toList();
  //enrichTestCasesWithLabels(testSuitesModel);
  return result;
}

代码示例来源:origin: org.aksw.jena-sparql-api/jena-sparql-api-resources-sparqlqc

public static List<Resource> loadTestSuitesSqcf(String baseFile) {
  Model testSuitesModel = RDFDataMgr.loadModel(baseFile, Lang.TURTLE);
  normalizeSqcfModel(testSuitesModel);
  List<Resource> result = testSuitesModel.listSubjectsWithProperty(SparqlQcVocab.hasTest).toList();
  //enrichTestCasesWithLabels(testSuitesModel);
  return result;
}

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

public static boolean isCompatibleWith(Resource platform) {
  if(get().isCompatibleWithExactly(platform)) {
    return true;
  }
  // Warning: this does assume that no loops exist
  for(Resource include : platform.getModel().listSubjectsWithProperty(DASH.includedExecutionPlatform, platform).toList()) {
    if(isCompatibleWith(include)) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl

public static boolean isCompatibleWith(Resource platform) {
  if(get().isCompatibleWithExactly(platform)) {
    return true;
  }
  // Warning: this does assume that no loops exist
  for(Resource include : platform.getModel().listSubjectsWithProperty(DASH.includedExecutionPlatform, platform).toList()) {
    if(isCompatibleWith(include)) {
      return true;
    }
  }
  return false;
}

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

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

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

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

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

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

相关文章

Model类方法