2014-07-02 38 views
3

我使用Protege在OWL中添加了一些新的DataType。在数据类型属性的Protege中定义DataRange表达式

数据类型就像是个和我想指定它的范围与双值范围从0到100

同样名为质量数据类型,我想指定它的范围与双值范围为0〜 1.

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

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

  1. How to Define My Own Ranges for OWL DataProperties如果我们手动创建OWL文件,而不是使用门生这是非常有用的。

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

请帮忙如何编写这些场景的数据范围的表达门徒

场景: enter image description here

回答

7

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

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="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

尽管这不是这个问题的一部分,如果我们定义的任何数据对象作为对自定义数据类型的类型,也可对其进行验证,我们有范围给定? – Gaurav

+0

数据类型实际上是double,但minInclusive和maxInclusive的数据类型是整数。不应该有两倍?我们是否需要像double [> = 0.00,<= 100.00]一样定义? – Gaurav

+0

哦,这是一个很好的观点。我不知道如何完成从整数到双打的转换。使用'double [> = 0.0,<= 0.0]'可能更安全。一些reasoners会做数据类型推理。例如,如果你声明'x hasPercentage 101.0',Pellet会说它不一致。 –

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} 
相关问题