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


Java Statement.getPredicate方法代码示例

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


在下文中一共展示了Statement.getPredicate方法的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: showThisStatement

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public boolean showThisStatement(Statement statement) {
    Property predicate = statement.getPredicate();
    if (predicate.equals(RDF.type) || predicate.equals(DC.date) || predicate.equals(RDFS.label)
            || predicate.equals(RDFS.comment) || predicate.equals(MindRaiderVocabulary.isDiscarded)
            || predicate.equals(MindRaiderVocabulary.xlinkHref)
            || predicate.equals(MindRaiderVocabulary.flagProperty)) {
        return false;
    }

    // do not show trash content
    String uri = statement.getSubject().getURI();
    if (uri != null && uri.endsWith(NoteCustodian.NOTEBOOK_TRASH_LOCAL_NAME)) {
        return false;
    }

    return true;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:18,代码来源:BriefFacet.java

示例3: 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

示例4: mergeResources

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public static void mergeResources(Resource src, Resource trg)
{
	Property sameAs = src.getModel().getProperty(URI_SAMEAS);

	StmtIterator iter = src.listProperties();
	while ( iter.hasNext() )
	{
		Statement stmt = iter.nextStatement();

		Property p = stmt.getPredicate();
		if ( p.equals(sameAs) ) { continue; }

		trg.addProperty(p, stmt.getObject());
		iter.remove();
	}
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:17,代码来源:VocsUtils.java

示例5: 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

示例6: showThisStatement

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public boolean showThisStatement(Statement statement) {
    Property predicate = statement.getPredicate();
    if (predicate.equals(RDF.type) || predicate.equals(MindRaiderVocabulary.isDiscarded)
            || predicate.equals(MindRaiderVocabulary.flagProperty)) {
        return false;
    }
    // do not show trash content
    if (statement.getSubject().getURI().endsWith(NoteCustodian.NOTEBOOK_TRASH_LOCAL_NAME)) {
        return false;
    }

    return true;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:14,代码来源:NormalFacet.java

示例7: showThisStatement

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public boolean showThisStatement(Statement statement) {
    if (briefFacet.showThisStatement(statement)) {
        Property predicate = statement.getPredicate();
        if (!predicate.equals(MindRaiderVocabulary.attachment)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:11,代码来源:NoAttachmentsFacet.java

示例8: createGraph

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public UndirectedGraph<String, DefaultEdge> createGraph() {
	Model model = ModelFactory.createDefaultModel();
	model.read("/home/zwicklbauer/HDTGeneration/skos_categories_en.nt");
	StmtIterator it = model.listStatements();
	UndirectedGraph<String, DefaultEdge> graph = new MiGrafo();
	Set<String> set = new HashSet<String>();

	int counter = 0;
	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()) {
			set.add(r.getURI());
			Resource target = n.asResource();
			set.add(target.getURI());
			if (!graph.containsVertex(r.getURI())) {
				graph.addVertex(r.getURI());
			}
			if (!graph.containsVertex(target.getURI())) {
				graph.addVertex(target.getURI());
			}
			graph.addEdge(r.getURI(), target.getURI());
			if (counter % 10000 == 0) {
				System.out.println(counter);
			}
			counter++;
		}
	}
	return graph;
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:35,代码来源:Sampling.java

示例9: addCategoriesToGraph

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void addCategoriesToGraph() {
	Model m = ModelFactory.createDefaultModel();
	m.read(ARTICLECATEGORIES);
	StmtIterator it = m.listStatements();
	int counter = 0;
	while (it.hasNext()) {
		if (counter % 10000 == 0) {
			System.out.println(counter);
		}
		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());
				}
			}
		}
	}
	counter++;
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:29,代码来源:CreateRandomDBpediaModel.java

示例10: fillRelationsIndex

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public void fillRelationsIndex() {
	Model m = ModelFactory.createDefaultModel();

	m.read(MAPPINGPROPERTIES);

	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 (!relationmap.containsKey(subject.getURI())) {
					LinkedList<String> list = new LinkedList<String>();
					relationmap.put(subject.getURI(), list);
				}
				LinkedList<String> l = relationmap.get(subject.getURI());
				l.add(pra.getURI().replaceAll(
						"http://dbpedia.org/ontology/", "dbpediaOnt/")
						+ ":::"
						+ obj.getURI().replaceAll(
								"http://dbpedia.org/resource/",
								"dbpediaRes/"));

			}
		}
	}
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:34,代码来源:CreateDBPediaIndex.java

示例11: fillPropertiesIndex

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public void fillPropertiesIndex() {
	Model m = ModelFactory.createDefaultModel();

	m.read(INFOBOXPROPERTIES);

	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 (!relationmap.containsKey(subject.getURI())) {
					LinkedList<String> list = new LinkedList<String>();
					relationmap.put(subject.getURI(), list);
				}
				LinkedList<String> l = relationmap.get(subject.getURI());
				l.add(pra.getURI().replaceAll("http://dbpedia.org/property/", "dbpediaOnt/") + ":::"
						+ obj.getURI().replaceAll("http://dbpedia.org/resource/", "dbpediaRes/"));

			}
		}
	}
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:28,代码来源:CreateDBpediaIndexV2.java

示例12: fillRelationsIndex

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public void fillRelationsIndex() {
	Model m = ModelFactory.createDefaultModel();

	m.read(MAPPINGPROPERTIES);

	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 (!relationmap.containsKey(subject.getURI())) {
					LinkedList<String> list = new LinkedList<String>();
					relationmap.put(subject.getURI(), list);
				}
				LinkedList<String> l = relationmap.get(subject.getURI());
				l.add(pra.getURI().replaceAll("http://dbpedia.org/ontology/", "dbpediaOnt/") + ":::"
						+ obj.getURI().replaceAll("http://dbpedia.org/resource/", "dbpediaRes/"));

			}
		}
	}
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:28,代码来源:CreateDBpediaIndexV2.java

示例13: doConversion

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void doConversion(Model model) throws JenaException {
  StatementHandler totm = new ToTMStatementHandler();
  AResourceWrapper subjw = new AResourceWrapper();
  AResourceWrapper propw = new AResourceWrapper();
  AResourceWrapper objtw = new AResourceWrapper();
  ALiteralWrapper litlw = new ALiteralWrapper();

  ResIterator it = model.listSubjects();
  while (it.hasNext()) {
    Resource subject = (Resource) it.next();

    StmtIterator it2 = subject.listProperties(); // get all statements
    while (it2.hasNext()) {
      Statement stmt = (Statement) it2.next();

      subjw.resource = stmt.getSubject();
      propw.resource = stmt.getPredicate();

      RDFNode obj = stmt.getObject();
      if (obj instanceof Resource) {
        objtw.resource = (Resource) obj;
        totm.statement(subjw, propw, objtw);
      } else {
        litlw.literal = (Literal) obj;
        totm.statement(subjw, propw, litlw);
      }
    }
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:30,代码来源:RDFToTopicMapConverter.java

示例14: copyFromTdb

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void copyFromTdb( Dataset dataset ) throws RepositoryException {
	ValueFactory vf = rc.getValueFactory();

	if ( dataset.supportsTransactions() ) {
		dataset.begin( ReadWrite.READ );
	}

	// Get model inside the transaction
	Model model = dataset.getDefaultModel();
	StmtIterator si = model.listStatements();

	try {
		rc.begin();
		while ( si.hasNext() ) {
			Statement stmt = si.next();
			com.hp.hpl.jena.rdf.model.Resource rsr = stmt.getSubject();
			Property pred = stmt.getPredicate();
			RDFNode val = stmt.getObject();
			Node valnode = val.asNode();
			
			Resource sub;
			try {
				sub = ( rsr.isAnon()
						? vf.createBNode( valnode.getBlankNodeLabel() )
						: vf.createURI( rsr.toString() ) );
			}
			catch ( UnsupportedOperationException uoo ) {
				log.warn( uoo, uoo );
				continue;
			}
			
			URI pred2 = vf.createURI( pred.toString() );
			Value val2;

			if ( val.isLiteral() ) {
				Literal lit = val.asLiteral();
				String dtstr = lit.getDatatypeURI();
				URI dt = ( null == dtstr ? null : vf.createURI( dtstr ) );
				String langstr = lit.getLanguage();

				if ( null == dt ) {
					if ( langstr.isEmpty() ) {
						val2 = vf.createLiteral( lit.toString() );
					}
					else {
						val2 = vf.createLiteral( lit.toString(), langstr );
					}
				}
				else {
					val2 = vf.createLiteral( lit.toString(), dt );
				}
			}
			else {
				if ( val.isAnon() ) {
					val2 = vf.createBNode( valnode.getBlankNodeLabel() );
				}
				else {
					val2 = vf.createURI( val.toString() );
				}
			}
			rc.add( sub, pred2, val2 );
		}
		rc.commit();
	}
	catch ( RepositoryException re ) {
		rc.rollback();
		throw re;
	}
	finally {
		if ( dataset.supportsTransactions() ) {
			dataset.end();
		}
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:75,代码来源:JenaEngine.java

示例15: isType

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private boolean isType(Statement stmt, Resource type)
{
    Property predicate = stmt.getPredicate();
    return ((predicate.getURI().equals(RDF_TYPE)) && (type.equals(stmt.getObject())));
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:6,代码来源:EDMXMLWriter.java


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