當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。