Creating a relation with property from other ontology
I am working with several ontologies, but I am new to owlready. I can't wrap my head around the ways to assert a relation when the resources, particularly the property, are defined in a second or several other ontologies. The main way to assert a relation seems to be setting the attribute on the subject instance with the same name as the property. But how can I make sure that the property in the relation triple has the correct IRI?
"""Example: I am manipulating onto1 using ressources from onto2"""
simulator = onto2.Simulator_FSI("my_fsi") # no problem with individuals
sim = onto2.Structural_Mechanics_Simulation("my_sim")
# trying to assert triple (onto1.simulator, onto2.conductsSimulation, onto1.sim)
# but can't use "onto2." to access correct property, so gets a different attribute
simulator.conductsSimulation = [sim]
print(list(onto2.conductsSimulation.get_relations())) # prints 
Re: Creating a relation with property from other ontology
If the "conductsSimulation" property exists in only one ontology, you can do as usual:
The fact that the property is defined in another ontology is not a problem at all.
If the "conductsSimulation" property exists in both ontologies, it is more tricky because Owlready will use one of the property by default (and possibly not the one you would expect). In that case, you can use the following alternate syntax :