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


Java Statement.getObject方法代码示例

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


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

示例3: main

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public static void main(String[] args) {
	HDT hdt = null;
	try {
		hdt = HDTManager.mapIndexedHDT(TYPES, null);
	} catch (IOException e) {
		e.printStackTrace();
	}
	
	HDTGraph graph = new HDTGraph(hdt);
	Model m = ModelFactory.createModelForGraph(graph);
	StmtIterator iter = m.listStatements();
	HashMap<String, Integer> hash = new HashMap<String, Integer>();
	int number = 0;
	while (iter.hasNext()) {
		if (number % 50000 == 0) {
			System.out.println("Processed Entries: " + number);
		}
		Statement stmt = iter.next();
		RDFNode object = stmt.getObject();
		String s = null;
		s = object.asResource().getURI();
		hash.put(s, 0);
		number++;
	}
	System.out.println("Anzahl an Typen: " +hash.size());
}
 
开发者ID:quhfus,项目名称:DoSeR,代码行数:27,代码来源:CountYago2sTypes.java

示例4: getSourceType

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private SourceTypes getSourceType(Resource mappingResource)
{
	Property sourceNameProp = model.getProperty(Uris.KM_SOURCE_TYPE_URI);
	Statement s = model.getProperty(mappingResource, sourceNameProp);
	String sourceType = null;
	if(s != null)
	{
		RDFNode node = s.getObject();
		if(node != null && node.isLiteral())
		{
			sourceType = node.asLiteral().getString();
			return SourceTypes.valueOf(sourceType);
		}
	}
	return SourceTypes.CSV;
	
	
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:19,代码来源:WorksheetR2RMLJenaModelParser.java

示例5: sportsTeamsSurfaceForms

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

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private static void parseN3(GrabMappingsHandler handler, String infileurl) {
  Model model = ModelFactory.createDefaultModel();
  model.read(infileurl, "N3");

  AResourceImpl sub = new AResourceImpl();
  AResourceImpl pred = new AResourceImpl();
  AResourceImpl objres = new AResourceImpl();
  ALiteralImpl objlit = new ALiteralImpl();
  StmtIterator it = model.listStatements();
  while (it.hasNext()) {
    Statement stmt = it.nextStatement();
    RDFNode object = stmt.getObject();
    sub.setResource(stmt.getSubject());
    pred.setResource(stmt.getPredicate());
    
    if (object instanceof Literal) {
      objlit.setLiteral((Literal) object);
      handler.statement(sub, pred, objlit);
    } else {
      objres.setResource((Resource) object);
      handler.statement(sub, pred, objres);
    }
  }
}
 
开发者ID:ontopia,项目名称:ontopia,代码行数:25,代码来源:RDFIntroSpector.java

示例8: writeStatement

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private void writeStatement(Statement stmt, PrintStream out)
{
    String             name  = getQName(stmt.getPredicate());
    Map<String,String> attrs = null;
    String             value = null;
    RDFNode node = stmt.getObject();
    if ( node.isLiteral() )
    {
        Literal l = node.asLiteral();
        value = l.getString();

        String lang = l.getLanguage();
        if ( !lang.isEmpty()  ) { attrs = Collections.singletonMap("xml:lang", lang); }

        String datatype = l.getDatatypeURI();
        if ( datatype != null ) { attrs = Collections.singletonMap("rdf:datatype", datatype); }
    }
    else {
        attrs = Collections.singletonMap("rdf:resource", getURI(node.asResource()));
    }
    writeProperty(name, attrs, value, out);
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:23,代码来源:EDMXMLWriter.java

示例9: getRequest

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private List getRequest(Resource pcho)
{
    List l = new ArrayList();
    StmtIterator iter = pcho.listProperties();
    while ( iter.hasNext() )
    {
        Statement stmt = iter.nextStatement();
        RDFNode   node = stmt.getObject();
        String    uri  = stmt.getPredicate().getURI();
        if ( node.isResource() || !_fields.containsKey(uri) ) { continue; }

        String    prop = getQName(stmt.getPredicate());
        String    value = node.asLiteral().getString();
        String[]  vocs  = _fields.get(uri);
        for ( String key : normalizeInternal(value) )
        {
            Map m = new HashMap(3);
            m.put("originalField", prop + ";" + value);
            m.put("value", key);
            m.put("vocabularies",  vocs);
            l.add(m);
        }
    }
    return l;
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:26,代码来源:EnrichmentAPI.java

示例10: fixLanguage

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
public static void fixLanguage(StmtIterator iter, String sLang)
{
	if ( (sLang == null) || sLang.trim().isEmpty() ) { return; }

	List<Statement> list = iter.toList();
	for ( Statement stmt : list )
	{
		RDFNode n = stmt.getObject();
		if ( !n.isLiteral() ) { continue; }

		Literal l = n.asLiteral();
		String sL = l.getLanguage();
		if ( (sL != null) && !sL.trim().isEmpty() ) { continue; }

		stmt.changeObject(l.getString(), sLang);
	}
}
 
开发者ID:hugomanguinhas,项目名称:europeana,代码行数:18,代码来源:VocsUtils.java

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

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

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

示例14: removePrimaryTypes

import com.hp.hpl.jena.rdf.model.Statement; //导入方法依赖的package包/类
private HashSet<Statement> removePrimaryTypes(HashSet<Statement> statements, Statement statement){
   	Resource object=(Resource)statement.getObject();
   	Statement s=object.getProperty(HASBOOLEAN);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
   	s=object.getProperty(HASSTRING);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
   	s=object.getProperty(HASDOUBLE);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
   	s=object.getProperty(HASLOGICAL);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
   	s=object.getProperty(HASINTEGER);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
   	s=object.getProperty(HASHEXBINARY);
   	if(s!=null){
   		statements.add(s);
   		statements.add(object.getProperty(RDF.type));
   	}
	return statements;
}
 
开发者ID:BenzclyZhang,项目名称:BimSPARQL,代码行数:35,代码来源:GeometryTripleExtractor.java

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


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