How to get the restriction type of a restriction?

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

How to get the restriction type of a restriction?

Akash
I am able to get the following components of a restriction:
1. property using .property
2. cardinality using .cardinality
3. restriction using .value

However, I am unable to get the type (SOME, ONLY, EXACTLY, etc.) using .type.

<restriction_class>.type seems to give me integers such as 24 (some) and 26 (exactly). Is there a mapping of integers and types that I can access, or am I doing this wrong?
Reply | Threaded
Open this post in threaded view
|

Re: How to get the restriction type of a restriction?

Jiba
Administrator
Hi,

You need to compare these integer to the Owlready's constant SOME, ONLY, etc.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: How to get the restriction type of a restriction?

Akash
Thanks, Jiba.

Is there a readily available dictionary, from where I can derive the type, or is there any documentation about which integer corresponds to which type?

Example: {24: "SOME", 26: "EXACTLY", ....}

Just checking before I go about finding out by trial and error.
Reply | Threaded
Open this post in threaded view
|

Re: How to get the restriction type of a restriction?

Jiba
Administrator
Hi,

You can use owlready2.class_construct._restriction_type_2_label

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: How to get the restriction type of a restriction?

Akash
Thanks!