【问题标题】:How to add a superclass to a class with owlready python?如何使用 owlready python 将超类添加到类中?
【发布时间】:2019-03-08 10:07:40
【问题描述】:

我正在使用 owlready 来丰富具有属性限制的本体。正如我们在 owlready 文档中看到的那样,可以对属性 https://owlready2.readthedocs.io/en/latest/restriction.html#restrictions-on-a-property 定义限制。作者仅解释了如何定义等效于限制的类,如下图所示。

class equivalent to a restriction

我想为现有的 owlready 类添加一个限制(我想用 subClass_of 替换等价物)。可能吗?我该怎么做?

谢谢

【问题讨论】:

    标签: python ontology restriction owlready


    【解决方案1】:

    我从 owlready2 的开发者 @Jean-Baptiste 那里得到了答案

    可以使用以下语法将超类添加到现有类:

       Class.is_a.append(SuperClass).
    

    超类可以是类或属性限制,例如

       Classe.is_a.append(property.some(Value))
    

    【讨论】:

      猜你喜欢
      • 2014-01-10
      • 2016-03-08
      • 2012-11-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-15
      • 1970-01-01
      相关资源
      最近更新 更多