creating construct Subclass Of some Class

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

creating construct Subclass Of some Class

Citlalli
This post was updated on .
Hi,

I used a script like this to dynamically generate relations:

for Class in onto.classes():
    if some conditions:
        Class.has_part.append(Class)


It did created relations, but it created them with type VALUE and I wanted them with type SOME. I just can't find how to do that for Subclass Of, not for Equivalent To.



Thanks in advance
Reply | Threaded
Open this post in threaded view
|

Re: creating construct Subclass Of some Class

Jiba
Administrator
Hi,

The "Class.relation.append" syntax is a shortcut for creating VALUE constraints. This syntax treats classes as if they were instances, and only support VALUE constraints currently.

To create SOME constraint, you need the more complex syntax :

      Class.is_a.append(has_part.some(OtherClass))

You can use Class.equivalent_to instead of Class.is_a for an equivalence.
You may need to prefix the relation by the ontology (for example: onto.has_part), depending whether you created it locally or you load it from an ontology.