W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > July 2014

OSLC Resource Shapes implemented with SPIN

From: Holger Knublauch <holger@topquadrant.com>
Date: Fri, 25 Jul 2014 16:49:27 +1000
Message-ID: <53D1FDF7.7040304@topquadrant.com>
To: "public-rdf-shapes@w3.org" <public-rdf-shapes@w3.org>
CC: ryman@ca.ibm.com
Dear RDF Shapes list,

as a proof-of-concept, I have taken the OSLC Resource Shapes submission 
[1] and implemented it using SPIN. I believe this demonstrates nicely 
that SPIN and Resource Shapes are *complementary* technologies, and that 
Shapes can be implemented as one "instance" of the SPIN constraint 
language. This combines the beauty of a high-level vocabulary with the 
flexibility of a SPARQL-based fall-back mechanism. It works today, and 
the Shapes have proper executable semantics.

The actual OSLC vocabulary and its SPIN constraint templates can be 
found at [2]. I took the little bug database example from the spec and 
implemented it using two different approaches:


1) [3] is syntactically almost identical to the OSLC example from [5] 
(only that it uses spin:constraint instead of oslc:property). For this 
version I had to tweak the current SPIN engine a bit so that it also 
executes "inherited" spin:body queries. I plan to add this tweak to 
future SPIN API (and TopBraid) versions. Here is an example snippet in 
Turtle:

oslc_cm:ChangeRequest
   spin:constraint 
<http://example.com/shape/oslc-change-request#dcterms-title> ;
   spin:constraint 
<http://example.com/shape/oslc-change-request#oslc_cm-status> .

<http://example.com/shape/oslc-change-request#dcterms-title>
   rdf:type oslc:Property ;
   oslc:name "title"^^xsd:string ;
   oslc:occurs oslc:Exactly-one ;
   oslc:propertyDefinition dcterms:title .

<http://example.com/shape/oslc-change-request#oslc_cm-status>
   rdf:type oslc:Property ;
   oslc:allowedValues oslc_cm:status-allowed-values ;
   oslc:name "status"^^xsd:string ;
   oslc:occurs oslc:Zero-or-one ;
   oslc:propertyDefinition oslc_cm:status .


2) [4] is using individual bnode constraints instead of the "bundle" 
oslc:Property. You can load that version into the current SPIN API 
version, or into TopBraid Composer Free Edition 4.4. Navigate to 
<http://example.com/bugs/2> and press the "Display constraint violation 
warnings" button in the toolbar. It will display a small warning symbol 
with information on the actual violation. You can make edits and see the 
violations updated in real time. It "just works".



Other shape libraries beside the specific OSLC version can be 
implemented in a similar manner.

Regards,
Holger

[1] http://www.w3.org/Submission/2014/SUBM-shapes-20140211/
[2] http://knublauch.com/oslc/oslc.spin.ttl
[3] http://knublauch.com/oslc/oslc_cm1.ttl
[4] http://knublauch.com/oslc/oslc_cm2.ttl
[5] http://www.w3.org/Submission/2014/SUBM-shapes-20140211/#examples
Received on Friday, 25 July 2014 06:50:56 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:39 UTC