weso / shaclex

SHACL/ShEx implementation
http://weso.github.io/shaclex
MIT License
76 stars 17 forks source link

Convert ShEx to SHACL #114

Open labra opened 5 years ago

labra commented 5 years ago

Implement a converter between ShEx to SHACL.

The converter was already started although some features were not implemented. We will keep this issue open to keep track of the features implemented.

vemonet commented 3 years ago

Hi, is there any update on it?

Apparently SHACL can express the integrality of ShEx shapes: https://www.w3.org/2014/data-shapes/wiki/SHACL-ShEx-Comparison

What can be expressed in ShEx, but not in SHACL Core

  • SHACL Core doesn't define TotalDigits and FractionDigits constraint components. These can be defined using SHACL SPARQL or implemented using sh:pattern, sh:minLength etc.

So there is no point in continuing developing any ShEx validation tools, all that is needed is a conversion from ShEx to SHACL and then a performant SHACL validation (Ontotext GraphDB triplestore already implemented automated SHACL validation in their triplestore, so you just need to load the RDF of the SHACL shapes to the write graph and it will only accept graph comforming to the shape)

ShEx would be useful as a subset of SHACL, easier to write than SHACL, but the tooling developed should not be restricted to ShEx or use ShEx. It should always first convert the ShEx to SHACL then do everything on the SHACL model.

This way the community will be able to make use of the SHACL standardization (which allows loading shapes as RDF instead of relying on the development of hadoc tools for ShEx) and extra possibilities

labra commented 3 years ago

Hi, is there any update on it?

Thanks for your interest.

We are working on it, although we also have other projects and priorities so we didn't finnish it yet.

Apparently SHACL can express the integrality of ShEx shapes: https://www.w3.org/2014/data-shapes/wiki/SHACL-ShEx-Comparison

I don't agree with that document. Some of the claims made there reflect the opinion of the creators, which you can identify looking at it's history:

https://www.w3.org/2014/data-shapes/wiki/index.php?title=SHACL-ShEx-Comparison&action=history

For a more in-depth comparison I recommend you to read chapter 7 of "Validating RDF data" book: http://book.validatingrdf.com/bookHtml013.html

I also gave recently a tutorial which contains a more updated comparison between them. The slides and video-recording are here: http://www.validatingrdf.com/tutorial/iswc2020/

What can be expressed in ShEx, but not in SHACL Core

  • SHACL Core doesn't define TotalDigits and FractionDigits constraint components. These can be defined using SHACL SPARQL or implemented using sh:pattern, sh:minLength etc.

There are more things that can be expressed in ShEx and not in SHACL. One of the biggest one is the well-founded support for recursion, but there are others like the support for CLOSED that in SHACL is not complete.

So there is no point in continuing developing any ShEx validation tools, all that is needed is a conversion from ShEx to SHACL and then a performant SHACL validation (Ontotext GraphDB triplestore already implemented automated SHACL validation in their triplestore, so you just need to load the RDF of the SHACL shapes to the write graph and it will only accept graph comforming to the shape)

In my opinion, ShEx is a different language to SHACL and has its own merits. There is some underlying phylosophical difference on the motivation to use ShEx or SHACL, which has to do with the goal, if you just one to validate data adding some constraints, SHACL can be enough, but if you want to define an RDF data model for your domain that describes your data, I think ShEx is better suited.

ShEx would be useful as a subset of SHACL, easier to write than SHACL, but the tooling developed should not be restricted to ShEx or use ShEx. It should always first convert the ShEx to SHACL then do everything on the SHACL model.

If it were a subset, maybe, but it isn't. As I said, ShEx supports recursion ,while SHACL doesn't.

This way the community will be able to make use of the SHACL standardization (which allows loading shapes as RDF instead of relying on the development of hadoc tools for ShEx) and extra possibilities

ShEx can also be expressed in RDF. There is a syntax for ShEx called ShExR which also allows to convert between compact syntax to the RDF syntax and the other way around.