Problem with creating a new induvidual

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

Problem with creating a new induvidual

Lynsie
I want to create new individuals through a user interface. I managed to add the individual to the ontology but I can't insert the values of the properties. Here is a part of the code:
ind=Class(ind)
for i in onto.data_properties():
       if(i.domain.__contains__(Class)):
             ind.i=[an input given by the user]

onto.save()

I can't where is the problem, Could you help please?
Reply | Threaded
Open this post in threaded view
|

Re: Problem with creating a new induvidual

Jiba
Administrator
Hi,

I think the problem is in "ind.i" : this means the property "i", not the property whose name is in variable i.

You should use either:

    i[ind] = [an input given by the user]

or:

    setattr(ind, i, [an input given by the user])

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Problem with creating a new induvidual

Lynsie
Okey. Thank you so much.