Skip to content
tombaker edited this page Feb 13, 2019 · 10 revisions

The '''Shape Expressions''' ('''ShEx''') language describes RDF graph structures. These descriptions identify predicates and their associated cardinalities and datatypes. ShEx shapes can be used to communicate data structures associated with some process or interface, generate or validate data, or drive user interfaces. It is intended to:

  • validate RDF documents.
  • communicate expected graph patterns for interfaces.
  • generate user interface forms and interface code.

A [http://rawgit.com/shexSpec/shex.js/master/doc/shex-simple.html# simple ShEx demo] shows up data validates against a schema.

The [http://shex.io/ ShEx Homepage] includes links to specifications and examples. This wiki gathers extensions and conventions maintained by the ShEx community and provides a scratch space for discussions around advancing the specification.

If you would like to participate in the standardization of ShEx, please join the [https://www.w3.org/community/shex ShEx Community Group].

== Example ==

{ # A Issue shape :state [ :unassigned :assigned ]; # has a state with 2 possible values :reportedBy @; # is reported by a user :reportedOn xsd:date; # is reported on a date ( :reproducedBy @ # can optionally have 2 properties ; :reproducedOn xsd:date # reproducedBy/On )?; :related @* # is related to several other issues }

{ # A user shape can have either ( foaf:name xsd:string # name or | foaf:givenName xsd:string+ ; # several given names and foaf:familyName xsd:string # family name ); foaf:mbox shex:IRI ? # mbox Optional, any IRI }

A separate ShEx_Examples contains some simple examples using ShEx.

The following list contains a list of examples that employ ShEx:

  • [http://weso.github.io/landportalDoc/data/ LandPortal documentation using ShEx]
  • [http://weso.github.io/wiDoc/#indicator Web Index Data Portal documentation using ShEx]
  • [http://www.w3.org/2013/12/FDA-TA/subject.shex FDA Renal Transplantation Ontology]

Shex definition can be defined in three syntaxes: ShExC (ShEx Compact format), ShExJ (a JSON-LD syntax) and ShExR (the RDF corresponding to ShExJ).

== Implementations ==

=== [https://github.com/shexSpec/shex.js ShEx.js] ===

  • Formats: ShExC, ShExJ, ShExR
  • Language: javascript based
  • Algorithm: Partition
  • Developer: Eric Prud'Hommeaux

Live Demo Examples:

  • [http://rawgit.com/shexSpec/shex.js/ld/doc/shex-simple.html simple validator interface]

=== [http://labra.github.io/shaclex/ SHACLex] ===

  • Syntax: ShExC, ShExJ, ShExR (ongoing work), SHACL
  • Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
  • Algorithm: Implementation based on monads and regular expression detivatives with support for both ShEx and SHACL
  • Programming language: Scala

Live demo:

  • [http://shaclex.herokuapp.com SHACLEX server]

=== [https://github.com/ruby-rdf/shex ShEx Ruby] ===

  • Syntax: ShExC, ShExJ, ShExR
  • Developer: [http://greggkellogg.net/ Gregg Kellogg]
  • Programming language: Ruby

=== [https://gforge.inria.fr/projects/shex-impl/ ShEx implementation in Java (Lille)] ===

  • Syntax: ShExJ
  • Developer: Iovka Boneva
  • Programming language: Java

Old implementations

  • Syntax: ShExc (Shex compact syntax) with some extensions like regex
  • Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
  • Algorithm: Regular expression derivatives
  • Programming language: Scala
  • Extra features: Online RDF validator based on [http://labra.github.io/ShExcala/ Shexcala]
  • Syntax: ShEx compact syntax
  • Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
  • Algorithm: Regular expression derivatives and backtracking (by selection)
  • Programming language: Scala
  • Extra features: Negation, Reverse arcs, language tags, regexps
  • Note: this library is no longer maintained. The new version is [http://labra.github.io/shaclex/ SHACLex]
  • Formats: ShExR and ShExC(partly)
  • Language: Javascript based
  • Algorithm: State based
  • Developer: Jesse van Dam
  • Working version: [http://www.jessevandam.nl].
  • Source code [https://github.com/jessevdam/shextest] (uses a local web server that can be started with ruby and accessed via localhost:4567).

For the validation code see [https://github.com/jessevdam/shextest/blob/master/js/validate.js] for the validation process (easy to read). Further description can be found here at ValidationCode.

  • Syntax: Abstract syntax (no parser)
  • Semantics: Closed shapes based on operational semantics
  • Developer: [http://www.di.uniovi.es/~labra Jose Emilio Labra Gayo]
  • Algorithm: Backtracking. This implementation was just a research prototype
  • Programming language: Haskell

Test cases

  • [https://github.com/shexSpec/shexTest/ ShEx test suite] / [http://shexspec.github.io/test-suite/index.html test suite description]
  • [http://shexspec.github.io/shexTest/reports/#ShEx-validation-tests implementation report]

ShapeMap

The complete validation process is separated in 2 steps.

'''Step 1''' The creation of the Node to (multiple) Shapes mapping named as the "ShapeMap" [https://shexspec.github.io/spec/#h-shape-map Shape Map] using different techniques, which are at the moment not part of the SHEX standard. The only mapping included in the standard is the default "ShapeMap". This "ShapeMap" contain only a mapping between the start Node (given as parameter to validation process) and start Shape given in the ShEx schema.

The ShEx/ShapeMap page describes different techniques for associating nodes with shapes.

'''Step 2''' The ShEx validation as described in the spec[https://shexspec.github.io/spec/]. Every node in the "ShapeMap" is validated against each of the associated shapes. Any nodes that neither are in the ShapeMap nor visited during the validation process are not validated.

This separation ensures that shapes are semantically independent and can be linked to different things dependent on the node to shape mapping.

Syntax and Serialization formats

The following serialization formats exists

  • ShExc - Shex compact format as given in the example above
  • ShExR - The RDF version for ShEx, schema's herefore can be found at [https://github.com/shexSpec/shexTest/blob/master/doc/ShExR.shex ShExR schema as ShExc], [https://github.com/shexSpec/shexTest/blob/master/doc/ShExR.ttl ShExR as ShExR], [https://github.com/shexSpec/shexTest/blob/master/doc/ShExR.json ShExR as ShExJ ]
  • ShExJ - The JSON-LD(= JSON) version for ShEx, which can be created from ShExR(data model is the same) after applying the context in [https://github.com/shexSpec/shexspec.github.io/blob/json-ld-ns-source/ns/context.jsonld @context] and framing, [https://github.com/shexSpec/shexTest/blob/master/doc/ShExJ.jsg ShExJ in JSON grammer]
  • ShExV - The validation report format in JSON, [https://github.com/shexSpec/shexTest/blob/master/doc/ShExV.jsg validation rapport in JSON grammer]

Publications about ShEx

  • ''Complexity and Expressiveness of ShEx for RDF'', In International Conference on Database Theory (ICDT) 2015. With S. Staworko, J. E. Labra Gayo, S. Hym, E. G. Prud’hommeaux, and H. Solbrig. [http://www.grappa.univ-lille3.fr/~staworko/papers/staworko-icdt15a.pdf PDF]
  • ''Towards an RDF validation language based on Regular Expression derivatives'', Jose Emilio Labra Gayo, Eric Prud'Hommeaux, Slawek Staworko and Harold Solbrig. [http://labra.github.io/ShExcala/papers/LWDM2015.pdf PDF][http://www.slideshare.net/jelabra/towards-an-rdf-validation-language-based-on-regular-expression-derivatives Slides]
  • ''Shape Expressions: An RDF validation and transformation language'', Eric Prud'hommeaux, Jose Emilio Labra Gayo, Harold Solbrig, [http://www.semantics.cc/ 10th International Conference on Semantic Systems], Sept. 2015, Leipzig, Germany, [http://labra.github.io/ShExcala/papers/semantics2014.pdf PDF][http://www.slideshare.net/jelabra/semantics-2014 Slides]
  • ''Validating and Describing Linked Data Portals using RDF Shape Expressions'', Jose Emilio Labra Gayo, Eric Prud'hommeaux, Harold Solbrig, [http://ldq.semanticmultimedia.org/ 1st Workshop on Linked Data Quality], Sept. 2015, Leipzig, Germany, [http://labra.github.io/ShExcala/papers/ldq2014.pdf PDF][http://www.slideshare.net/jelabra/linked-dataquality-2014 Slides]
  • ''An RDF validation and transformation language'', Eric Prud'hommeax, Jose Emilio Labra Gayo and Harold Solbrig, [http://dl.acm.org/citation.cfm?id=2660523 SEM '14 Proceedings of the 10th International Conference on Semantic Systems], Leipzig, Germany, September 04 - 05, 2014 ([http://2014.semantics.cc/www.semantics.cc/programme/accepted-papers/index.html Best Paper Award])

==Discussion & Proposed Features ==

See ShEx/CurrentDiscussion for the currently ongoing discussions

[https://github.com/shexSpec/shex/issues?q=is%3Aopen+is%3Aissue+milestone%3A2.0 Issuelist 2.0]

[https://github.com/shexSpec/shex/issues?q=is%3Aopen+is%3Aissue+milestone%3A2.1 Issuelist 2.1]

Submitting & resolving issues (under discussion)

All ShEx issues are tracked in [https://github.com/shexSpec/shex/issues Github]. There is no requirement for submitting a new issue. Anyone, even people outside the ShEx CG can open an issue. However, we have a pre-defined workflow for closing issues.

After an issue is opened, it can be discussed directly in github, in form of other comments, or during the group telcos. People can suggest a proposal to close an issue by adding a comment starting with the keyword "PROPOSAL:" and explaining the proposed solution. The issue is tagged with the label "[https://github.com/shexSpec/shex/labels/Voting-Needed Voting-Needed]" and an email is sent to the mailing list asking for all members to vote. All members can cast their votes directly on the proposal comment using the [https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments|github reaction icons]. The suggested reactions are "+1", "-1" and "confused". The issue can be resolved if there are only +1 reactions 1 week after the proposal announcement or there is no competing proposal. In other cases, the issues are resolved during the groups telcos. Every issue is resolved with a new comment stating the accepted proposal, the member votes and a comment on if it was resolved automatically or during a telco.

Specification/Tutorials

  • [http://shexspec.github.io/primer/ Primer]
  • [https://shexspec.github.io/spec/ ShEx2 specification]
  • [https://github.com/shexSpec/shex.js The main implementation]
  • [https://github.com/shexSpec/shexTest/ Test suite]
  • [http://shexspec.github.io/shexTest/reports/#ShEx-validation-tests Implementation report]
  • [https://github.com/shexSpec/shex/tree/master/meetings Group Meetings]
  • [https://www.w3.org/community/shex/ The W3C community group]
  • [https://lists.w3.org/Archives/Public/public-shex/ Group mailing list]
  • [https://gitter.im/shapeExpressions/Lobby Gitter for the group]
  • ShEx/API
Clone this wiki locally