How to gathered the way items are linked in an ontology

Posted by Frack on
URL: http://owlready.306.s1.nabble.com/How-to-gathered-the-way-items-are-linked-in-an-ontology-tp344.html

Hi all,

A quite strange question here, I would like to be able to query my (Protégé) ontology this way:

I have entities:

Owl:Thing
--A
----1
----2
--B
----3
----4
----5
----6

I have relations between some of them, let say for example:
relation : is_part_of
3 is_part_of 1
4 is_part_of 1

Only these 2. So after that I would like to query such an entry : for example I get a question saying, is 5 a part of 1? I then want to query the ontology to then check that, no, 5 is not a part of 1.

If I correctly understood how works the API, I have to re-create my ontology as classes within my python file (classes, relations, properties, ...), so I started by parsing my classes(), but it shows me all the classes and not only the 1st level ones. Do I have to trick and look for Owl:Thing subclasses()?

Don't hesitate if you need further details, it can be a little bit messy I admit :).