ShEx
Shape Expressions (ShEx) [2] is a language for validating and describing RDF.
Paradigm | Data Validation |
---|---|
Designed by | Eric Prud'hommeaux, Iovka Boneva, Jose Emilio Labra Gayo, Gregg Kellogg, Shape Expressions W3C Community Group |
Stable release | 2.1
/ November 21, 2018 |
Scope | Semantic Web |
Implementation language | JavaScript, Scala |
Filename extensions | shex, sx |
Website | www |
Major implementations | |
shex.js[1], Shaclex[1] | |
Influenced by | |
Turtle, SPARQL, RelaxNG | |
Influenced | |
SHACL |
It was proposed at the 2012 RDF Validation Workshop[3] as a high-level, concise language for RDF validation.
The shapes can be defined in a human-friendly compact syntax called ShExC or using any Resource Description Framework (RDF) serialization formats like JSON-LD or Turtle.
ShEx expressions can be used both to describe RDF and to automatically check the conformance of RDF data. The syntax of ShEx is similar to Turtle and SPARQL while the semantics is inspired by regular expression languages like RelaxNG.
Example
PREFIX : <http://example.org/>
PREFIX schema: <http://schema.org/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
:Person {
schema:name xsd:string ;
schema:knows @:Person * ;
}
The previous example declares that nodes conforming to shape Person
must have one property schema:name
with a string value and zero or more properties schema:knows
whose values must conform with shape Person
.
Implementations
Online playgrounds and demos
- ShExSimple: Online demo based on shex.js
- rdfshape: online demo based on shaclex
References
- Labra Gayo, Jose Emilio; Prud'hommeaux, Eric; Boneva, Iovka; Kontokostas, Dimitris (2018). Validating RDF Data. Morgan & Claypool. p. 328. ISBN 9781681731650.
- http://shex.io/shex-semantics-20170327/
- https://www.w3.org/2012/12/rdf-val/
Further reading
- Specification
- Prud'hommeaux, Eric; Boneva, Iovka; Labra Gayo, Jose Emilio; Kellogg, Gregg, eds. (2018). Shape Expressions Language Specification. W3C Draft Community Group Report.CS1 maint: ref=harv (link)
- Labra Gayo, Jose Emilio; Prud'hommeaux, Eric; Boneva, Iovka; Kontokostas, Dimitris (2018). Validating RDF Data. Morgan & Claypool.CS1 maint: ref=harv (link)