簡體   English   中英

Protege中的推理機無法使用限制/基數

[英]Reasoner in Protege not working with Restrictions/Cardinalities

我目前正在構建/修改更大的本體。 由於我在定義限制方面遇到問題,因此我舉了一個非常簡短的示例:我將EuropeanCountry作為一個類,將IslandCountry作為一個類:

<owl:Class rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#EuropeanCountry">
    <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Country"/>
</owl:Class>



<!-- http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#IslandCountry -->

<owl:Class rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#IslandCountry">
    <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Country"/>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#borders"/>
            <owl:maxQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">0</owl:maxQualifiedCardinality>
            <owl:onClass rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#EuropeanCountry"/>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>

如您所見,我在Protege中設置了“ maxQualifiedCardinality”限制。 如果我創建了一些個人,並且(C1,C2和德國是EuropeanCountry,Island是IslandCountry),並將它們與border屬性相關聯:

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Island">
    <rdf:type rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#IslandCountry"/>
    <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C1"/>
    <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C2"/>
    <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Germany"/>
</owl:NamedIndividual>

我收到隱士推理機拋出的錯誤,不允許將3個鄰居設置為Island。 如果我現在換線

<owl:maxQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:maxQualifiedCardinality>

基數1如果按示例所示設置三個鄰居,則不會出現任何錯誤。 誰能解釋這個問題,並希望為我提供一個解決方案,讓我如何編寫一個類應具有x個其他類的限制(在這種情況下,如何寫出Island應該有2個鄰居,而第三個應由推理機拋出錯誤)?

感謝您的幫助和問候,

Tanktoo

編輯:我現在將所有個人添加到AllDifferent:

<rdf:Description>
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#AllDifferent"/>
    <owl:distinctMembers rdf:parseType="Collection">
        <rdf:Description rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C1"/>
        <rdf:Description rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C2"/>
        <rdf:Description rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Germany"/>
    </owl:distinctMembers>
</rdf:Description>

現在它正在使用上面的限制,並且推理機告訴我,由於maxCardinality為1,所以我不允許設置3個邊界國家。我現在將限制更改為以下內容:

<owl:Class rdf:about="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#IslandCountry">
    <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Country"/>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#borders"/>
            <owl:minQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minQualifiedCardinality>
            <owl:onClass rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#EuropeanCountry"/>
        </owl:Restriction>
    </rdfs:subClassOf>
    <rdfs:subClassOf>
        <owl:Restriction>
            <owl:onProperty rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#borders"/>
            <owl:maxQualifiedCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:maxQualifiedCardinality>
            <owl:onClass rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#EuropeanCountry"/>
        </owl:Restriction>
    </rdfs:subClassOf>
</owl:Class>

我現在希望,如果我設置的鄰居少於1個或大於2個,則推理機會檢測到錯誤:

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/tanktoo
/ontologies/2016/10/untitled-ontology-81#Island">
        <rdf:type rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#IslandCountry"/>
        <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C1"/>
        <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#C2"/>
        <borders rdf:resource="http://www.semanticweb.org/tanktoo/ontologies/2016/10/untitled-ontology-81#Germany"/>
    </owl:NamedIndividual>

在這種情況下,推理者會發現一個錯誤,因為有3個鄰居。 如果現在刪除所有鄰居,以使島嶼邊界為0個國家,則推理機不會給我錯誤。 有人可以解釋我為什么嗎?

謝謝你的幫助 :)

我收到隱士推理機拋出的錯誤,不允許將3個鄰居設置為Island

如果這就是工具所說的話,那就是一個錯誤。 當然,您將給出3個毗鄰國家的名稱。 但是沒有人說這是3個不同國家的名字。 它們可能是同一個國家的多個名稱,例如“法國”,“法蘭西共和國”,“法國共和國”。

由於推理機無法知道它們是否是同一事物的名稱,因此在第二種情況下它無法檢測到不一致之處。 但是,在第一種情況下,至少為某事物指定名稱意味着嚴格存在的事物不止零,因此檢測到不一致是有意義的。

如果您想確保推理機能夠檢測到一個國家有兩個以上的鄰居,那么您必須明確地說出這些國家是不同的:

ex:C1  owl:differentFrom  ex:C2, ex:Germany .
ex:C2  owl:differentFrom  ex:Germany .

要么:

[]  a  owl:AllDifferent;
    owl:members  ( ex:C1 ex:C2 ex:Germany ) .

在Protégé的“個人”選項卡中,您可以指定個人的不同之處。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM