com.hp.hpl.jena.rdf.model.ResIterator.toList()方法的使用及代码示例

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

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

ResIterator.toList介绍

暂无

代码示例

代码示例来源:origin: de.unibonn.iai.eis/luzzu-annotations

/**
 * Returns the URI for a quality problem instance
 * 
 * @param problemReport - A Problem Report Model
 * 
 * @return The resource URI
 */
public List<Resource> getProblemURI(Model problemReport){
  return problemReport.listSubjectsWithProperty(RDF.type, QPRO.QualityProblem).toList();
}

代码示例来源:origin: de.unibonn.iai.eis/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: epimorphics/elda

/**
  Filter the model m according to the view-languages rules 
  of the LDA spec.
  
  <p>
  If the list of viewing languages contains some values, then
  the only untyped literal values of a property P for some subject 
  S that will kept are those with a language in the list or, if 
  there are none, those with no language. 
  </p>
*/
public static void filterByLanguages( Model m, String[] split) {
  Set<String> allowed = new HashSet<String>( Arrays.asList( split ) );
  if (allowed.contains( "none" )) allowed.add( "" );
  for (Resource sub: m.listSubjects().toList()) {
    for (Property prop: sub.listProperties().mapWith( Statement.Util.getPredicate ).toSet())
      removeUnwantedPropertyValues( allowed, sub, prop );
  }
}

代码示例来源:origin: usc-isi-i2/Web-Karma

RDFNode node = model.getResource(Uris.KM_R2RML_MAPPING_URI);
ResIterator res = model.listResourcesWithProperty(rdfTypeProp, node);
List<Resource> resList = res.toList();
for(Resource r: resList)

代码示例来源:origin: epimorphics/elda

/**
 * @return A list of all resources in the current results model which each
 *         have all of the given properties
 */
public List<DisplayRdfNode> resourcesWithAllProperties( List<Object> properties ) {
  List<DisplayRdfNode> rs = new ArrayList<DisplayRdfNode>();
  if (!properties.isEmpty()) {
    Property p = toProperty( properties.get( 0 ) );
    List<Resource> candidates = getModelW().getModel().listSubjectsWithProperty( p ).toList();
    // test the remaining properties
    for (Object p1 : properties) {
      List<Resource> checked = new ArrayList<Resource>();
      Property pp1 = toProperty( p1 );
      for (Resource cand : candidates) {
        if (cand.hasProperty( pp1 )) {
          checked.add( cand );
        }
      }
      candidates = checked;
    }
    for (Resource cand : candidates) {
      rs.add( new DisplayRdfNode( this, cand ) );
    }
  }
  return rs;
}

代码示例来源:origin: usc-isi-i2/Web-Karma

RDFNode node = model.createLiteral(id.getName());
ResIterator res = model.listResourcesWithProperty(sourceNameProp, node);
List<Resource> resList = res.toList();
    List<Resource> prevSourceSubjects = prevSourceSubjectsIter.toList();

代码示例来源:origin: usc-isi-i2/Web-Karma

List<Resource> resList = res.toList();
for(Resource r: resList)

代码示例来源:origin: epimorphics/elda

List<Resource> roots = init.listSubjectsWithProperty( RDF.type, API.API ).toList();

代码示例来源:origin: epimorphics/elda

public static MapLookup createMapLookup(Resource root, final Source ds) {
  final Map<String, SPARQLMapLookup.Element> maps = new HashMap<String, SPARQLMapLookup.Element>();
//		
  List<Resource> mapSpecs = root.getModel().listSubjectsWithProperty(RDF.type, ELDA_API.SPARQLMap).toList();
  for (Resource mapSpec: mapSpecs) {
    String mapName = mapSpec.isURIResource()
      ? mapSpec.getURI()
      : getResourceValue(mapSpec, ELDA_API.mapName).getURI()
      ; 
    String inName = getStringValue(mapSpec, ELDA_API.mapIn, "input");
    String outName = getStringValue(mapSpec, ELDA_API.mapOut, "result");	
    String queryString = getStringValue(mapSpec,ELDA_API.mapQuery);
    maps.put(mapName, new Element(inName, queryString, outName));
  }        
  return new SPARQLMapLookup(ds, maps);
}

代码示例来源:origin: epimorphics/elda

private void extractDatatypes( Model m ) {
  List<Resource> dataTypes = m.listStatements( null, RDF.type, RDFS.Datatype ).mapWith( Statement.Util.getSubject ).toList();
  for (Resource t: dataTypes) declareDatatype( t.getURI() );
  for (Resource p: m.listSubjectsWithProperty( RDF.type, OWL.DatatypeProperty ).toList()) {
    for (RDFNode t: m.listObjectsOfProperty( p, RDFS.range ).toList()) {
      declareDatatype( t.asResource().getURI() );
    }
  }
}

相关文章