In my case: Owlready2 is making difficult to populate relations with common subject and different objects

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

In my case: Owlready2 is making difficult to populate relations with common subject and different objects

Suresh
 I am using Owlready2 for my implementation and when I try to populate the following triples into some ontology:

Class-1-Instance-1 Property Class-2-Instance-1
Class-1-Instance-1 Property Class-2-Instance-2

The second triple is overwritten over the first triple, while java version allows adding both the triples. The syntax of owlready2 to perform this task is like this

Class-1-Instance-1.Property == [ Class-2-Instance-1 , Class-2-Instance-2 ]

which is quite difficult in real-world programming because these class-2 instances appear in different-different iterations and they also carry some other information that needs to be populated at the very same moment, adding these class individuals into a list and populating them later makes other parts of the program very complex. So I guess java's way of populating these triples makes things really adaptable. Please correct me if I am wrong. Right now, I'm stuck at my code due to this complex design choice.
Reply | Threaded
Open this post in threaded view
|

Re: In my case: Owlready2 is making difficult to populate relations with common subject and different objects

Jiba
Administrator
Hi,

You can add the 2 RDF triples not at the same time, as follows:

Class-1-Instance-1.Property.append(Class-2-Instance-1)
Class-1-Instance-1.Property.append(Class-2-Instance-2)
etc...

Notice also that "==" is a comparison, in your example you should use "=" to modify the value of the list.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: In my case: Owlready2 is making difficult to populate relations with common subject and different objects

Suresh
Thank you so much Jiba, that's a great help !!

And obv. == is typo. :-)

Thanx Again,
Suresh