|
Here is a problem when creating new instances with python and pycharm:
The ontology is created with protege in the format of rdfxml, which can be successfully loaded.
>>onto_path = '../static/ontology/Assembly_Workshop_DT.owl'
>>onto = get_ontology(onto_path).load()
The classes in the ontology can be printed.
>>print(onto.Assembler)
>>print(onto.classes())
>>print(list(onto.classes()))
Assembly_Workshop_DT.Assembler
[Assembly_Workshop_DT.Staff, Assembly_Workshop_DT.Assembler, Assembly_Workshop_DT.Assembly_Resource, Assembly_Workshop_DT.Assembly_Workshop_DT, Assembly_Workshop_DT.Assembly_Task, Assembly_Workshop_DT.Inspector, Assembly_Workshop_DT.Personnel, Assembly_Workshop_DT.Process_designer, Assembly_Workshop_DT.Team]
However, instances can not be created with the error of "NameError: name 'Assembler' is not defined" when running code
>>Assembler0205 = Assembler("Assembler0205")
Seems like if the classes is created with Owlready, the instances can be added without a hitch.
I wonder what to do when creating instances of a existed class?
|