Re: ShEx relation to SPIN/OWL


Thx. I agree that the example SPIN syntax is high-level enough, like OWL 
or RDFS. However, given a common, high-level constraint, we need a 
standard name and definition for it so other tools don't have to 
understand SPARQL. SPIN can give it a semantics in terms of SPARQL.

There is one aspect of SPIN that I believe is a problem. You wrote:

This information "belongs" into the 
ontology together with the class and property definitions, and should be 
shared as such.

That agrees with my understanding of SPIN, but I think it's a problem. I 
agree that in some cases you do want to associate constraints with a class 
and in that case the constraints should be part of the ontology. However, 
there are other use cases where we design RDF documents using existing 
vocabularies. There are many vocabularies in common use and it is a best 
practice to reuse their terms instead of defining new synonyms. For 
example, Dublin Core is widely reused and has very few constraints. In 
fact, the fewer constraints in a vocabulary, the more reusable it is. You 
might want to constrain how Dublin Core is used in a particular case. 

Consider the case where you define a REST service that accepts RDF 
requests, and the documents use terms from several existing vocabularies. 
We need a way to describe the document and the constraints it must 
satisfy. For example, the REST service may require that the document 
contains exactly one dcterms:title property. Of course, the constraints 
must be compatible with the existing vocabularies, i.e. the constraints 
must not change the semantics of any term. Furthermore, the constraints 
may vary depending on the REST operation.

We need to decouple the constraint language from the ontology or 
vocabulary. There is an analogy with natural language. In natural 
languages, a dictionary defines the meaning of terms and a grammar says 
how the terms may be combined into text. In RDF, a vocabulary or ontology 
is like a dictionary, and a shape language is like a grammar. We can't put 
everything in the ontology.

Arthur Ryman, PhD

Chief Data Officer, Rational
Chief Architect, Portfolio & Strategy Management
Distinguished Engineer | Master Inventor | Academy of Technology

Toronto Lab | +1-905-413-3077 (office) | +1-416-939-5063 (mobile)

From:   Holger Knublauch <>
Date:   07/07/2014 01:02 AM
Subject:        Re: ShEx relation to SPIN/OWL

On 7/4/2014 0:58, Arthur Ryman wrote:
> Ideally, we'd have a high-level, human-friendly language for 
> RDF and it would be easily translatable to SPARQL to make its semantics
> clear and to give us a standard way to automatically check the
> constraints. The high-level language should have an RDF representation,
> but could also have other serializations that are easier to author. 
> Turtle is easy to author, but other syntaxes could be more compact. A
> complete solution would also provide a way to drop down into SPARQL 
> so you can describe arbitrary constraints.
I agree, and believe SPIN ticks most of these boxes already. When you 
instantiate SPIN templates you basically end up with the same syntax as 
the RDF representation of ShEX. And assuming that a standard library of 
templates exists (including templates to represent cardinality and other 
frequently needed concepts) then SPIN is also a *declarative* model that 
can be queried without even knowing SPARQL. The declarative triples of 
the SPIN template calls can be queried just like any other ontological 
data to drive user interfaces (selection of widgets) etc.

Just to re-iterate here is how an example SPIN template call looks like 
in Turtle

   spin:constraint [
       rdf:type spl:ObjectCountPropertyConstraint ;
       arg:maxCount 1 ;
       arg:property :reportedBy ;
     ] ;

It would be trivial to define a template just for that use case, and 
reformat it so that it becomes

   spin:constraint [ a ex:Maximum-one ;  ex:property :reportedBy  ] ;

which is hopefully easy enough to edit. In the snippet above, 
ex:Exactly-one would be a SPIN template that defines the actual SPARQL 
query to execute via spin:body. I believe this mechanism combines the 
flexibility of SPARQL with the simple declarative syntax of RDF triples. 
SPIN is self-describing and therefore extensible to any constraint 
patterns needed in the future, and it grows with the evolution and 
adoption of SPARQL.

I do wonder what this working group would do if SPIN had already been a 
W3C standard (and not just a member submission). Would this have changed 

FWIW I would strongly recommend to encourage an RDF-based representation 
over yet another custom syntax. This information "belongs" into the 
ontology together with the class and property definitions, and should be 
shared as such. Other languages also require new parsers and just add up 
to the learning curve. A good example of what *not* to do with a W3C 
standard has been the OWL/XML syntax introduced in OWL 2 - it only leads 
to fragmentation and additional implementation costs (even Jena doesn't 
support OWL/XML).


Received on Monday, 7 July 2014 12:45:44 UTC