當前位置: 首頁>>代碼示例>>Java>>正文


Java StmtIterator.next方法代碼示例

本文整理匯總了Java中com.hp.hpl.jena.rdf.model.StmtIterator.next方法的典型用法代碼示例。如果您正苦於以下問題:Java StmtIterator.next方法的具體用法?Java StmtIterator.next怎麽用?Java StmtIterator.next使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.hp.hpl.jena.rdf.model.StmtIterator的用法示例。


在下文中一共展示了StmtIterator.next方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initializeCategories

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public Set<String> initializeCategories() {
	Model model = ModelFactory.createDefaultModel();
	model.read("/home/zwicklbauer/HDTGeneration/skos_categories_en.nt");
	StmtIterator it = model.listStatements();
	Set<String> set = new HashSet<String>();
	
	System.out.println("Los gehts");
	while (it.hasNext()) {
		Statement s = it.next();
		Resource r = s.getSubject();
		Property p = s.getPredicate();
		RDFNode n = s.getObject();
		if (p.getURI().equalsIgnoreCase(
				"http://www.w3.org/2004/02/skos/core#broader")
				&& n.isResource()) {
			Resource target = n.asResource();
			if(!hasSubCategory(target.getURI())) 
			set.add(target.getURI());
			if(!hasSubCategory(r.getURI())) 
			set.add(r.getURI());
		}
	}
	return set;
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:25,代碼來源:DbpediaGraphModification.java

示例2: getRDFNodes

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public List<RDFNode> getRDFNodes(Resource r, Property p, NodeType acceptableNodes) {
	List<RDFNode> result = new ArrayList<RDFNode>();
	StmtIterator it = r.listProperties(p);
	while (it.hasNext()) {
		Statement stmt = it.next();
		remainingTriples.remove(stmt);
		if (acceptableNodes.isTypeOf(stmt.getObject())) {
			result.add(stmt.getObject());
		} else {
			if (acceptableNodes.coerce(stmt.getObject()) != null) {
				result.add(acceptableNodes.coerce(stmt.getObject()));
			}
			report.report(acceptableNodes.ifNot, r, p, stmt.getObject());
		}
	}
	Collections.sort(result, RDFComparator.getRDFNodeComparator());
	return result;
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:19,代碼來源:R2RMLReader.java

示例3: main

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public static final void main(String[] args) throws MalformedURLException, FileNotFoundException {
	Model model = ModelFactory.createDefaultModel();
	model.read(args[0]);
	StmtIterator iter = model.listStatements();
	System.out.println("Start");
	while (iter.hasNext()) {
		Statement stmt = iter.next();
		Resource subject = stmt.getSubject();
		String url[] = subject.getURI().split("/");
		String subjectIdent = url[url.length - 1];
		RDFNode object = stmt.getObject();
		String s[] = object.asResource().getURI().split("/");
		String objIdent = s[s.length - 1];
		try {
			System.out.println(objIdent+"    "+subjectIdent);
			HBaseOperations.getInstance().addRecord("DBPEDIA_CatToEnts", objIdent, "data", String.valueOf(subjectIdent.hashCode()), subjectIdent);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:22,代碼來源:S1CategoryToEntities.java

示例4: fetchLabels

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的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

示例5: sportsTeamsSurfaceForms

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public void sportsTeamsSurfaceForms() {
	Model m = ModelFactory.createDefaultModel();

	m.read(INSTANCEMAPPINGTYPES_NT);

	StmtIterator it = m.listStatements();

	while (it.hasNext()) {
		Statement s = it.next();
		Resource subject = s.getSubject();
		RDFNode object = s.getObject();

		if (object.isResource()) {
			Resource obj = object.asResource();
			if (obj.getURI().equalsIgnoreCase("http://dbpedia.org/ontology/SportsTeam")) {
				teams.add(subject.getURI());
			}
		}
	}
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:21,代碼來源:CreateDBpediaIndexV2.java

示例6: main

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public static void main(String[] args) {
	Model m = ModelFactory.createDefaultModel();
	m.read(args[0]);
	StmtIterator iter = m.listStatements();
	HashSet<String> hash = new HashSet<String>();
	while (iter.hasNext()) {
		Statement stmt = iter.next();
		RDFNode node = stmt.getObject();
		String uri = node.asResource().getURI();
		hash.add(uri);
	}
	File output = new File(args[1]);
	try {
		PrintWriter writer = new PrintWriter(output);
		for(String s : hash) {
			writer.println(s);
		}
		writer.close();
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
}
 
開發者ID:quhfus,項目名稱:DoSeR,代碼行數:23,代碼來源:ExtractRelevantDBpediaCategories.java

示例7: copyAllowedProperties

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
protected void copyAllowedProperties(Model readModel, Model model, Set<Resource> classes,
        Set<Property> allowedProperties) {
    StmtIterator stmtIterator = readModel.listStatements();
    Statement s;
    Literal label;
    while (stmtIterator.hasNext()) {
        s = stmtIterator.next();
        if (classes.contains(s.getSubject()) && allowedProperties.contains(s.getPredicate())
                && (!s.getObject().isAnon())) {
            if (s.getPredicate().equals(RDFS.label)) {
                label = s.getObject().asLiteral();
                if (label.getLanguage().equals("en")) {
                    model.add(s.getSubject(), RDFS.label,
                            model.createLiteral(label.getString().toLowerCase(), "en"));
                }
            } else {
                model.add(s);
            }
        }
    }
}
 
開發者ID:dice-group,項目名稱:Cetus,代碼行數:22,代碼來源:DolceClassHierarchyLoader.java

示例8: triplesInvolvingVocabulary

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public Model triplesInvolvingVocabulary(Model model) {
	Model result = ModelFactory.createDefaultModel();
	result.getNsPrefixMap().putAll(model.getNsPrefixMap());
	StmtIterator it = model.listStatements();
	while (it.hasNext()) {
		Statement stmt = it.next();
		if (properties.contains(stmt.getPredicate())
				|| (stmt.getPredicate().equals(RDF.type) && classes.contains(stmt.getObject()))) {
			result.add(stmt);
		}
	}
	return result;
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:14,代碼來源:VocabularySummarizer.java

示例9: checkForSpuriousTriples

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
private void checkForSpuriousTriples() {
	StmtIterator it = remainingTriples.listStatements();
	while (it.hasNext()) {
		Statement stmt = it.next();
		report.report(Problem.SPURIOUS_TRIPLE, stmt.getSubject(), stmt.getPredicate(), stmt.getObject());
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:8,代碼來源:R2RMLReader.java

示例10: testAsk

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
@Test
public void testAsk() {
	StmtIterator it = expectedTriples.listStatements();
	while (it.hasNext()) {
		Statement stmt = it.next();
		assertTrue("Missing statement: " + stmt, loader.getModelD2RQ().contains(stmt));
	}
}
 
開發者ID:d2rq,項目名稱:r2rml-kit,代碼行數:9,代碼來源:ProcessorTestBase.java

示例11: printIndividual

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
protected static String printIndividual(Individual individual) {
  StringBuilder stringBuilder = new StringBuilder();
  stringBuilder.append("Individual: " + individual.getLocalName() + "\n");
  StmtIterator properties = individual.listProperties();
  while (properties.hasNext()) {
    Statement s = properties.next();
    stringBuilder.append("  " + s.getPredicate().getLocalName() + " : " + s.getObject().toString() + "\n");
  }
  properties.close();
  stringBuilder.append("\n");
  stringBuilder.append(StringUtils.repeat("-", 70));
  return stringBuilder.toString();
}
 
開發者ID:mehmandarov,項目名稱:zebra-puzzle-workshop,代碼行數:14,代碼來源:Exercise.java

示例12: listRelatedStatements

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
private HashSet<Statement> listRelatedStatements(Resource r) {
	HashSet<Statement> statements = new HashSet<Statement>();
	StmtIterator st1 = model.listStatements(r, null, (RDFNode) null);
	StmtIterator st3 = model.listStatements(null, null, r);
	StmtIterator stmt = model.listStatements(null, model.getProperty(Namespace.LIST+"hasContents"), r);
	while (stmt.hasNext()) {
		Statement s = stmt.next();
		Resource list = s.getSubject();
		if (list.getProperty(model.getProperty(Namespace.LIST+"hasNext"))!=null) {
			statements.add(list.getProperty(model.getProperty(Namespace.LIST+"hasNext")));
			statements.add(list.getProperty(RDF.type));
			StmtIterator st = model.listStatements(null, model.getProperty(Namespace.LIST+"hasNext"), list);
			while (st.hasNext()) {
				statements.addAll(retrieveList(new HashSet<Statement>(),
						st.next()));
			}
		}

	}

	while (st1.hasNext()) {
		Statement statement=st1.next();
		statements.add(statement);
           if(statement.getObject() instanceof Resource){ 
               statements=removePrimaryTypes(statements,statement);
           	if (((Resource)statement.getObject()).getProperty(HASCONTENTS)!=null){
           	statements.addAll(retrieveList2(new HashSet<Statement>(),((Resource)statement.getObject()).getProperty(HASCONTENTS)));
           	}
           }
	}
	while (st3.hasNext()) {
		statements.add(st3.next());
	}
	return statements;
}
 
開發者ID:BenzclyZhang,項目名稱:BimSPARQL,代碼行數:36,代碼來源:GeometryTripleExtractor.java

示例13: main

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public static void main(String[] args) throws IOException, WktParseException{
		InputStream in=ConvexHullTest.class.getClassLoader().getResourceAsStream("lifeline_geometry.ttl");
		Model model=ModelFactory.createDefaultModel();
		model.read(in,null,"TTL");
		StmtIterator stmts=model.listStatements(null, GEOM.hasGeometry, (RDFNode)null);
		while(stmts.hasNext()){
			Statement stmt=stmts.next();
			System.out.print(stmt.getSubject().getLocalName()+ " : ");
			String ewkt=stmt.getObject().asResource().getProperty(GEOM.asBody).getObject().asLiteral().getString();
			EwktReader reader=new EwktReader(ewkt);
			Geometry geometry=reader.readGeometry();
			if (geometry.geometryTypeId()==GeometryType.TYPE_POLYHEDRALSURFACE){
			PolyhedralSurface ps=new ConvexHull().buildConvexHull((PolyhedralSurface)geometry);
			Polyhedron ph=new Polyhedron(ps);
			MVBB obb=new MVBB(ph);
			obb.computeMinBB();
			Box box=obb.getBox();
			System.out.println(box.getVolume()/1000000000);
			System.out.print(box.getOrientation().getN1());
			System.out.print(box.getOrientation().getN2());
			System.out.println(box.getOrientation().getN3());
//			System.out.println(box.getMin());
//			System.out.println(box.getMax());
		}
		}
		
	}
 
開發者ID:BenzclyZhang,項目名稱:BimSPARQL,代碼行數:28,代碼來源:OBBTest.java

示例14: buildMappings

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
private void buildMappings(Model model) throws MalformedURLException {
  mappings = new HashMap();
  Property mapsTo = model.createProperty(RTM_MAPSTO);
  StmtIterator it = model.listStatements(null, mapsTo, (RDFNode) null);
  while (it.hasNext()) {
    Statement stmt = (Statement) it.next();
    StatementHandler mapper = getMapper(stmt.getSubject(), stmt.getObject(), model);
    mappings.put(stmt.getSubject().getURI(), mapper);
  }
  it.close();
}
 
開發者ID:ontopia,項目名稱:ontopia,代碼行數:12,代碼來源:RDFToTopicMapConverter.java

示例15: getNumberOfIncomingLinks

import com.hp.hpl.jena.rdf.model.StmtIterator; //導入方法依賴的package包/類
public static int getNumberOfIncomingLinks(Resource resource) {
	 StmtIterator stmtIterator = resource.getModel().listStatements(null, null, resource);
	 int count = 0;
	 for (; stmtIterator.hasNext(); ++count) {
		 stmtIterator.next();
	 }
	 return count;
}
 
開發者ID:Web-of-Building-Data,項目名稱:Ifc2Rdf,代碼行數:9,代碼來源:RdfUtils.java


注:本文中的com.hp.hpl.jena.rdf.model.StmtIterator.next方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。