本文整理匯總了Java中org.semanticweb.owlapi.model.OWLDataFactory.getOWLAnnotationProperty方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLDataFactory.getOWLAnnotationProperty方法的具體用法?Java OWLDataFactory.getOWLAnnotationProperty怎麽用?Java OWLDataFactory.getOWLAnnotationProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.semanticweb.owlapi.model.OWLDataFactory
的用法示例。
在下文中一共展示了OWLDataFactory.getOWLAnnotationProperty方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: LegoModelWalker
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected LegoModelWalker(OWLDataFactory df) {
this.f = df;
partOf = OBOUpperVocabulary.BFO_part_of.getObjectProperty(f);
occursIn = OBOUpperVocabulary.BFO_occurs_in.getObjectProperty(f);
enabledBy = OBOUpperVocabulary.GOREL_enabled_by.getObjectProperty(f);
shortIdProp = df.getOWLAnnotationProperty(IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX+"id"));
contributor = f.getOWLAnnotationProperty(AnnotationShorthand.contributor.getAnnotationProperty());
date = f.getOWLAnnotationProperty(AnnotationShorthand.date.getAnnotationProperty());
group = f.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/group")); // TODO place holder
axiomHasEvidence = f.getOWLAnnotationProperty(IRI.create("http://purl.obolibrary.org/obo/RO_0002612"));
hasSupportingRef = f.getOWLObjectProperty(IRI.create("http://purl.obolibrary.org/obo/SEPIO_0000124"));
withSupportFrom = f.getOWLObjectProperty(IRI.create("http://purl.obolibrary.org/obo/RO_0002614"));
evidenceOld = f.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/evidence"));
source_old = f.getOWLAnnotationProperty(AnnotationShorthand.source.getAnnotationProperty());
with_old = f.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/evidence-with"));
}
示例2: addPTBoxConstraints
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected void addPTBoxConstraints(OWLOntology ontology, PTBox ptbox,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(ptbox.getClassicalKnowledgeBase(), factory);
for (ConditionalConstraint cc : ptbox.getDefaultConstraints()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create(Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLClassExpression clsEv = (OWLClassExpression)converter.convert( cc.getEvidence() );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLSubClassOfAxiom( clsEv, clsCn, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
示例3: synonym
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Add an synonym annotation, plus an annotation on that annotation
* that specified the type of synonym. The second annotation has the
* property oio:hasSynonymType.
*
* @param ontology the current ontology
* @param subject the subject of the annotation
* @param type the IRI of the type of synonym
* @param property the IRI of the annotation property.
* @param value the literal value of the synonym
* @return the synonym annotation axiom
*/
protected static OWLAnnotationAssertionAxiom synonym(
OWLOntology ontology, OWLEntity subject,
OWLAnnotationValue type,
OWLAnnotationProperty property,
OWLAnnotationValue value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
OWLAnnotationProperty hasSynonymType =
dataFactory.getOWLAnnotationProperty(
format.getIRI("oio:hasSynonymType"));
OWLAnnotation annotation =
dataFactory.getOWLAnnotation(hasSynonymType, type);
Set<OWLAnnotation> annotations = new HashSet<OWLAnnotation>();
annotations.add(annotation);
OWLAnnotationAssertionAxiom axiom =
dataFactory.getOWLAnnotationAssertionAxiom(
property, subject.getIRI(), value,
annotations);
manager.addAxiom(ontology, axiom);
return axiom;
}
示例4: cacheInformationContentInOntology
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Override
public OWLOntology cacheInformationContentInOntology() throws OWLOntologyCreationException, UnknownOWLClassException {
OWLOntologyManager mgr = getSourceOntology().getOWLOntologyManager();
OWLDataFactory df = mgr.getOWLDataFactory();
OWLOntology o = mgr.createOntology();
OWLAnnotationProperty p = df.getOWLAnnotationProperty(IRI.create(icIRIString));
for (OWLClass c : getSourceOntology().getClassesInSignature()) {
Double ic = getInformationContentForAttribute(c);
if (ic != null) {
mgr.addAxiom(o,
df.getOWLAnnotationAssertionAxiom(p,
c.getIRI(),
df.getOWLLiteral(ic)));
}
}
return o;
}
示例5: testExactSynonym
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private void testExactSynonym(OWLOntology ontology) {
IRI iri = IRI.create("http://www.geneontology.org/formats/oboInOwl#hasExactSynonym");
OWLDataFactory df = ontology.getOWLOntologyManager().
getOWLDataFactory();
OWLAnnotationProperty property = df.getOWLAnnotationProperty(iri);
assertTrue("Exact Synonym property in signature",
ontology.containsAnnotationPropertyInSignature(iri));
// Check axioms
Set<OWLAnnotationAxiom> axioms = ontology.getAxioms(property, Imports.EXCLUDED);
assertEquals("Count class axioms", 0, axioms.size());
// Check annotations
List<String> values = new ArrayList<String>();
values.add("AnnotationAssertion(rdfs:label <http://www.geneontology.org/formats/oboInOwl#hasExactSynonym> \"has_exact_synonym\"^^xsd:string)");
Set<OWLAnnotationAssertionAxiom> annotations =
ontology.getAnnotationAssertionAxioms(iri);
assertEquals("Count annotations for Exact", 1, annotations.size());
checkAnnotations(annotations, values);
}
示例6: loadTestOntology
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Load the ontology <code>/graph/subannotprops.owl</code> into {@link #wrapper},
* and also loads the {@code OWLAnnotationProperty}s needed.
*/
@BeforeClass
public static void loadTestOntology()
throws OWLOntologyCreationException, OBOFormatParserException,
IOException {
ParserWrapper parserWrapper = new ParserWrapper();
OWLOntology ont = parserWrapper.parse(OGWSubAnnotationTest.class.getResource(
"/graph/subannotprops.owl").getFile());
wrapper = new OWLGraphWrapper(ont);
OWLDataFactory f = wrapper.getManager().getOWLDataFactory();
subsetProp = f.getOWLAnnotationProperty(
IRI.create("http://www.geneontology.org/formats/oboInOwl#SubsetProperty"));
groupProp = f.getOWLAnnotationProperty(
IRI.create("http://purl.obolibrary.org/obo/uberon/core#grouping_class"));
fake1Prop = f.getOWLAnnotationProperty(
IRI.create("http://purl.obolibrary.org/obo/uberon/core#fake1"));
fake2Prop = f.getOWLAnnotationProperty(
IRI.create("http://purl.obolibrary.org/obo/uberon/core#fake2"));
lonelyProp = f.getOWLAnnotationProperty(
IRI.create("http://purl.obolibrary.org/obo/uberon/core#lonely"));
}
示例7: getDcSourceProperty
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private OWLAnnotationProperty getDcSourceProperty(OWLOntology lego, OWLDataFactory f) {
OWLAnnotationProperty p = f.getOWLAnnotationProperty(DC_SOURCE);
Set<OWLDeclarationAxiom> declarationAxioms = lego.getDeclarationAxioms(p);
if (declarationAxioms == null || declarationAxioms.isEmpty()) {
OWLOntologyManager m = lego.getOWLOntologyManager();
m.addAxiom(lego, f.getOWLDeclarationAxiom(p));
}
return p;
}
示例8: addDefaultModelState
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
private Set<OWLAnnotation> addDefaultModelState(Set<OWLAnnotation> existing, OWLDataFactory f) {
IRI iri = AnnotationShorthand.modelstate.getAnnotationProperty();
OWLAnnotationProperty property = f.getOWLAnnotationProperty(iri);
OWLAnnotation ann = f.getOWLAnnotation(property, f.getOWLLiteral(defaultModelState));
if (existing == null || existing.isEmpty()) {
return Collections.singleton(ann);
}
existing.add(ann);
return existing;
}
示例9: addPABoxConstraints
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
protected void addPABoxConstraints(OWLOntology ontology, PABox pabox, KnowledgeBase kb,
OWLOntologyManager manager, OWLDataFactory factory) {
ConceptConverter converter = new ConceptConverter(kb, factory);
for (Map.Entry<ATermAppl, Set<ConditionalConstraint>> entry : pabox.getConstraintsMap().entrySet()) {
for (ConditionalConstraint cc : entry.getValue()) {
OWLAnnotationProperty annProp = factory.getOWLAnnotationProperty( IRI.create( Constants.CERTAINTY_ANNOTATION_URI ));
OWLAnnotationValue annValue = factory.getOWLStringLiteral( cc.getLowerBound() + ";" + cc.getUpperBound() );
OWLAnnotation annotation = factory.getOWLAnnotation( annProp, annValue );
OWLIndividual indiv = factory.getOWLNamedIndividual( IRI.create( entry.getKey().getName()) );
OWLClassExpression clsCn = (OWLClassExpression)converter.convert( cc.getConclusion() );
OWLAxiom axiom = factory.getOWLClassAssertionAxiom( clsCn, indiv, Collections.singleton( annotation ) );
try {
manager.applyChange( new AddAxiom(ontology, axiom) );
} catch( OWLOntologyChangeException e ) {
e.printStackTrace();
}
}
}
}
示例10: traceAxioms
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
static Set<OWLAxiom> traceAxioms(Set<OWLAxiom> axioms, OWLGraphWrapper g, OWLDataFactory df) {
final OWLAnnotationProperty p = df.getOWLAnnotationProperty(IRI.create("http://trace.module/source-ont"));
final Set<OWLOntology> ontologies = g.getSourceOntology().getImportsClosure();
final Set<OWLAxiom> traced = new HashSet<OWLAxiom>();
for (OWLAxiom axiom : axioms) {
Set<OWLOntology> hits = new HashSet<OWLOntology>();
for(OWLOntology ont : ontologies) {
if (ont.containsAxiom(axiom)) {
hits.add(ont);
}
}
if (hits.isEmpty()) {
traced.add(axiom);
}
else {
Set<OWLAnnotation> annotations = new HashSet<OWLAnnotation>(axiom.getAnnotations());
for (OWLOntology hit : hits) {
Optional<IRI> hitIRI = hit.getOntologyID().getOntologyIRI();
if(hitIRI.isPresent()) {
annotations.add(df.getOWLAnnotation(p, hitIRI.get()));
}
}
traced.add(AxiomAnnotationTools.changeAxiomAnnotations(axiom, annotations, df));
}
}
return traced;
}
示例11: ModelAnnotationSolrDocumentLoader
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
public ModelAnnotationSolrDocumentLoader(SolrServer server, OWLOntology model, OWLReasoner r, String modelUrl,
Set<String> modelFilter, boolean skipDeprecatedModels, boolean skipTemplateModels) {
super(server);
this.model = model;
this.reasoner = r;
this.requiredModelStates = modelFilter;
this.skipDeprecatedModels = skipDeprecatedModels;
this.skipTemplateModels = skipTemplateModels;
this.graph = new OWLGraphWrapper(model);
this.modelUrl = modelUrl;
current_doc_number = 0;
OWLDataFactory df = graph.getDataFactory();
partOf = OBOUpperVocabulary.BFO_part_of.getObjectProperty(df);
occursIn = OBOUpperVocabulary.BFO_occurs_in.getObjectProperty(df);
defaultClosureRelations = new ArrayList<String>(1);
defaultClosureRelations.add(graph.getIdentifier(partOf));
enabledBy = OBOUpperVocabulary.GOREL_enabled_by.getObjectProperty(df);
title = df.getOWLAnnotationProperty(IRI.create("http://purl.org/dc/elements/1.1/title"));
source = df.getOWLAnnotationProperty(IRI.create("http://purl.org/dc/elements/1.1/source"));
contributor = df.getOWLAnnotationProperty(IRI.create("http://purl.org/dc/elements/1.1/contributor"));
date = df.getOWLAnnotationProperty(IRI.create("http://purl.org/dc/elements/1.1/date"));
evidence = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/evidence"));
modelState = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/modelstate"));
comment = df.getRDFSComment();
with = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/evidence-with"));
layoutHintX = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/hint/layout/x"));
layoutHintY = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/hint/layout/y"));
templatestate = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/templatestate"));
displayLabelProp = df.getRDFSLabel();
shortIdProp = df.getOWLAnnotationProperty(IRI.create(Obo2OWLConstants.OIOVOCAB_IRI_PREFIX+"id"));
jsonProp = df.getOWLAnnotationProperty(IRI.create("http://geneontology.org/lego/json-model"));
bpSet = getAspect(graph, "biological_process");
}
示例12: translateResultsToOWLAxioms
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
@Override
protected void translateResultsToOWLAxioms(String id, OWLNamedIndividual result, Set<OWLAxiom> axioms) {
OWLDataFactory df = simEngine.getGraph().getDataFactory();
// declare a named class for the LCS and make this equivalent to the anonymous expression
OWLClass namedLCS = df.getOWLClass(IRI.create(id+"_LCS"));
axioms.add(df.getOWLAnnotationAssertionAxiom(df.getOWLAnnotationProperty(OWLRDFVocabulary.RDFS_LABEL.getIRI()),
namedLCS.getIRI(),
df.getOWLLiteral("LCS of "+simEngine.label(a)+" and "+simEngine.label(b))));
axioms.add(df.getOWLEquivalentClassesAxiom(namedLCS, getLCS()));
// link the similarity object to the named LCS
OWLAnnotationProperty lcsp = df.getOWLAnnotationProperty(annotationIRI("has_least_common_subsumer"));
axioms.add(df.getOWLAnnotationAssertionAxiom(lcsp, result.getIRI(), namedLCS.getIRI()));
}
示例13: annotate
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Convenience method for adding an annotation assertion to the
* ontology itself, taking a CURIE for the property and an Boolean literal.
*
* @param ontology the current ontology
* @param propertyCURIE will be expanded to the full annotation
* property IRI
* @param value the literal value of the annotation
* @return the annotation axiom
*/
protected static OWLAnnotation annotate(OWLOntology ontology,
String propertyCURIE, String value) {
OWLOntologyManager manager = ontology.getOWLOntologyManager();
OWLDataFactory dataFactory = manager.getOWLDataFactory();
IRI iri = format.getIRI(propertyCURIE);
OWLAnnotationProperty property =
dataFactory.getOWLAnnotationProperty(iri);
OWLLiteral literal = dataFactory.getOWLLiteral(value);
OWLAnnotation annotation = dataFactory.getOWLAnnotation(
property, literal);
manager.applyChange(
new AddOntologyAnnotation(ontology, annotation));
return annotation;
}
示例14: createAnnotationProperty
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
/**
* Create an annotation property and add it to the ontology.
*
* @param ontology the current ontology
* @param iri the IRI for the annotation property
* @return the annotation property
*/
protected static OWLAnnotationProperty createAnnotationProperty(
OWLOntology ontology, IRI iri) {
OWLDataFactory dataFactory = ontology.getOWLOntologyManager().
getOWLDataFactory();
OWLAnnotationProperty property =
dataFactory.getOWLAnnotationProperty(iri);
declare(ontology, property);
return property;
}
示例15: fillAspects
import org.semanticweb.owlapi.model.OWLDataFactory; //導入方法依賴的package包/類
static void fillAspects(OWLOntology model, OWLReasoner reasoner, CurieHandler curieHandler, Set<OWLClass> bpSet, Set<OWLClass> mfSet, Set<OWLClass> ccSet,
OWLClass bp, OWLClass mf, OWLClass cc) {
final IRI namespaceIRI = Obo2Owl.trTagToIRI(OboFormatTag.TAG_NAMESPACE.getTag());
final OWLDataFactory df = model.getOWLOntologyManager().getOWLDataFactory();
final OWLAnnotationProperty namespaceProperty = df.getOWLAnnotationProperty(namespaceIRI);
final Set<OWLOntology> ontologies = model.getImportsClosure();
for(OWLClass cls : model.getClassesInSignature(Imports.INCLUDED)) {
if (cls.isBuiltIn()) {
continue;
}
String id = curieHandler.getCuri(cls);
if (id.startsWith("GO:") == false) {
continue;
}
// if a reasoner object is passed, use inference to populate
// the 3 subset
if (reasoner != null) {
if (reasoner.getSuperClasses(cls, false).containsEntity(mf) ||
reasoner.getEquivalentClasses(cls).contains(mf)) {
mfSet.add(cls);
}
if (reasoner.getSuperClasses(cls, false).containsEntity(bp) ||
reasoner.getEquivalentClasses(cls).contains(bp)) {
bpSet.add(cls);
}
if (reasoner.getSuperClasses(cls, false).containsEntity(cc) ||
reasoner.getEquivalentClasses(cls).contains(cc)) {
ccSet.add(cls);
}
}
for (OWLAnnotation annotation : OwlHelper.getAnnotations(cls, ontologies)) {
if (annotation.getProperty().equals(namespaceProperty)) {
String value = annotation.getValue().accept(new OWLAnnotationValueVisitorEx<String>() {
@Override
public String visit(IRI iri) {
return null;
}
@Override
public String visit(OWLAnonymousIndividual individual) {
return null;
}
@Override
public String visit(OWLLiteral literal) {
return literal.getLiteral();
}
});
if (value != null) {
if ("molecular_function".equals(value)) {
mfSet.add(cls);
}
else if ("biological_process".equals(value)) {
bpSet.add(cls);
}
else if ("cellular_component".equals(value)) {
ccSet.add(cls);
}
}
}
}
}
}