Use of imported properties on instances

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of imported properties on instances

molenz
I have imported an ontology using

  c = get_ontology('cso.owl').load()

and want to use the loaded classes and properties now to instantiate it.

  a1 = c.Array()
  r1 = c.Rank()

Now I know that c.Array is a subclass of `hasRank.some(Rank)`.
But I don't know how to assign r1 to a1 because this `hasRank` property needs to be called using `c.hasRank`

Of course something like `a1.c.hasRank = r1` cannot work (AttributeError: 'c' property is not defined.).
And simply `a1.hasRank = r1` would not use the imported property, right?

Please help.
Reply | Threaded
Open this post in threaded view
|

Re: Use of imported properties on instances

Jiba
Administrator
Hello,

You can simply use :

a1.hasRank = r1

Owlready identify properties by their name, and do not take into account whether they come from the same ontology or an imported one.

Jiba