在Protege中为数据类型属性定义DataRange表达式

12

我正在使用Protege向OWL中添加一些新的数据类型。

这些数据类型像百分比,我想要用从0到100的double值来指定它们的范围。

同样,一个名为Quality的数据类型,我想用从0到1的double值来指定它的范围。

我们如何在数据范围表达式中指定这些内容?

我试图找到资料,但我找到了两个链接,但对我的情况没有用。

  1. 如何为OWL DataProperties定义自己的范围 如果我们手动创建OWL文件而不是使用Protege,则此链接很有用。

  2. http://answers.semanticweb.com/questions/16541/datatype-property-protege 这与我们没有添加新数据类型的选项的上下文相关。

请帮忙在Protege中编写这些场景的数据范围表达式:

场景: enter image description here

2个回答

15

它只是xsd:double[ >= 0, <= 100 ]

screenshot

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="https://dev59.com/jmAf5IYBdhLWcg3wizOu/percentages#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <owl:Ontology rdf:about="https://dev59.com/jmAf5IYBdhLWcg3wizOu/percentages"/>
  <owl:DatatypeProperty rdf:about="https://dev59.com/jmAf5IYBdhLWcg3wizOu/percentages#hasPercentage">
    <rdfs:range>
      <rdfs:Datatype>
        <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#double"/>
        <owl:withRestrictions rdf:parseType="Collection">
          <rdf:Description>
            <xsd:minInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
            >0</xsd:minInclusive>
          </rdf:Description>
          <rdf:Description>
            <xsd:maxInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer"
            >100</xsd:maxInclusive>
          </rdf:Description>
        </owl:withRestrictions>
      </rdfs:Datatype>
    </rdfs:range>
  </owl:DatatypeProperty>
</rdf:RDF>
@prefix :      <https://dev59.com/jmAf5IYBdhLWcg3wizOu/percentages#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .

:hasPercentage  a   owl:DatatypeProperty ;
        rdfs:range  [ a                     rdfs:Datatype ;
                      owl:onDatatype        xsd:double ;
                      owl:withRestrictions  ( [ xsd:minInclusive
                                        0 ] [ xsd:maxInclusive  100 ] )
                    ] .

<https://dev59.com/jmAf5IYBdhLWcg3wizOu/percentages>
        a       owl:Ontology .

我不确定你的意思。表示数据范围的方式类似于 double[>= 0, <= 100]。无论是在类限制中使用,还是作为属性范围或任何其他地方使用,都是一样的。你说你“想要指定……范围,其双精度值从0到100。”只有属性才有范围。 - Joshua Taylor
实际上,我正在添加新的数据类型,例如double、int,并在数据类型定义中为该数据类型定义范围。有指定数据类型范围表达式的选项。 - Gaurav
我不知道你的意思。数据类型没有范围,它们本身就是范围。double[...]是一种数据类型,类似于double,但其可允许的值集更小。 - Joshua Taylor
我已经编辑了答案并添加了图片,以解释我实际想要表达的内容。 - Gaurav
@Gaurav Ah,我明白了。我之前不知道Protege可以像那样定义数据类型。虽然这很方便,但我不确定推理器是否会识别自定义数据类型(即使它们识别分面数据类型),所以请小心使用并尽早进行测试! - Joshua Taylor
显示剩余4条评论

3

本文可能对那些想将离散整数(或任何数据类型)值分配为数据类型属性范围的人有所帮助。在数据范围表达式编辑器中输入以下代码:

{"0"^^xsd:int , "1"^^xsd:int , "10"^^xsd:int , "18"^^xsd:int , "2"^^xsd:int , "3"^^xsd:int , "4"^^xsd:int , "5"^^xsd:int , "6"^^xsd:int , "8"^^xsd:int}

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接