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

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

Hi ,

I have been using OWLready to map database to OWL.Its documentation is great and this mailing list is very helpfull.

I am getting my data from MySql database.I have already created the ontology schema ie the classes,data properties and object properties.
Now I am trying to create instances by accessing the data from database.

Here is my code

with onto:
        for i in range(len(list_of_tuples_CustNo)):
                        my_customer = onto.customers('customer_'+str(i))
                        my_customer.customerNumber = list_of_tuples_CustNo[i][0]

Here list_of_tuples_CustNo[i][0] is all the customernumbers i am trying to attach to dataproperty customerNumber.

The program runs without any error ie it creates instances "customer_1" ,"customer_2"... from this statement my_customer = onto.customers('customer_'+str(i))

But Data property assertion doesn't happen. customersnumber doesnt get attached to these instances.


Any help would really be appreciated.

Regards,
Jui