I want to be able to programmatically access ontology annotations, so NOT those ascribed to terms/classes or annotation/object/data properties, but those applied to the ontology itself.
I code in python and have become familiar with using owlready2 to access ontology content (e.g. using .classes(), .annotation_properties(), etc, but I can't find how to access ontology annotations.
E.g. I have annotations such as dc:accessRights, dc:isReferencedBy, etc whichare used to annotate/describe the ontology itself. I need to be able to access these (so that I can extract them, translate them and add them back into the ontology file).
Is there a way to do this? I have tried using onto.annotations() and e.g. onto.abstract, but just get "None".
Currently, it is not possible to obtain the list of annotations... I've added that support in the development version of Owlready. In that version, you can now use onto.metadata as you did to obtain a list of annotation property, e.g.:
for annot in onto.metadata:
As a workaround, in the current stable version, you can use instead:
for annot in [onto._to_python(p) for p in onto.world._get_triples_s_p(onto.storid) if p != rdf_type]: