duplicate classes

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

duplicate classes

kawaminami
This post was updated on .
I been trying to add individuals to a class ontology, it works, but it creates me two classes, one with the info correctly and the other is empty, is there way that python just creates one class for ID?

from capec_parser import * #list of entities
from owlready2 import *

def main():
    entity_list = verify_and_open()
    onto = get_ontology("capec_ontology.owl#")
           
    with onto:
        class ID(Thing):pass
       
        for entity in entity_list:                    
            onto.ID(entity.get_ID())
           
if __name__ == "__main__":
    main()


Reply | Threaded
Open this post in threaded view
|

Re: duplicate classes

Jiba
Administrator
Hi,

It seems that you have two distinct ID classes. In Protege, you can put the mouse cursor on the class in the tree view to display its full IRI; they probably have two distinct IRI (otherwise it would be the same class).

I believe the problem is here :    onto = get_ontology("capec_ontology.owl#")
"capec_ontology.owl#" is not a proper IRI, because it is a relative URL. I think you need to replace it with the full IRI of that ontology.

Jiba
Reply | Threaded
Open this post in threaded view
|

Re: duplicate classes

kawaminami
Thank so much, it worked perfectly