Defining DataRange Expression in Protege for a Data Type Property

后端 未结 2 1805
余生分开走
余生分开走 2021-02-08 12:52

I am adding few new DataType in the OWL using Protege.

The DataType is like percentage and I want to specify it\'s range with the double value ranging from 0 to 100.

相关标签:
2条回答
  • 2021-02-08 13:05

    This post might be helpful to those who would like to assign discrete integer (or any data type) values as the range of the data type property. Type the following code in the data range expression editor:

    {"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}
    
    0 讨论(0)
  • 2021-02-08 13:22

    It's just 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="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)
提交回复
热议问题