【问题标题】:Infer Anonymous class in Protege with the Rules Tab使用规则选项卡推断 Protege 中的匿名类
【发布时间】:2021-09-08 10:09:47
【问题描述】:

我想为我的 Protege 中的个人推断一个匿名类定义。

我有一个简单的本体,其类Rain NoRain and Scene,对象属性has_weather。 我的愿望是能够推断出我在“规则”选项卡中写的“has_weather(?x, ?noRain), NoRain(?noRain), Scene(?x) -> (has_weather exactly 0 Rain)(?x)”,我可以在其中混合 SWRL 和 OWL 表达式。

我正在使用 Pellet Reasoner,但我也尝试过使用 OnTop 和 Hermit,但没有任何效果。例如,如果我以相反的方式执行规则:

`has_weather(?x, ?noRain), (has_weather exactly 0 Rain)(?x), Scene(?x) -> Test(?x)`

它可以正常工作。

问题是 Protege 无法推断匿名类吗?有什么解决方法吗?提前谢谢你!

这是本体的代码

<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather -->

<owl:ObjectProperty rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather">
    <rdfs:subPropertyOf rdf:resource="http://www.w3.org/2002/07/owl#topObjectProperty"/>
</owl:ObjectProperty>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
    <owl:disjointWith rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
</owl:Class>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->

<owl:Class rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
 -->




<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain -->

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain">
    <rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>



<!-- http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene -->

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene">
    <rdf:type rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
    <has_weather rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
</owl:NamedIndividual>



<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// Rules
//
///////////////////////////////////////////////////////////////////////////////////////
 -->

<rdf:Description rdf:about="urn:swrl:var#x">
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description rdf:about="urn:swrl:var#noRain">
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Variable"/>
</rdf:Description>
<rdf:Description>
    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#Imp"/>
    <swrl:body>
        <rdf:Description>
            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
            <rdf:first>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#IndividualPropertyAtom"/>
                    <swrl:propertyPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                    <swrl:argument2 rdf:resource="urn:swrl:var#noRain"/>
                </rdf:Description>
            </rdf:first>
            <rdf:rest>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
                    <rdf:first>
                        <rdf:Description>
                            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                            <swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#NoRain"/>
                            <swrl:argument1 rdf:resource="urn:swrl:var#noRain"/>
                        </rdf:Description>
                    </rdf:first>
                    <rdf:rest>
                        <rdf:Description>
                            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
                            <rdf:first>
                                <rdf:Description>
                                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                                    <swrl:classPredicate rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Scene"/>
                                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                                </rdf:Description>
                            </rdf:first>
                            <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
                        </rdf:Description>
                    </rdf:rest>
                </rdf:Description>
            </rdf:rest>
        </rdf:Description>
    </swrl:body>
    <swrl:head>
        <rdf:Description>
            <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#AtomList"/>
            <rdf:first>
                <rdf:Description>
                    <rdf:type rdf:resource="http://www.w3.org/2003/11/swrl#ClassAtom"/>
                    <swrl:classPredicate>
                        <owl:Restriction>
                            <owl:onProperty rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#has_weather"/>
                            <owl:qualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:qualifiedCardinality>
                            <owl:onClass rdf:resource="http://www.semanticweb.org/stefi/ontologies/2021/8/8/untitled-ontology-55#Rain"/>
                        </owl:Restriction>
                    </swrl:classPredicate>
                    <swrl:argument1 rdf:resource="urn:swrl:var#x"/>
                </rdf:Description>
            </rdf:first>
            <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
        </rdf:Description>
    </swrl:head>
</rdf:Description>

`

【问题讨论】:

  • 你确定你的第二条规则有效吗?
  • 除此之外,这是不可能的,因为 OWL 推理器可以推断出无限复杂的类表达式,例如 AA and AA and A and A、... - 所以没有工具可以为您提供所有理论上可能的类表达式。事实上,总是反过来,即询问个人是否属于A and A and A ...,在这种情况下它可以返回true
  • 嘿!是的,我测试了它,它有效,当我明确地说它有一个个体时(has_weather 正好为 0 雨),否则它没有。但是,如果我告诉推理器推断 NoRainScene,它也可以工作,它的定义就像提到的表达式一样。例如,我之前尝试过的只是与对象属性没有关系,但由于开放世界假设,这不起作用,我认为
  • 啊,好的。是的,如果你将类表达式直接添加到它当然可以工作的个人,否则它不会因为 OWA - 这适用于许多事情,否定,最大基数等。

标签: ontology rules protege swrl reasoner


【解决方案1】:

一般来说,一组公理有无限多的蕴涵。参见例如this paper。出于这个原因,推理器将推理限制在已知类(而不是匿名类)。我怀疑这也适用于规则。

因此,我建议您添加一个设置为等效于 has_weather 0 Rain 的类 NoRain,并更改您的 SWRL 规则以使用类 NoRain

【讨论】:

  • 嘿!谢谢,我也想这样做,但我希望以某种方式避免创建很多新类,因为我正在构建的本体非常大。不过,感谢您的建议,我想这就是这样做的方法。顺便说一句,它也可以在前件中使用匿名表达式,但是如果我仍然定义了类,那么使用匿名表达式可能没有意义。
猜你喜欢
  • 1970-01-01
  • 2012-09-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多