Defining DataRange Expression in Protege for a Data Type Property
Asked Answered
A

2

12

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.

Similarly a DataType named Quality and I want to specify it's range with the double value ranging from 0 to 1.

How can we specify these things in the Data range Expression ?

I tried to find out but I found two links but not useful in my context.

  1. How to Define My Own Ranges for OWL DataProperties This is useful if we are manually creating the OWL file and not using Protege.

  2. http://answers.semanticweb.com/questions/16541/datatype-property-protege This is related to the context when we don't have the option of adding the new data type.

Please help how to write the Data range expression for these scenario in Protege

Scenario: enter image description here

Asturias answered 2/7, 2014 at 13:8 Comment(0)
P
15

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="https://mcmap.net/q/927370/-defining-datarange-expression-in-protege-for-a-data-type-property/1281433/percentages#"
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
  <owl:Ontology rdf:about="https://mcmap.net/q/927370/-defining-datarange-expression-in-protege-for-a-data-type-property/1281433/percentages"/>
  <owl:DatatypeProperty rdf:about="https://mcmap.net/q/927370/-defining-datarange-expression-in-protege-for-a-data-type-property/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 :      <https://mcmap.net/q/927370/-defining-datarange-expression-in-protege-for-a-data-type-property/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 ] )
                    ] .

<https://mcmap.net/q/927370/-defining-datarange-expression-in-protege-for-a-data-type-property/1281433/percentages>
        a       owl:Ontology .
Pitiful answered 2/7, 2014 at 14:51 Comment(9)
Though it's not a part of this question, If we are defining any data object as the type of cutom data type can be also validate it against the range we have given ?Asturias
The datatype is actually the double but the minInclusive and maxInclusive are having datatype as the integer. Shouldn't there should be double also ? Do we need to define like double [>=0.00, <=100.00] ?Asturias
Oh, that's a good point. I'm not sure how the conversion from ints to doubles is done. It's probably safer to use double[>= 0.0, <= 0.0]. Some reasoners will do datatype reasoning. E.g., Pellet would say it's inconsistent if you declare x hasPercentage 101.0.Pitiful
Though it works for me, Actually the question was about adding the data type but you have add the example for the Data property.Asturias
I'm not sure exactly what you mean. The way to represent a data range is something like double[>= 0, <= 100]. That's the same whether you're using it in a class restriction, or as a property range, or anywhere else. You said that you "want to specify … range with [a] double value ranging from 0 to 100." The only things that have ranges are properties.Pitiful
Actually I am adding new data type like double, ints and in the Datatype definition I am defining the Range for that data type. There is option of specifying Data Type Range expression.Asturias
I don't know what you mean. Datatypes don't have ranges; they are ranges. double[...] is a datatype like double, but with a smaller set of permissible values.Pitiful
I have edited the answer and added the image which explain what I actually want to say.Asturias
@Asturias Ah, I see. I didn't realize that Protege lets you define datatypes like that. That's handy, though I don't know whether reasoners will recognize the custom datatypes (even if they recognize the faceted datatypes), so use caution and test early!Pitiful
C
3

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}
Costa answered 3/3, 2018 at 7:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.