owlready keep adding classes into the existing ontology while using load()

Posted by Waseem85 on
URL: http://owlready.306.s1.nabble.com/owlready-keep-adding-classes-into-the-existing-ontology-while-using-load-tp301.html

I am trying to access an ontology and then instantiate it but it looks like owlready keep adding into the existing file.
Here is my code;

    abc = get_ontology("file://D:/Excel_parser_1/OWL-xml_version/abc.owl").load()

    onto = get_ontology("file://C:/.../test_onot").load()
    onto.imported_ontologies.clear()
    onto.imported_ontologies.append(abc)
   
    ebbw_node = abc.Node("Node",ontology = onto)
    bes_instance = abc.ENode(bes.name, ontology = onto)
    bes_instance.hasName.append(bes.name)
   
    onto.save()


Just to summarise, I load an existing ontology named ABC.  I load another ontology "test_onot", which is almost empty. Every time I open the empty file, add ABC and instantiate classes, owlready keeps adding classes rather than just making two connection as in the above example.

Anything I am doing wrong?