Read out restrictions of classes
Posted by Lux on
URL: http://owlready.306.s1.nabble.com/Read-out-restrictions-of-classes-tp2154.html
Hello, I need to readout an existing ontology from a file. But I have a problem to readout the details of the restrictions of a class:
import owlready2 as or2
ontology = or2.get_ontology("file://sargon owl xml.owl").load()
for cla in ontology.classes():
for restriction in cla.is_a:
print(restriction)
The print gives an output like:
"sargon owl xml.hasFunction.some(sargon owl xml.StartStopFunction)"
But I don't know how to decompose this knowlegde into its seperate pieces (.property, .type , .cardinality and .value).
Calling e.g restriction.type resolves in "AttributeError: 'type' property is not defined".
Does someone know how I can access these informations?
Thank you in advance,
Lux