Salut Jean-Baptiste:
Hi, I'm developing an ontology and I want to know what are the classes that are missing a definition. However, since I have merged many different subontologies, I have two "definition" annotation properties with two different namespaces. Specifically, if I do: for ann_prop in ecco.annotation_properties(): print (ann_prop) I get npo.definition efo.definition. When I try to print the definition with Class.npo.definition I get this error: AttributeError: 'npo' property is not defined If I try to print definition with clas.definition, I get only two definitions that are only efo.definition, but not all definitions that are efo.definition. Maybe I'm not getting well namespaces. How can I query annotation properties in different namespaces? Merci beaucoup! |
Administrator
|
Hi,
If two annotations have the same name, you cannot use the "class.annotation" syntax (it will defaults to one of the two annotaions, without being able to choose between them). You need to use the more complex "annotation[class]" syntax. This syntax requires to obtain the annotation as an object, this can be done using the ontology it belongs to, a namespace or its IRI: # Choose one annotation = IRIS["http://full/iri/to/definition"] annotation = onto_npo.definition annotation = onto.get_namespace("http://full/iri/to/").definition print(annotation[your_class]) Best regards, Jean-Baptiste Lamy MCF, LIMICS, Université Paris 13 > Salut Jean-Baptiste: > Hi, > > I'm developing an ontology and I want to know what are the classes that are > missing a definition. However, since I have merged many different > subontologies, I have two "definition" annotation properties with two > different namespaces. Specifically, if I do: > > for ann_prop in ecco.annotation_properties(): > > print (ann_prop) > > > > I get > > npo.definition > efo.definition. > > > When I try to print the definition with Class.npo.definition I get this > error: > > > AttributeError: 'npo' property is not defined > > If I try to print definition with clas.definition, I get only two > definitions that are only efo.definition, but not all > definitions that are efo.definition. > > Maybe I'm not getting well namespaces. How can I query annotation properties > in different namespaces? > > > Merci beaucoup! > > > > _______________________________________________ > If you reply to this email, your message will be added to the discussion below: > http://owlready.8326.n8.nabble.com/annotation-properties-with-different-namespaces-tp165.html > To start a new topic under Owlready, email [hidden email] > To unsubscribe from Owlready, visit |
Hi, I've tried your suggestion. It works!
But using annotation[your_class] only can return the first annotation. If I have several definitions in the same namespace, how can I do to return list of definitions [definition 1, definition 2, definition 3]? e.g.: <owl:AnnotationProperty rdf:about="http://www.w3.org/2004/02/skos/core#definition"/> <owl:Class rdf:about="http://www.co-ode.org/ontologies/pizza/pizza.owl#CheeseyPizza"> <rdfs:label xml:lang="en">CheesyPizza</rdfs:label> <rdfs:label xml:lang="pt">PizzaComQueijo</rdfs:label> <skos:definition xml:lang="en">definition 1.</skos:definition> <skos:definition xml:lang="en">definition 2.</skos:definition> <skos:definition xml:lang="en">definition 3.</skos:definition> <skos:prefLabel xml:lang="en">Cheesy Pizza</skos:prefLabel> </owl:Class> Thank you very much. |
This post was updated on .
Solved~
I got list of annotation properties as follows: cls = = onto.search_one(label = 'CheesyPizza' ) anno = onto.search_one(iri ='http://www.w3.org/2004/02/skos/core#definition') print(anno[cls]) |
Free forum by Nabble | Edit this page |