当前位置: 首页>>代码示例>>Java>>正文


Java ResIterator类代码示例

本文整理汇总了Java中com.hp.hpl.jena.rdf.model.ResIterator的典型用法代码示例。如果您正苦于以下问题:Java ResIterator类的具体用法?Java ResIterator怎么用?Java ResIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ResIterator类属于com.hp.hpl.jena.rdf.model包,在下文中一共展示了ResIterator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRowToMODEL

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
private void addRowToMODEL(List<Statement> sa, String key, String puri) {
	for (Statement s : sa) {
		if (MODEL.contains(s)) {
			continue;
		}
		// add to existing resource with same key if exists
		if (s.getPredicate().getLocalName().equals(key)) {
			ResIterator it	=	MODEL.listResourcesWithProperty(s.getPredicate(), s.getObject());
			if (it.hasNext()) { // assume all members are equal
				Resource rsc	= it.nextResource(); // get parent
				Property p	= ResourceFactory.createProperty(genOURI(), puri);
				Statement st	= ResourceFactory.createStatement(rsc, p, s.getSubject());

				MODEL.add(st);

				continue;
			}
		}

		MODEL.add(s);
	}
}
 
开发者ID:wxwilcke,项目名称:mdb2rdf,代码行数:23,代码来源:RdbToRdf.java

示例2: getChildren

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
/**
	 * Look up <code>uri</code> in the ontology and return a list of child
	 * concepts (URIs). Synonyms are not considered. The list contains no
	 * duplicates. Never returns <code>null</code>.
	 * 
	 * @param term
	 *            term to be looked up
	 * @return a list of child concepts URIs
	 */
	// TODO add all synonyms of the children to the result
	public List<String> getChildren(String uri) {
		Resource resource = model.getResource(uri);
		if (resource == null)
			return Collections.emptyList();
		
		List<String> result = new ArrayList<String>();

		ResIterator child = model.listResourcesWithProperty(RDFS.subClassOf, resource);
		while(child.hasNext()) {
			Resource parent = child.nextResource();
//			if (!parent.hasLiteral(Jura.invisible, true)) {
				result.add(parent.getURI());
//			}
		}

		return result;
	}
 
开发者ID:ag-csw,项目名称:ExpertFinder,代码行数:28,代码来源:OntologyIndex.java

示例3: getClasses

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
protected Set<Resource> getClasses(Model readModel) {
    ResIterator iterator = readModel.listSubjectsWithProperty(RDF.type, RDFS.Class);
    Resource r;
    Set<Resource> classes = new HashSet<Resource>();
    while (iterator.hasNext()) {
        r = iterator.next();
        if (!r.isAnon()) {
            classes.add(r);
        }
    }
    iterator = readModel.listSubjectsWithProperty(RDF.type, OWL.Class);
    while (iterator.hasNext()) {
        r = iterator.next();
        if (!r.isAnon()) {
            classes.add(r);
        }
    }
    return classes;
}
 
开发者ID:dice-group,项目名称:Cetus,代码行数:20,代码来源:DolceClassHierarchyLoader.java

示例4: analyse

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
    if ( dst == null ) { dst = getDestination(src); }

    Model m = loadModel(src);
    Property type = m.getProperty(RDF_TYPE);
    Resource pcho = m.getResource(EDM_PROVIDEDCHO);

    ObjectStat stat  = new ObjectStat("Europeana", true, false, true);

    stat.addPropertyValue(new LinkSetPropertyStat(m));
    ResIterator iter = m.listSubjectsWithProperty(type, pcho);
    stat.addPropertyValues(m, iter, false);

    super.analyse(m.listSubjectsWithProperty(type, pcho), dst, stat);

    return stat;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:19,代码来源:EDMAnalysis.java

示例5: fetchLabels

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
private void fetchLabels(Model m)
{
    Map<String,String> map = new HashMap();
    Property           p   = m.getProperty(SKOS_PREF_LABEL);

    ResIterator rIter = m.listResourcesWithProperty(m.getProperty(RDF_TYPE));
    while ( rIter.hasNext() )
    {
        Resource r = rIter.next();
        fetchAlternatives(map, r);

        StmtIterator sIter = r.listProperties(p);
        while ( sIter.hasNext() )
        {
            Statement stmt = sIter.next();
            put(stmt.getSubject(), getKey(stmt.getString(), map));
        }

        map.clear();
    }
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:22,代码来源:AmbiguityFetch.java

示例6: fixSubjects

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
private Model fixSubjects(Model m)
{
	Collection<String> sa = new HashSet();

	ResIterator iter = m.listSubjects();
	while ( iter.hasNext() )
	{
		String uri = iter.next().getURI();
		if ( PATTERN_WIKIDATA.matcher(uri).matches() ) { sa.add(uri); }
	}

	for ( String s : sa )
	{
		String sNew = getNew(s);
		if ( sNew == null ) { continue; }

		ResourceUtils.renameResource(m.getResource(s), sNew);
	}

	return m;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:22,代码来源:WikidataAnalysis.java

示例7: analyse

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
	Collection<String> c = loadDataURLs(srcList, PATTERN_LEXVO);

	Model m = ModelFactory.createDefaultModel();
	loadModel(m, src, null);

	ObjectStat  stat = new ObjectStat("Lexvo", true, false, true);
	stat.addPropertyValue(m.getProperty("http://www.w3.org/2008/05/skos-xl#literalForm"));

	ResIterator iter = m.listSubjects();
	while ( iter.hasNext() )
	{
		Resource r = iter.next();
		if ( !c.contains(r.getURI()) ) { continue; }
		stat.newObject(r);
	}

	if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }

	return stat;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:23,代码来源:LexvoAnalysis.java

示例8: analyse

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
	Collection<String> c = loadDataURLs(srcList, PATTERN_BABELNET);

	Model m = ModelFactory.createDefaultModel();
	loadModel(m, src, null);

	ObjectStat  stat = new ObjectStat("BabelNet", true, false, true);
	stat.addPropertyValue(m.getProperty("http://babelnet.org/model/babelnet#gloss"));

	ResIterator iter = m.listSubjects();
	while ( iter.hasNext() )
	{
		Resource r = iter.next();
		if ( !c.contains(r.getURI()) ) { continue; }
		stat.newObject(r);
	}

	if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }

	return stat;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:23,代码来源:BabelNetAnalysis.java

示例9: analyse

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
	Collection<String> c = loadDataURLs(srcList, PATTERN_FREEBASE);

	Model m = ModelFactory.createDefaultModel();
	loadModel(m, src, null);

	ObjectStat  stat = new ObjectStat("Freebase", true, false, true);
	stat.addPropertyValue(m.getProperty("http://www.w3.org/2000/01/rdf-schema#label"));

	ResIterator iter = m.listSubjects();
	while ( iter.hasNext() )
	{
		Resource r = iter.next();
		if ( !c.contains(r.getURI()) ) { continue; }
		stat.newObject(r);
	}

	if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }

	return stat;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:23,代码来源:FreebaseAnalysis.java

示例10: analyse

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public ObjectStat analyse(File srcList, File src, File dst) throws IOException
{
	Collection<String> c = loadDataURLs(srcList, PATTERN_EUROVOC);

	Model m = ModelFactory.createDefaultModel();
	loadModel(m, src, null);

	ObjectStat  stat = new ObjectStat("Eurovoc", true, false, true);
	stat.addPropertyValue(m.getProperty("http://www.w3.org/2004/02/skos/core#prefLabel"));
	stat.addPropertyValue(m.getProperty("http://www.w3.org/2004/02/skos/core#altLabel"));

	ResIterator iter = m.listSubjects();
	while ( iter.hasNext() )
	{
		Resource r = iter.next();
		if ( !c.contains(r.getURI()) ) { continue; }
		stat.newObject(r);
	}

	if ( dst != null ) { stat.print(new PrintStream(dst, "UTF-8")); }

	return stat;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:24,代码来源:EurovocAnalysis.java

示例11: main

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public static final void main(String[] args)
{
    PrintStream out = System.out;

    Model m = loadModel(FILE_AGENTS_DBPEDIA_SRC);

    Set<Resource> noLang   = new HashSet();
    Set<Resource> dupLbl   = new HashSet();
    Set<Resource> dupEnLbl = new HashSet();
    ResIterator iter = m.listSubjects();
    while ( iter.hasNext() ) { checkResource(iter.next(), noLang, dupEnLbl, dupLbl); }

    //print
    out.println("Resource with no language: " + noLang.size());
    //for ( Resource rsrc : noLang ) { out.println(rsrc.getURI()); }

    out.println("Resource with duplicate en labels: " + dupEnLbl.size());
    //for ( Resource rsrc : dupEnLbl ) { out.println(rsrc.getURI()); }

    out.println("Resource with duplicate labels in other langs: " + dupLbl.size());
    //for ( Resource rsrc : dupLbl ) { out.println(rsrc.getURI()); }
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:23,代码来源:RunCheckLabels.java

示例12: enrichImpl

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
private void enrichImpl(ResIterator iter, CSVWriter p)
{
    while (iter.hasNext())
    {
        Resource rsrc = iter.next();
        System.out.print("Enriching resource: " + rsrc.getURI());

        List<Map> l = _api.enrich(rsrc);
        if ( l == null ) { System.out.println(); continue; }

        int count = 0;
        for ( Map m : l )
        {
            count++;
            p.print(rsrc.getURI(), m.get("field")
                  , m.get("enrichment"), "", m.get("value"));
        }

        System.out.println(" [" + count + "]");
    }
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:22,代码来源:EuropeanaDatasetEnrich.java

示例13: readRequiredUris

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
/**
 * Read required URIs and save them in a set.
 */
protected void readRequiredUris() {
	// create new set of strings
	Set<String> uris = new HashSet<String>();

	// get all resources with property "VOID.clazz"
	ResIterator iterClasses = voidModel.listResourcesWithProperty(VOID.clazz);
	while (iterClasses.hasNext()) {
		String classUri = iterClasses.nextResource().getProperty(VOID.clazz).getObject().toString();
		uris.add(classUri);
	}

	// get all resources with property "VOID.property"
	ResIterator iterPorperties = voidModel.listResourcesWithProperty(VOID.property);
	while (iterPorperties.hasNext()) {
		String propertyUri = iterPorperties.nextResource().getProperty(VOID.property).getObject().toString();
		uris.add(propertyUri);
	}

	// save the URIs
	this.uris = uris;
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:25,代码来源:LabelExtractionHandler.java

示例14: getObjectsOfType

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
public static List<String> getObjectsOfType(Model model, String uri) {
    List<String> policies = new ArrayList();

    ResIterator it = model.listSubjectsWithProperty(RDF.type);
    while (it.hasNext()) {
        Resource res = it.next();
        Statement s = res.getProperty(RDF.type);
        String objeto = s.getObject().asResource().getURI();
        if (s.getObject().isURIResource()) {
            String sujeto = s.getSubject().getURI();
            String ouri = s.getObject().asResource().getURI();
            if (uri.equals(ouri)) {
                policies.add(sujeto);
            }
        }
    }
    return policies;
}
 
开发者ID:oeg-upm,项目名称:odrlapi,代码行数:19,代码来源:RDFUtils.java

示例15: generateSeqQualityProblem

import com.hp.hpl.jena.rdf.model.ResIterator; //导入依赖的package包/类
@Test
public void generateSeqQualityProblem(){
	qr = new QualityReport();
	
	String qualityProblemURI = qr.createQualityProblem(metricURI, resourceProblemList);
	Model qualityProblem = qr.getProblemReportFromTBD(qualityProblemURI);
	
	// checks if model contains appropriate data 
	assertEquals(6, qualityProblem.size());  
	
	assertTrue(qualityProblem.listStatements(null, RDF.type, QPRO.QualityProblem).hasNext());
	assertTrue(qualityProblem.listStatements(null, QPRO.isDescribedBy, metricURI).hasNext());
	
	assertEquals(1, qualityProblem.listObjectsOfProperty(QPRO.problematicThing).toList().size());
	
	ResIterator seqURI = qualityProblem.listSubjectsWithProperty(RDF.type, RDF.Seq);
	assertEquals(2,qualityProblem.getSeq(seqURI.next()).size());
	
	qr.flush();
}
 
开发者ID:EIS-Bonn,项目名称:Luzzu,代码行数:21,代码来源:QualityReportTest.java


注:本文中的com.hp.hpl.jena.rdf.model.ResIterator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。