Hello,
I tried the following program:
from owlready2 import *
#import owlready2
#owlready2.set_log_level(9)
onto = get_ontology("
http://test.org/onto.owl")
with onto:
class Drug(Thing):
pass
class Ingredient(Thing):
pass
class has_for_ingredient(ObjectProperty):
domain = [Drug]
range = [Ingredient]
class is_ingredient_of(ObjectProperty):
domain = [Ingredient]
range = [Drug]
inverse_property = has_for_ingredient
my_drug2 = Drug("my_drug2")
aspirin = Ingredient("aspirin")
my_drug2.has_for_ingredient.append(aspirin)
print(my_drug2.has_for_ingredient)
print(aspirin.is_ingredient_of)
But I obtain the expected results:
[onto.aspirin]
[onto.my_drug2]
Are you sure you do not miss some step in your program?
Best regards,
Jiba