Get annotations on standard annotations

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

Get annotations on standard annotations

jlbellier
Hello,

In my ontology, I have defined an annotation called visible, to determine if an object (class, data property, object property or annotation property) can be visible in my application.
To do that, I assign annotation visible to it and set the value false to hide the corresponding object (class, data property, object property or annotation property). If 'visible' is not assigned on my object, or if another value is set on 'visible' annotation for the corresponding objeft, I consider it as visible and show it.

I works fine except for standard annotations, like comment, label, .. i.e. all the annotations that belong to the namespaces owl or rdfs.

In my process, I use getattr(, 'visible') and check if the result. If it is [false], I know that the annotation 'visible' has been set on my object with the value false, so I can decide what to do (in the present case, hide the object).

But for standard annotations, even if I put annotation 'visible' on it with the value false, getattr(, 'visible') always return an empty list.

Is there a way to get the annotations set on these standard annotations ? I check the standard object like __dict__ or other internal objects, but could not find any way to get any information.

Any hep woulf be greatly appreciated.

Thank you in advance.

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

Re: Get annotations on standard annotations

Jiba
Administrator
Hello,

Standard annotations, like OWL classes such as Thing, are treated specially in Owlready and they are common to all world. As a consequence, they are not associated with a quadstore and you cannot read your "visible" annotation.

The only solution is to bypass Owlready, e.g. using SPARQL as follows:

print(list(default_world.sparql("""SELECT ?x { ?? onto:visible ?x }""", [label]))[0])

Jiba