Hi all,
Let's try the small example:
from owlready2 import *
onto = get_ontology('http://students.org/') # nouvelle ontologie, on donne son IRI
with onto:
# Define a Person
class Person(Thing): # nouvelle classe sous-classe de Thing
pass
# Define a Course
class Course(Thing):
# subclass of not a Person
is_a = [Not(onto.Person)]
# AllDisjoint([Person, Course])
# A Person can teach a Course
class teaches(Person >> Course): pass
# Define a Teacher
class Teacher(Thing):
# as a Person who teaches some Course
equivalent_to = [And([Person, teaches.some(Course)])]
# A Person can attend a Course
class attends(Person >> Course): pass
# Define a Student
class Student(Thing):
# as a Person who attends some Course
equivalent_to = [And([Person, attends.some(Course)])]
# Define some individuals
with onto:
mary = Person(name='mary') # mary instance de la classe personne
cs600 = Course(name='cs600')
alice = Person(name='alice')
alice.teaches = [cs600]
mary.attends = [cs600]
onto.save('students.owl')
default_world.save('world-students.owl')
When looking into the OWL files, we see that when onto is saved, the base IRI for the class is lost.
In students.owl, we get:
<owl:Class rdf:about="Person">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>
when in world-students.owl we get:
<owl:Class rdf:about="http://students.org/Person">
<rdfs:subClassOf rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
</owl:Class>
When loading students.owl into Protégé, we end up with 2 Course and 2 Person classes, one with the right IRI and the other one with the file name as IRI, which is unexpected (to me!).
Any reason I may have overlooked for this behavior?
Thanks for any explanation.
Best regards,
Fabrice