Creating realtion between instances and the relation is in another namespace
So I have 2 instances : instance 1 and instance 2 how to create a relation between them when the relation is in another instance
Such a code yields an error:
ns1 = onto.get_namespace("http://www.ns1.org/")
inst1 = Class1("inst1")
inst2 = Class2("inst2")
# Access the property from the other namespace
property = ns1.relation
# Add the relation between the instances
Re: Creating realtion between instances and the relation is in another namespace
First, you should not create your classes outside a "with onto:" block, otherwise they are not defined in a proper ontology.
Then, "property = ns1.relation" does not define a property for future use of ".property". Owlready automatically support ".property" notation, but you need to use the name of the property in OWL (in your example, it seems to be "relation"). If the name is not valid in Python, you can change it by setting the annotation "python_name" on the property.