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


Java Statement.getSubject方法代码示例

本文整理汇总了Java中com.hp.hpl.jena.rdf.model.Statement.getSubject方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.getSubject方法的具体用法?Java Statement.getSubject怎么用?Java Statement.getSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.hp.hpl.jena.rdf.model.Statement的用法示例。


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

示例1: initializeCategories

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的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: loadClassList

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
/**
 * @param path
 * @return
 */
public static HashMap<String, List<Resource>> loadClassList(String path) {
	HashMap<String, List<Resource>> res = new HashMap<>();
	// load specification file
	Model model = RDFDataMgr.loadModel(path);
	// get all graphs
	Iterator<Statement> statIt = model.listStatements((Resource) null, 
			ResourceFactory.createProperty("http://aksw.org/deduplication/relatedGraph"), (RDFNode) null);
	while(statIt.hasNext()) {
		Statement s = statIt.next();
		Resource dataset = s.getSubject();
		String graph = s.getObject().as(Resource.class).getURI();
		// get all classes for each graph
		ArrayList<Resource> classes = new ArrayList<>();
		Iterator<RDFNode> nodeIt = model.listObjectsOfProperty(dataset, ResourceFactory.createProperty("http://aksw.org/deduplication/requiredClasses"));
		while(nodeIt.hasNext()) {
			Resource c = nodeIt.next().as(Resource.class);
			classes.add(c);
		}
		res.put(graph, classes);
	}
	return res;
}
 
开发者ID:AKSW,项目名称:rocker,代码行数:27,代码来源:ModelManager.java

示例3: main

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的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: addSkosBroaderToGraph

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void addSkosBroaderToGraph() {
	Model m = ModelFactory.createDefaultModel();
	m.read(SKOSBROADER);
	StmtIterator it = m.listStatements();
	while (it.hasNext()) {
		Statement s = it.next();
		Resource subject = s.getSubject();
		Property pra = s.getPredicate();
		RDFNode object = s.getObject();
		if (object.isResource()) {
			Resource obj = object.asResource();
			if (pra.isResource()
					&& obj.getURI().startsWith(
							"http://dbpedia.org/resource/")) {
				if (!subject.getURI().equalsIgnoreCase(obj.getURI())) {
					graph.addVertex(subject.getURI());
					graph.addVertex(obj.getURI());
					graph.addEdge(subject.getURI(), obj.getURI());
				}
			}
		}
	}
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:24,代码来源:CreateRandomDBpediaModel.java

示例5: findUnlinkedDolceClasses

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
protected static Set<Resource> findUnlinkedDolceClasses(Model classesModel, Model dolceClassModel) {
    Set<Resource> unlinkedClasses = new HashSet<Resource>();
    StmtIterator stmtIterator = dolceClassModel.listStatements(null, RDF.type, RDFS.Class);
    Statement statement;
    Resource resource;
    while (stmtIterator.hasNext()) {
        statement = stmtIterator.next();
        resource = statement.getSubject();
        // If this class has no equivalent class and no sub classes
        if ((!classesModel.contains(resource, OWL.equivalentClass))
                && (!classesModel.contains(null, OWL.equivalentClass, resource))
                && (!classesModel.contains(null, RDFS.subClassOf, resource))) {
            unlinkedClasses.add(resource);
        }
    }
    // We are searching the higher classes on the complete model to make
    // sure, that higher DOLCE classes are only added to the list of
    // unlinked classes, if they do not have a YAGO sub class
    // FIXME If a DOLCE class has an equal YAGO class and both have no
    // children, the DOLCE class will be added to the list of unlinked
    // classes. (very unlikely, but possible)
    addHigherIncludedDolceClass(unlinkedClasses, classesModel, unlinkedClasses);

    return unlinkedClasses;
}
 
开发者ID:dice-group,项目名称:Cetus,代码行数:26,代码来源:YagoBasedTypeSearcher.java

示例6: parsePropertyBridges

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void parsePropertyBridges() {
	StmtIterator stmts = this.model.listStatements(null, D2RQ.belongsToClassMap, (RDFNode) null);
	while (stmts.hasNext()) {
		Statement stmt = stmts.nextStatement();
		ClassMap classMap = this.mapping.classMap(stmt.getResource());
		Resource r = stmt.getSubject();
		PropertyBridge bridge = new PropertyBridge(r);
		bridge.setBelongsToClassMap(classMap);
		parseResourceMap(bridge, r);
		parsePropertyBridge(bridge, r);
	}
}
 
开发者ID:d2rq,项目名称:r2rml-kit,代码行数:13,代码来源:D2RQReader.java

示例7: parsePropertyBridges

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void parsePropertyBridges() {
	StmtIterator stmts = this.model.listStatements(null, D2RQ.belongsToClassMap, (RDFNode) null);
	while (stmts.hasNext()) {
		Statement stmt = stmts.nextStatement();
		ClassMap classMap = this.mapping.classMap(stmt.getResource());
		Resource r = stmt.getSubject();
		PropertyBridge bridge = new PropertyBridge(r);
		bridge.setBelongsToClassMap(classMap);
		parseResourceMap(bridge, r);
		parsePropertyBridge(bridge, r);
		classMap.addPropertyBridge(bridge);
	}
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:14,代码来源:MapParser.java

示例8: dumpStatement

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
void dumpStatement(Statement stmt) {
	Resource  subject   = stmt.getSubject();
	Property  predicate = stmt.getPredicate();
	RDFNode   object    = stmt.getObject();
	System.out.print(subject + " " + predicate + " ");
	if (object instanceof Resource) {
		System.out.print(object);
	} else { // object is a literal
		System.out.print(" \"" + object + "\"");
	}
	System.out.println(" .");
}
 
开发者ID:aitoralmeida,项目名称:c4a_data_repository,代码行数:13,代码来源:ModelAPITest.java

示例9: retrieveList

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private List<Statement> retrieveList(List<Statement> statements,
		 Statement s) {
	statements.add(s);
	Resource list = s.getSubject();
	StmtIterator st = model.listStatements(null, RDF.rest, list);
	if (st.hasNext()) {
		statements = retrieveList(statements,st.next());
	}
	return statements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:11,代码来源:IfcSemanticExtractor.java

示例10: retrieveList2

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private List<Statement> retrieveList2(List<Statement> statements,Statement s){
	statements.add(s);
	Resource list=s.getSubject();
	Statement st = list.getProperty(RDF.rest);
	statements.add(st);
	if (st.getObject() instanceof Resource && ((Resource)st.getObject()).getProperty(RDF.first)!=null){
		statements=retrieveList2(statements,((Resource)st.getObject()).getProperty(RDF.first));
	}
	return statements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:11,代码来源:IfcSemanticExtractor.java

示例11: listRelatedStatements

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的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

示例12: retrieveList

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private HashSet<Statement> retrieveList(HashSet<Statement> statements,
		 Statement s) {
	statements=removePrimaryTypes(statements,s);
	statements.add(s);
	statements.add(s.getSubject().getProperty(RDF.type));
	Resource list = s.getSubject();
	StmtIterator st = model.listStatements(null, model.getProperty(Namespace.LIST+"hasNext"), list);
	if (st.hasNext()) {
		statements = retrieveList(statements,st.next());
	}
	return statements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:13,代码来源:GeometryTripleExtractor.java

示例13: retrieveList2

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private HashSet<Statement> retrieveList2(HashSet<Statement> statements,Statement s){
	statements.add(s);
	statements=removePrimaryTypes(statements,s);
	Resource list=s.getSubject();
	statements.add(list.getProperty(RDF.type));
	Statement st = list.getProperty(model.getProperty(Namespace.LIST+"hasNext"));
	if(st!=null){
	statements.add(st);
	if (st.getObject() instanceof Resource && ((Resource)st.getObject()).getProperty(model.getProperty(Namespace.LIST+"hasContents"))!=null){
		statements=retrieveList2(statements,((Resource)st.getObject()).getProperty(model.getProperty(Namespace.LIST+"hasContents")));
	}
	}
	return statements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:15,代码来源:GeometryTripleExtractor.java

示例14: addClassDefinitionTriple

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public void addClassDefinitionTriple(Statement statement) {
	RdfTopTree tree = new RdfTopTree(statement.getSubject());
	tree.put(statement, null);
	RdfMsg msg = new RdfMsg();
	msg.addTopTree(tree);
	addClassDefinitionTripleMsg(msg);
}
 
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:8,代码来源:RdfMsgContainer.java

示例15: addSingleTriple

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public void addSingleTriple(Statement statement) {
	RdfTopTree tree = new RdfTopTree(statement.getSubject());
	tree.put(statement, null);
	RdfMsg msg = new RdfMsg();
	msg.addTopTree(tree);
	addSingleTripleMsg(msg);
}
 
开发者ID:Web-of-Building-Data,项目名称:Ifc2Rdf,代码行数:8,代码来源:RdfMsgContainer.java


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