Shape Expressions (ShEx)
\{\{Short description|Language for validating, describing or transforming RDF graphs}} \{\{For|the UK government body|Shareholder Executive}} \{\{Infobox programming language | name = ShEx - Shape Expressions | logo = File:ShexLogo.png | paradigm = Data Validation | year_started = 2013 | designer = Eric Prud'hommeaux, Iovka Boneva, Jose Emilio Labra Gayo, Gregg Kellogg, Shape Expressions W3C Community Group | programming language = JavaScript, Scala | latest_release_version = 2.1 | latest_release_date = \{\{Start date and age|2018|11|21}} | file ext = shex, sx | scope = Semantic Web | abbreviation = ShEx | website = \{\{url|https://www.w3.org/community/shex/}} | implementations = shex.js,[1] Shaclex[1] | influenced by = Turtle, SPARQL, RelaxNG | influenced = SHACL }}
Shape Expressions (ShEx) [2] is a data modelling language for validating and describing a Resource Description Framework (RDF).
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 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
\{\{sort-under}}
| Project | Programming language | Version | Latest release | Compatible ShEx version | Features | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| value checking | cardinality | manifest shapemap | imports | external shapes | annotations | semantic actions | |||||
| ShEx.ex | Elixir | v0.1.4 | 2020-10-13 | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{no}} | \{\{no}} | \{\{no}} | \{\{no}} |
| Ruby ShEx | Ruby | 0.7.1 | 2022-01-29 | 2.0 | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{yes}} |
| shexjava | Java | None}} | None}} | 2.0 | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} |
| PyShEx | Python | v0.8.1 | 2022-04-14 | 2.0 | \{\{yes}} | \{\{yes}} | \{\{no}} | \{\{no}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} |
| entityshape | Python | 0.0.2 | 2023-06-24 | \{\{dunno}} | \{\{yes}} | \{\{yes}} | \{\{no}} | \{\{no}} | \{\{no}} | \{\{no}} | \{\{no}} |
| shaclex | Scala | 0.1.70 | 2020-11-02 | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} |
| shex.js | JavaScript | v1.0.0-alpha.26 | 2023-04-25 | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{dunno}} | \{\{yes}} | \{\{dunno}} |
Online playgrounds and demos
- ShExSimple: Online demo based on shex.js
- rdfshape: online demo based on shaclex \{\{Webarchive|url=https://web.archive.org/web/20181119091940/http://labra.weso.es/shaclex/ |date=2018-11-19 }}
References
\{\{reflist}}
Further reading
Specification
- \{\{cite book| editor1-first = Eric| editor1-last = Prud'hommeaux| editor2-first=Iovka| editor2-last=Boneva| editor3-first=Jose Emilio|editor3-last=Labra Gayo|editor4-first=Gregg|editor4-last=Kellogg| title = Shape Expressions Language Specification| url = https://shexspec.github.io/spec/%7C year = 2018| publisher = W3C Draft Community Group Report}}
- \{\{cite book| author1-first = Jose Emilio| author1-last = Labra Gayo| author2-first=Eric| author2-last=Prud'hommeaux| author3-first=Iovka|author3-last=Boneva|author4-first=Dimitris|author4-last=Kontokostas| title = Validating RDF Data| url = https://book.validatingrdf.com/%7C year = 2018| publisher = Morgan & Claypool }}
Other
- \{\{Cite journal |last1=Thornton |first1=Katherine |last2=Solbrig |first2=Harold |last3=Stupp |first3=Gregory S. |last4=Labra Gayo |first4=Jose Emilio |last5=Mietchen |first5=Daniel |last6=Prud'hommeaux |first6=Eric |last7=Waagmeester |first7=Andra |date=2018-04-07 |title=Using Shape Expressions (Shex) To Share Rdf Data Models And To Guide Curation With Rigorous Validation |url=https://zenodo.org/record/1214521 |journal=Zenodo |language=en |doi=10.5281/ZENODO.1214521}}
- \{\{Cite web |last=Katherine |first=Thornton |title=Using ShEx to Investigate Data about Software and File Formats in Wikidata \{\{!}} Software Preservation Network (SPN) |url=https://www.softwarepreservationnetwork.org/using-shex-to-investigate-data-about-software-and-file-formats-in-wikidata/ |access-date=2023-06-24 |website=www.softwarepreservationnetwork.org}}
See also
\{\{Semantic Web}}
- ↑ a b \{\{cite book | last1 = Labra Gayo | first1 = Jose Emilio | last2 = Prud'hommeaux | first2 = Eric | last3 = Boneva | first3 = Iovka | last4 = Kontokostas | first4 = Dimitris | title = Validating RDF Data | publisher = Morgan & Claypool | pages = 328 | date = 2018 | isbn = 9781681731650 | url = http://book.validatingrdf.com/ }}
- ↑ \{\{Cite web|url=http://shex.io/shex-semantics-20170327/%7Ctitle=Shape Expressions Language 2.0|date=27 March 2017 }}
- ↑ \{\{Cite web|url=https://www.w3.org/2012/12/rdf-val/%7Ctitle = RDF Validation Workshop: Practical Assurances for Quality RDF Data}}