get annotations dynamically

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

get annotations dynamically

jlbellier
Hello,

I would like to get the list of annotation properties dynamically with owlready2 and python. I can get them with the method annotation_properties defined on the ontology, but this fiunction does not retrieve the annotations defined in the rdfs namespace, like 'rdfs:comment', 'rdfs:label', 'rdfs:definedBy'.

I tried to use the onto.metadata, but I can only do it statically, i.e. I cannot found any property or method of onto.metadata giving these annotations automatically.

Is there a way to do that ?

Thank you in advance for your help. Have a good day.

Best regards,
Jean-Luc BELLIER.
Reply | Threaded
Open this post in threaded view
|

Re: get annotations dynamically

Jiba
Administrator
Hello,

There are 9 annotation properties that are predefined in OWL or RDFS (such as label and comment).

You can get all annotation properties by adding these 9 annotation properties, as follows:

print(list(default_world.annotation_properties()) + [comment, label, backwardCompatibleWith, deprecated, incompatibleWith, isDefinedBy, priorVersion, seeAlso, versionInfo])

Best regards,
Jiba