• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ResourceImpl类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: inferSubClasses

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
@Override
public void inferSubClasses(String classURI, ClassSet hierarchy, ClassNodeFactory<? extends ClassNode> factory) {
    Resource classResource = new ResourceImpl(classURI);
    Set<String> alreadySeenUris = new HashSet<String>();
    addOrUpdateUri(classResource, hierarchy, factory, alreadySeenUris);

    if (!classModel.containsResource(classResource)) {
        return;
    }

    StmtIterator iterator = classModel.listStatements(null, RDFS.subClassOf, classResource);
    Statement stmt;
    Resource resource;
    while (iterator.hasNext()) {
        stmt = iterator.next();
        resource = stmt.getSubject();
        if (!alreadySeenUris.contains(resource.getURI())) {
            addOrUpdateUri(resource, hierarchy, factory, alreadySeenUris);
        }
    }
}
 
开发者ID:dice-group,项目名称:gerbil,代码行数:22,代码来源:SimpleSubClassInferencer.java


示例2: setBlockRules

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
Resource[] setBlockRules(Object o) {
	Resource rslt[] = blockedRules;
	unblockAll();
	if (o instanceof Resource[]) {
		blockedRules = (Resource[]) o;
	} else {
		StringTokenizer tkn = new StringTokenizer((String) o, ", ");
		Vector<Resource> v = new Vector<Resource>();
		while (tkn.hasMoreElements()) {
			String frag = tkn.nextToken();
			//  System.err.println("Blocking " + frag);
			if (frag.equals("daml:collection"))
				v.add(DAML_OIL.collection);
			else
				v.add(new ResourceImpl(RDFSyntax.getURI() + frag));
		}

		blockedRules = new Resource[v.size()];
		v.copyInto(blockedRules);
	}
	for (int i = 0; i < blockedRules.length; i++)
		blockRule(blockedRules[i]);
	return rslt;
}
 
开发者ID:jacekkopecky,项目名称:parkjam,代码行数:25,代码来源:BaseXMLWriter.java


示例3: createResultSet

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
/**
 * @return
 */
private ResultSet createResultSet() {
	final Model model = ModelFactory.createDefaultModel();
	model.add(new ResourceImpl(SUBJECT), ResourceFactory.createProperty(PREDICATE), new ResourceImpl(OBJECT));

	final QueryExecution execution = QueryExecutionFactory.create(QueryFactory.create(QUERY), model);
	final ResultSet resultSet = execution.execSelect();

	return resultSet;
}
 
开发者ID:opendatahacklab,项目名称:semanticoctopus,代码行数:13,代码来源:ResultSetFormatterProviderTest.java


示例4: fakeMapping

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
private List<StatementsPair> fakeMapping(){
	Resource subjectPattern = new ResourceImpl();
	Property predPattern = new PropertyImpl("http://www.recshop.fake/cd#year");
	RDFNode objectPattern = new ResourceImpl();
	StatementPattern pattern = new StatementPattern(subjectPattern, predPattern, objectPattern,
									true,false,true);
	
	Resource subject = new ResourceImpl();
	Property pred = new PropertyImpl("http://www.recshop.fake/new#year");
	RDFNode object = new ResourceImpl();
	StatementPattern replacement = new StatementPattern(subject, pred, object,
									true,false,true);
	
	return asList( new StatementsPair(pattern, replacement) );
}
 
开发者ID:thermz,项目名称:OntoMapper,代码行数:16,代码来源:TestOntologyMapper.java


示例5: MappingRDFToESServer

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
/**
    * Mapping the properties of RDF meta model to Elasticsearch Server
    * @param  
    * @return 
    */	
public void MappingRDFToESServer() throws IOException, InterruptedException{		
       String indexName = INDEX_NAME;
       String documentType = DOCUMENT_TYPE;
       
       //check if index is exist for a new clean index
       IndicesExistsResponse resource = transportClient.admin().indices().prepareExists(indexName).execute().actionGet();        
       if (resource.isExists()) {
           DeleteIndexRequestBuilder deleteIndex = transportClient.admin().indices().prepareDelete(indexName);
           deleteIndex.execute().actionGet();
           LOGGER.info("Index already exists, creating new clean index...");
       }
       CreateIndexRequestBuilder createIndexRequestBuilder = transportClient.admin().indices().prepareCreate(indexName);
       
	// construct mapping
       XContentBuilder builder = jsonBuilder()
       		.startObject()
       			.startObject(documentType)
       				.startObject("_meta")
        				.field("Title", "string")
        				.field("URI", "uri")
        				.field("Description", "string")
       				.endObject()
       			.endObject()
               .endObject();        
       createIndexRequestBuilder.addMapping(documentType, builder);
       createIndexRequestBuilder.execute().actionGet();
       		                     
       ResIterator listResources = rdfMetaDataModel.listSubjects();
       long documentID = 0;
       while (listResources.hasNext())
       {
   		String uri = listResources.next().toString();
   		String titel = rdfMetaDataModel.listStatements(new ResourceImpl(uri), RDFS.label, (RDFNode) null)
   				.next().getObject().toString();
   		String description = rdfMetaDataModel.listStatements(new ResourceImpl(uri), RDFS.comment, (RDFNode) null)
   				.next().getObject().toString();
   		
        documentID++;
        // Add documents
        IndexRequestBuilder indexRequestBuilder = transportClient.prepareIndex(indexName, documentType, "" + documentID);
        // build json object
        final XContentBuilder contentBuilder = jsonBuilder().startObject().prettyPrint();
   		
        contentBuilder.field("Title", titel)
 			  			  .field("URI", uri)
 			  			  .field("Description", description);
        indexRequestBuilder.setSource(contentBuilder);
        indexRequestBuilder.execute().actionGet();
       }
	LOGGER.info( "RDF metadatamodel has been successfully mapped to elasticserach server.");        
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:57,代码来源:ESEngine.java


示例6: run

import com.hp.hpl.jena.rdf.model.impl.ResourceImpl; //导入依赖的package包/类
/**
 * Execute search
 * @param inputText
 * @return
 * @throws InterruptedException 
 * @throws IOException 
 */
public List<SearchResult> run(String inputText) throws IOException, InterruptedException {
	TopDoubleObjectCollection<String> mostSimilarDatasets = elasticsearchEngine
			.searchKeyWords(elasticsearchEngine.getTransportClient(),
							elasticsearchEngine.getIndexName(), 
							elasticsearchEngine.getType(),
							inputText);
	
	// initialize
	List<SearchResult> searchResults  = new ArrayList<SearchResult>();
	Model metaDataModel = topicmodelEngine.getRDFMetaModel();
	
	// set result
       for (int i=mostSimilarDatasets.values.length - 1; i>=0; i--) {
		Statement s;
		String uri = (String)mostSimilarDatasets.objects[i];
		String titel = "";
		String description = "";
		double similary = mostSimilarDatasets.values[i];
		if (metaDataModel.containsResource(new ResourceImpl(uri))) {
			s = metaDataModel.listStatements(new ResourceImpl(uri), RDFS.label, (RDFNode) null).next();
			titel += s.getObject().toString();
			s = metaDataModel.listStatements(new ResourceImpl(uri), RDFS.comment, (RDFNode) null).next();
			description += s.getObject().toString();
		}

		if (titel.equals("")) {
			titel = (String) mostSimilarDatasets.objects[i];
		}

		if (description.equals("")) {
			description = "No description.";
		}

		// create datasets
		searchResults.add(new SearchResult(new Dataset(titel, uri, description), similary));
	}

	// transmit to bean
	return searchResults;
}
 
开发者ID:dice-group,项目名称:Tapioca,代码行数:48,代码来源:SearchEngineBean.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ICommonsSet类代码示例发布时间:2022-05-23
下一篇:
Java XmlAttributeWriter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap