Re: sh:minInclusive and custom datatypes

Hi Holger,

Thanks for answering. It was what I was expecting. 

I once worked in the ISO 15926 space and I remember how much work was put in to support various units of measure. Always made me wonder why there wasn’t an easy way to implement them using the datatype system in RDF with proper comparison support in SPARQL. Like being able to compare feet to inches to millimeters and so on, or Fahrenheit to Celsius to kelvin.  

Håvard

> On 1 Nov 2020, at 23:50, Holger Knublauch <holger@topquadrant.com> wrote:
> 
> 
> Hi Håvard,
> 
> yes this is how it is supposed to work, because sh:minInclusive (etc) rely on the SPARQL operators such as < and those operators don't support user-defined datatypes. The SHACL Playground has slightly incorrect handling of datatypes. I guess the best thing you could do is to define a SPARQL-based solution that does something like 
> 
>     FILTER (xsd:decimal(?value) < xsd:decimal($minInclusive))
> 
> Holger
> 
> 
> 
> On 11/1/2020 7:27 PM, Håvard Ottestad wrote:
>> Hi,
>> 
>> I’m wondering how to make sh:minInclusive work with custom datatypes.
>> 
>> Essentially I would like to achieve something like the following:
>> 
>> ex:measurementShape
>>        a sh:NodeShape ;
>>        sh:targetClass ex:Measurement ;
>>        sh:property [
>>               sh:path ex:temperature ;
>>                sh:minInclusive "0”^^unit:celsius ;
>>        ] .
>> 
>> And allow for data such as:
>> 
>> [] a ex:Measurement;
>>        ex:temperature "10”^^unit:celsius.
>> 
>> Currently this is leading to a validation error with the reference validator, unless the temperature is exactly 0.
>> 
>> I supposed this is how it is supposed to work! However it doesn’t lead to a validation error on https://shacl.org/playground/
>> 
>> Cheers,
>> Håvard

Received on Tuesday, 3 November 2020 09:15:56 UTC