我有以下代码(最小示例):
import owlready2 as owr
# create ontology in the default_world
onto0 = owr.get_ontology("https://w3id.org/yet/undefined/onto0#")
with onto0:
class Animal(owr.Thing):
pass
# create a new world for a new ontology
w1 = owr.World()
onto1 = w1.get_ontology("https://w3id.org/yet/undefined/onto1#")
with onto1:
class Plant(owr.Thing):
pass
print(list(owr.Thing.subclasses()))
导致[onto0.Animal]
. 换句话说,在新世界w1
中定义的类不被识别为 的子类Thing
,尽管被这样定义。
→ 那么,我怎样才能获得在非默认世界中定义的子类?