Add subclasses into an ontology
Posted by EL_ABBA on
URL: http://owlready.306.s1.nabble.com/Add-subclasses-into-an-ontology-tp3016.html
Hello,
I have designed an ontology and now i want to load the ontology via python and assign new subclasses into exsiting classes.
I am able to load the ontology and add a new classes with the following code:
from owlready2 import *
import types
onto_world = owlready2.World()
onto = onto_world.get_ontology()
onto = onto.load()
with onto:
class Plasmid(Thing) : pass
But I get the error >NameError: name '' is not defined< when trying to add a new subclass into an existing class. It only works by adding the class into "Thing" and than add subclasses into e.g. "Plasmid".
I was able to print all the class names and thought I could just copy them from the console, but it just doesn't work and I don't know how too fix the error.
Perhaps someone can help me?
Thanks a lot and happy holidays!