如何在Protege中使用类似于范围的类作为数据属性

时间:2013-03-04 09:38:03

标签: owl protege protege4

  • 我创建了一个名为 kind 数据属性
  • 我希望它的范围是 StateKing 。我不知道该怎么做。事实上,在“属性断言视图”“描述视图”中,当我点击'添加'图标时(+)下一个范围弹出显示指定数据类型,如int,Boolean,integer,...
  • 请注意, StateKing 枚举类

    StateKing 等效类 {choise,final,fork,initial,join,junction,state}。

感谢您的建议。

PS:我现在无法添加图片。

1 个答案:

答案 0 :(得分:2)

StateKing是一个类,所以如果你想让一个属性使用它作为范围,它需要是对象属性而不是数据属性。

以下代码是使用曼彻斯特语法表示的本体,如果将其保存为.owl,则可以使用Protege 4打开它。

<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY dc "http://purl.org/dc/elements/1.1/" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY xml "http://www.w3.org/XML/1998/namespace" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
]>

<rdf:RDF xmlns="http://www.example.org/demo.owl#"
 xml:base="http://www.example.org/demo.owl"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
 xmlns:owl="http://www.w3.org/2002/07/owl#"
 xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:xml="http://www.w3.org/XML/1998/namespace">
<owl:Ontology rdf:about="http://www.example.org/demo.owl"/>

<owl:ObjectProperty rdf:about="http://www.example.org/demo.owl#kind">
    <rdfs:range rdf:resource="http://www.example.org/demo.owl#StateKing"/>
</owl:ObjectProperty>

<owl:Class rdf:about="http://www.example.org/demo.owl#StateKing">
    <owl:equivalentClass>
        <owl:Class>
            <owl:oneOf rdf:parseType="Collection">
                <rdf:Description rdf:about="http://www.example.org/demo.owl#join"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#state"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#choise"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#final"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#initial"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#junction"/>
                <rdf:Description rdf:about="http://www.example.org/demo.owl#fork"/>
            </owl:oneOf>
        </owl:Class>
    </owl:equivalentClass>
</owl:Class>


<owl:Class rdf:about="&owl;Thing"/>

<owl:Thing rdf:about="http://www.example.org/demo.owl#choise">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#final">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#fork">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#initial">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#join">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#junction">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>

<owl:Thing rdf:about="http://www.example.org/demo.owl#state">
    <rdf:type rdf:resource="&owl;NamedIndividual"/>
</owl:Thing>
</rdf:RDF>