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

问题描述 投票:4回答:2

我使用Protege在OWL中添加了一些新的DataType。

DataType就像百分比,我想指定它的范围,双精度值范围从0到100。

类似地,一个名为Quality的DataType,我想指定它的范围,其double值范围从0到1。

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

我试图找出,但我找到了两个链接但在我的上下文中没用。

  1. How to Define My Own Ranges for OWL DataProperties如果我们手动创建OWL文件而不使用Protege,这将非常有用。
  2. http://answers.semanticweb.com/questions/16541/datatype-property-protege当我们没有添加新数据类型的选项时,这与上下文有关。

请帮助如何在Protege中为这些场景编写数据范围表达式

场景:

rdf semantic-web owl protege custom-data-type
2个回答
7
投票

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

<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:owl="http://www.w3.org/2002/07/owl#"
    xmlns="http://stackoverflow.com/q/24531940/1281433/percentages#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <owl:Ontology rdf:about="http://stackoverflow.com/q/24531940/1281433/percentages"/>
  <owl:DatatypeProperty rdf:about="http://stackoverflow.com/q/24531940/1281433/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 :      <http://stackoverflow.com/q/24531940/1281433/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 ] )
                    ] .

<http://stackoverflow.com/q/24531940/1281433/percentages>
        a       owl:Ontology .

0
投票

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

{"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}
© www.soinside.com 2019 - 2024. All rights reserved.