当前位置: 首页 > 知识库问答 >
问题:

使用规则选项卡推断Protege中的匿名类

万高畅
2023-03-14

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

我正在使用Pellet Reasner,但是我也尝试了OnTop和Hermit,但都不起作用。例如,如果我以相反的方式执行规则:

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

它毫无问题地工作。

问题是,这个学生不能推断匿名类吗?有什么解决办法吗?提前谢谢你!

下面是本体的代码

<!-- 
///////////////////////////////////////////////////////////////////////////////////////
//
// 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>

`

共有1个答案

申屠健
2023-03-14

一般来说,一组公理有无穷多的蕴涵。例如,参见本文。因此,推理机将推理限制在已知类(而不是匿名类)上。我怀疑规则也是如此。

因此,我建议您添加一个类NoRain,您将其设置为等同于has_weather0 Rain,并将SWRL规则更改为使用类NoRain

 类似资料:
  • 这种传递性关系在Protege中非常有效。我用黄色可以看出A类相当于C类,反之亦然。 我想从Protege工具导出这个推断的公理。我转到“文件->导出推断公理为本体”,在第一个屏幕上选择所有选项,在第二个屏幕上不选择任何选项。最后,我以RDF/XML语法将文件保存为OWL。 现在当我打开这个新文件时,我没有看到任何关于推断公理的三元组,即A类等同于C类,事实上,它与我最初的本体论是完全相同的本体论

  • 假设OWL本体论包含以下SWRL规则: 和以下对象属性断言: 当我运行的隐士推理器中的蛋白质,我得到以下推断对象属性断言: 然而,当我用owlready2加载同一个本体并运行它的hermitreasoner时,我没有得到任何推断的对象属性断言。例如: 不返回任何属性。 我确实以RDFXML格式保存了本体,并且可以使用owlready2检索SWRL规则。 owlready2推理器不支持这种推论吗?

  • 我刚刚切换到使用Xcode 5。我去更改了我的应用程序的名称和一些我需要更改的其他设置,但是当我这样做时,我注意到我的“常规”选项卡丢失了。有人知道为什么会发生这种事吗?

  • 我正试图缩小如何连接或组合两个不同标签中的相关数据的范围,这两个标签存在于一个谷歌工作表中。 表1:用户组 表2集团回购 我需要快速了解的是,安娜有权获得哪些回购协议? 从这个示例中看,我发现Ana可以访问repos代码、脚本、web和表单,因为她属于蓝色和红色组。Sue只能使用回购协议脚本和工具,因为她只是Green集团的一员。但我面前的实际数据是每个选项卡有几百行。 我已经做了一些网络搜索,并

  • 我对tabView有问题。第一个选项卡应始终显示相同的内容(称为搜索模板,用#{not curSearch.isClosable()}标识)。所有其他选项卡都是搜索实例(用#{curSearch.isClosable()}标识) 代码如下: 不幸的是,在第一个选项卡上有一些被称为curSearch对象的方法,这些方法仅在第二个选项卡和后面的选项卡上使用。如果我不使用ui:insert,它不会改变任

  • 选择器使用规则 1. 可以使用 * 通用选择器。 * 通用选择器效率低是一个误区,如有必要可以使用。测试文章关于css通配符性能问题不完全测试 例如: * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } 2. 不要在选择器末尾使用 * 通用选择器。 CSS