本文整理匯總了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;
}