W3C home > Mailing lists > Public > public-data-shapes-wg@w3.org > April 2016

Re: ISSUE-141: Proposal for sh:type

From: Holger Knublauch <holger@topquadrant.com>
Date: Fri, 29 Apr 2016 19:12:49 +1000
Message-Id: <C68C1EEE-520B-4ECD-99C4-E61C36059E2F@topquadrant.com>
Cc: "public-data-shapes-wg@w3.org" <public-data-shapes-wg@w3.org>
To: "Peter F. Patel-Schneider" <pfpschneider@gmail.com>
Such as?

Sent from my iPad

> On 29 Apr 2016, at 5:50 PM, Peter F. Patel-Schneider <pfpschneider@gmail.com> wrote:
> 
> Why not use instead a formulation that does not depend on whether the type is
> a datatype?
> 
> peter
> 
> 
>> On 04/28/2016 08:17 PM, Holger Knublauch wrote:
>> Here is a proposal to replace sh:datatype and sh:class with sh:type,
>> implemented with the following semantics:
>> 
>> sh:TypeConstraintComponent
>>  a sh:ConstraintComponent ;
>>  sh:parameter [
>>      sh:predicate sh:type ;
>>    ] ;
>>  sh:context sh:InversePropertyConstraint ;
>>  sh:context sh:NodeConstraint ;
>>  sh:context sh:PropertyConstraint ;
>>  sh:inversePropertyValidator dash:hasType ;
>>  sh:nodeValidator dash:hasType ;
>>  sh:propertyValidator dash:hasType ;
>> .
>> 
>> dash:hasType
>>  a sh:SPARQLAskValidator ;
>>  sh:sparql """
>>        ASK {
>>            FILTER IF(dash:isDatatype($type),
>>                datatype($value) = $type,
>>                EXISTS { $value rdf:type/rdfs:subClassOf* $type })
>>        } """ ;
>> .
>> 
>> dash:isDatatype
>>  a sh:SPARQLFunction ;
>>  sh:parameter [
>>      sh:predicate sh:type ;
>>    ] ;
>>  sh:returnType xsd:boolean ;
>>  sh:sparql "ASK { FILTER (EXISTS { $type a rdfs:Datatype } ||
>> dash:isSystemDatatype($type)) }" ;
>> .
>> 
>> dash:isSystemDatatype
>>  a sh:SPARQLFunction ;
>>  sh:parameter [
>>      sh:predicate sh:type ;
>>    ] ;
>>  sh:returnType xsd:boolean ;
>>  sh:sparql "ASK { FILTER ($type IN (xsd:string, xsd:integer, xsd:date, ...))
>> }" ;
>> .
>> 
>> The definition above uses helper SHACL functions, but these can of course be
>> in-lined for the official document. The definition of such functions has the
>> benefit that the logic to determine whether something is a datatype or not can
>> be reused.
>> 
>> The enumeration in isSystemDatatype would be extended with the other RDF 1.1
>> datatypes including rdf:langString and rdf:HTML.
>> 
>> Open questions include whether the rdf:type rdfs:Datatype triple needs to be
>> in the shapes graph and whether we need to support subclasses of
>> rdfs:Datatype. I have no strong opinions, and changing this would be trivial.
>> 
>> This would close ISSUE-141 for me, assuming we add a corresponding sh:typeIn.
>> 
>> Holger
>> 
>> 
Received on Friday, 29 April 2016 09:13:23 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:30:31 UTC