ShEx

{{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, [https://www.w3.org/community/shex/ 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 = [https://github.com/shexSpec/shex.js/ shex.js],{{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/

}} [http://labra.weso.es/shaclex/ Shaclex]

| influenced by = Turtle, SPARQL, RelaxNG

| influenced = SHACL

}}

Shape Expressions (ShEx) {{Cite web|url=http://shex.io/shex-semantics-20170327/|title=Shape Expressions Language 2.0|date=27 March 2017 }} is a data modelling language for validating and describing a Resource Description Framework (RDF).

It was proposed at the 2012 RDF Validation Workshop{{Cite web|url=https://www.w3.org/2012/12/rdf-val/|title = RDF Validation Workshop: Practical Assurances for Quality RDF Data}} 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 :

PREFIX schema:

PREFIX xsd:

: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}}

class="wikitable sortable sort-under"

|+

! rowspan="2" |Project

! rowspan="2" |Programming language

! rowspan="2" |Version

! rowspan="2" |Latest release

! rowspan="2" |Compatible ShEx version

! colspan="7" |Features

value checking

!cardinality

!manifest shapemap

!imports

!external shapes

!annotations

!semantic actions

[https://github.com/marcelotto/shex-ex ShEx.ex]

|Elixir

|v0.1.4

|2020-10-13

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{no}}

| {{no}}

| {{no}}

| {{no}}

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

|Ruby

|0.7.1

|2022-01-29

|2.0

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{yes}}

[https://github.com/iovka/shex-java shexjava]

|Java

| {{CNone|None}}

| {{CNone|None}}

|2.0

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

[https://pypi.org/project/PyShEx/ PyShEx]

|Python

|v0.8.1

|2022-04-14

|2.0

| {{yes}}

| {{yes}}

| {{no}}

| {{no}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

[https://github.com/dpriskorn/entityshape entityshape]

|Python

|0.0.2

|2023-06-24

| {{dunno}}

| {{yes}}

| {{yes}}

| {{no}}

| {{no}}

| {{no}}

| {{no}}

| {{no}}

[https://github.com/weso/shaclex shaclex]

|Scala

|0.1.70

|2020-11-02

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

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

|JavaScript

|v1.0.0-alpha.26

|2023-04-25

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{dunno}}

| {{yes}}

| {{dunno}}

Online playgrounds and demos

  • [https://rawgit.com/shexSpec/shex.js/master/packages/shex-webapp/doc/shex-simple.html ShExSimple]: Online demo based on [https://github.com/shexSpec/shex.js/ shex.js]
  • [http://rdfshape.weso.es rdfshape]: online demo based on [http://labra.weso.es/shaclex/ 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/| 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/| 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