W3C home > Mailing lists > Public > public-bioschemas@w3.org > December 2017

Re: ShEX vs JSON schema

From: Sy Mohameth François <mohameth.sy@epfl.ch>
Date: Wed, 13 Dec 2017 18:54:57 +0000
To: "public-bioschemas@w3.org" <public-bioschemas@w3.org>
Message-ID: <5E27DD43-5C62-434A-A221-EA2BC4A75FEC@epfl.ch>
Dear all,

SHACL and ShEx definitely outclass JSON schema when it comes to validate RDF data as they allow to validate beyond a json structure and simple types. Now they come with more complexity (especially the impact of inference when validating) and possible performance issues during validation.

There are lot of commonalities and many (non trivial) differences between SHACL and ShEx as explained in the excellent slides from Jose Emilio Labra Gayo: https://fr.slideshare.net/jelabra/shex-vs-shacl.


common features:

  *   offer a mechanism to describe and validate RDF data using sort of high level language
  *   notion of shapes,
  *   ability to define node constraints or property constraints (on a node incoming or outgoing properties),
  *   cardinality constraints for property values
  *   constraints combination through logical operators: and, or, not, | (for oneOf in ShEx), xone (for exactly one in SHACL)
  *   both can be serialized using RDF syntax

differences:

  *   some obvious syntactic differences
  *   not the same design philosophy in term of validation: schema or grammar for ShEx VS constraints for SHACL
  *   the way validation is triggered
  *   not the same interaction with inference

From my experience in writing schemas for neuroscience related entities, I would say that SHACL is easier to understand and to use for people familiar with the RDF syntax and with SPARQL (which is my case). Also, SHACL looks more mature in term of documentation and tooling which is great for such a young W3C Recommendation (July 2017).
There are some validators available:


  *   shaclex (https://github.com/labra/shaclex): supports both SHACL Core and ShEx  and is written is Scala. I used it a lot and it works quite well.
  *   TopQuadrant/shacl (https://github.com/TopQuadrant/shacl): fully supports SHACL (Core and advanced features). It is written in Java.
  *   pfps/shacl (https://github.com/pfps/shacl): looks like a SHACL validator but I never tried it. It is written in python


Cheers
MFSY




From: Franck Michel <franck.michel@cnrs.fr>
Date: Wednesday, 13 December 2017 at 16:53
To: "public-bioschemas@w3.org" <public-bioschemas@w3.org>
Subject: Re: ShEX vs JSON schema
Resent-From: <public-bioschemas@w3.org>
Resent-Date: Wednesday, 13 December 2017 at 16:52

Dear all,

I agree that ShEx or SHACL are preferable to JSON schema: JSON schema obviously applies only to JSON, whereas we would rather have a mechanism that applies to RDF in general, whatever the serialization syntax.

As to the choice between ShEx and SHACL, I must admit I'm puzzled. Does any of you have a pointer to a comparison, their respective B's and C's, application fields etc.? A quick lookup did not bring much, and at this point I just feel like they are competitors. I assume/hope there is more than that.

Regards,
   Franck.
Le 13/12/2017 à 11:00, Gray, Alasdair J G a écrit :
Dear All,

Leyla, thanks for kicking of this conversation on the list. It is something that I have discussed with several people in face-to-face conversations.
On 12 Dec 2017, at 17:41, Leyla Garcia <ljgarcia@ebi.ac.uk<mailto:ljgarcia@ebi.ac.uk>> wrote:

Any thoughts on using ShEX [1] or SHACL [2] rather than JSON schema [3] for validation purposes?

ShEx and SHACL are both more expressive than JSON schema, and better capture the validation needs of the Bioschemas profiles. In particular, they allow for the capture of relationships between entities and also restrictions on the vocabulary terms used.

Between ShEx and SHACL it is a closer run thing and we are doing some experimentation with both. ShEx has a more concise notation than SHACL and I understand that it has more expressive power. However, the SHACL libraries and documentation are more professionally put together and of course it has the endorsement of the W3C working group.

There will be an ELIXIR implementation study in 2018 that has a focus on validation so hopefully some of these issues can be investigated in that.

Best regards

Alasdair

Alasdair J G Gray
Fellow of the Higher Education Academy
Assistant Professor in Computer Science,
School of Mathematical and Computer Sciences
(Athena SWAN Bronze Award)
Heriot-Watt University, Edinburgh UK.

Email: A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>
Web: http://www.macs.hw.ac.uk/~ajg33<http://www.macs.hw.ac.uk/%7Eajg33>
ORCID: http://orcid.org/0000-0002-5711-4872

Office: Earl Mountbatten Building 1.39
Twitter: @gray_alasdair









________________________________

Heriot-Watt University is The Times & The Sunday Times International University of the Year 2018

Founded in 1821, Heriot-Watt is a leader in ideas and solutions. With campuses and students across the entire globe we span the world, delivering innovation and educational excellence in business, engineering, design and the physical, social and life sciences.

This email is generated from the Heriot-Watt University Group, which includes:

  1.  Heriot-Watt University, a Scottish charity registered under number SC000278
  2.  Edinburgh Business School a Charity Registered in Scotland, SC026900. Edinburgh Business School is a company limited by guarantee, registered in Scotland with registered number SC173556 and registered office at Heriot-Watt University Finance Office, Riccarton, Currie, Midlothian, EH14 4AS
  3.  Heriot- Watt Services Limited (Oriam), Scotland's national performance centre for sport. Heriot-Watt Services Limited is a private limited company registered is Scotland with registered number SC271030 and registered office at Research & Enterprise Services Heriot-Watt University, Riccarton, Edinburgh, EH14 4AS.

The contents (including any attachments) are confidential. If you are not the intended recipient of this e-mail, any disclosure, copying, distribution or use of its contents is strictly prohibited, and you should please notify the sender immediately and then delete it (including any attachments) from your system.


Received on Wednesday, 13 December 2017 19:30:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 13 December 2017 19:30:19 UTC