0

我正在尝试使用 owlready 库在 Pizza_onto 的本体中创建一个名为 Pizza 的类。但我收到以下错误。原因是什么?

Owlready 代码:(pizza.py)

from owlready2 import *
onto_path.append("C:/Users/BAUM-PC/Desktop/izmir/pizza_onto.owl")
onto = get_ontology("C:/Users/BAUM-PC/Desktop/izmir/pizza_onto.owl")
onto.load()

with onto:
    class NonVegetarianPizza(onto.Pizza):
        equivalent_to = [
            onto.Pizza
            & ( onto.has_topping.some(onto.MeatTopping)
            | onto.has_topping.some(onto.FishTopping)
            ) ]
        def eat(self): print("Beurk! I'm vegetarian!")

错误:

* Owlready2 * Warning: optimized Cython parser module 'owlready2_optimized' is not available, defaulting to slower Python implementation
Traceback (most recent call last):
  File "c:/Users/BAUM-PC/Desktop/izmir/pizza.py", line 7, in <module>
    class NonVegetarianPizza(onto.Pizza):
  File "c:/Users/BAUM-PC/Desktop/izmir/pizza.py", line 10, in NonVegetarianPizza
    & ( onto.has_topping.some(onto.MeatTopping)
AttributeError: 'NoneType' object has no attribute 'some'

4

0 回答 0