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


Java Reference类代码示例

本文整理汇总了Java中org.apache.felix.scr.annotations.Reference的典型用法代码示例。如果您正苦于以下问题:Java Reference类的具体用法?Java Reference怎么用?Java Reference使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Reference类属于org.apache.felix.scr.annotations包,在下文中一共展示了Reference类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getOntologyEntityContext

import org.apache.felix.scr.annotations.Reference; //导入依赖的package包/类
@Override
public Collection<Representation> getOntologyEntityContext(String entityID, String lang){
	
	Collection<Representation> transformedResults = new ArrayList<Representation>();
	Entity entity = siteManager.getEntity(entityID);
	if(entity != null){
		Representation representation = entity.getRepresentation();
		if(representation != null){
			Iterator<Object> it = representation.get("http://dati.gov.it/onto/ann-voc/usage");
			while(it.hasNext()){
				Object context = it.next();
				if(context instanceof org.apache.stanbol.entityhub.servicesapi.model.Reference){
					org.apache.stanbol.entityhub.servicesapi.model.Reference contextReference = 
							(org.apache.stanbol.entityhub.servicesapi.model.Reference) context;
					String reference = contextReference.getReference();
					
					Entity entityRef = siteManager.getEntity(reference);
					
			    	ValueFactory vf = InMemoryValueFactory.getInstance();
			    	
		    		Representation repr = entityRef.getRepresentation();
		    		Representation newRepresentation = vf.createRepresentation(repr.getId());
		    		
		    		addTextToRepresentation("http://www.w3.org/2000/01/rdf-schema#label", "label", repr, newRepresentation, lang, vf);
		    		addTextToRepresentation("http://www.w3.org/2000/01/rdf-schema#comment", "comment", representation, newRepresentation, lang, vf);
		    		addObjectToRepresentation("http://dati.gov.it/onto/ann-voc/dafLabel", "dafLabel", representation, newRepresentation, vf);
		    		addObjectToRepresentation("http://dati.gov.it/onto/ann-voc/dafId", "dafId", representation, newRepresentation, vf);
		    		addTextToRepresentation("http://dati.gov.it/onto/ann-voc/domainClassLabel", "label.class", representation, newRepresentation, lang, vf);
		    		addTextToRepresentation("http://dati.gov.it/onto/ann-voc/domainClassComment", "comment.class", representation, newRepresentation, lang, vf);
		    		addTextToRepresentation("http://dati.gov.it/onto/ann-voc/ontologyLabel", "label.ontology", representation, newRepresentation, lang, vf);
		    		addTextToRepresentation("http://dati.gov.it/onto/ann-voc/ontologyComment", "comment.ontology", representation, newRepresentation, lang, vf);
		    		addObjectToRepresentation("http://stanbol.apache.org/ontology/entityhub/query#score", "score", representation, newRepresentation, vf);
		    		
		    		transformedResults.add(newRepresentation);
					
				}
			}
			
		}
	}
	
	return transformedResults;
}
 
开发者ID:teamdigitale,项目名称:ontonethub,代码行数:44,代码来源:OntoNetHubImpl.java


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