About ClassConstruct

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

About ClassConstruct

jlbellier
Hello

I received an ontology with one object property having a ClassCOnstruct.Or domain/type.
I would like to extract the classes that define this ClassConstruct.

How can I do that with Owlready2 and Python ?

Any help would be greatly appreciated.

Have a good day.

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

Re: About ClassConstruct

cknoll
I am not sure that I understand your problem, maybe you can just use the `.domain` attribute:

extending the example from another recent mailinglist question (which you do not need to understand in detail) https://nbviewer.jupyter.org/github/cknoll/demo-material/blob/main/expertise_system/cardinality_restriction_demo.ipynb

This would read:

print(type(has_Equipments))
<class 'owlready2.prop.ObjectPropertyClass'>

print(has_Equipments.domain) # note: this is a list
[test.EquipmentContainer]


Best,
Carsten.
Reply | Threaded
Open this post in threaded view
|

Re: About ClassConstruct

Jiba
Administrator
In reply to this post by jlbellier
In addition, you can use the .Classes attributes to obtain the list of classes that are part of the union described by the Or class construct.

Jiba