Re: How to import instances and its corresponding property values from database to an ontology

Posted by IWilliams on
URL: http://owlready.306.s1.nabble.com/How-to-import-instances-and-its-corresponding-property-values-from-database-to-an-ontology-tp387p389.html

Hi,

Did you check that the data type for my_customer.customerNumber & list_of_tuples_CustNo[i][0] are the same type?

Also, have you tried?
#1
with onto:
        for i in range(len(list_of_tuples_CustNo)):
                        my_customer = onto.customers('customer_'+str(i), customerNumber = list_of_tuples_CustNo[i][0])

#2
Do a print out of "list_of_tuples_CustNo[i][0]" just to see that is accessing the specific index

#3
Convert the "list_of_tuples_CustNo[i][0]" explicitly to the "customerNumber" data type. You may also want to catch type error if you are converting.