ShExStatements: Quick start

ShExStatements allows users to generate shape expressions from simple CSV statements and files. shexstatements can also be used from the command line.

Online demonstration

Online demonstrations are also available:

Manual setup


Clone the ShExStatements repository.

$ git clone

Go to ShExStatements directory.

$ cd ShExStatements

Consider an example CSV file language.csv in the folder examples/. The file contains an example description of a language on Wikidata. This file uses comma as a delimiter to separate the values. First three lines are used to specify the prefixes. And the remaining lines describe the different properties used to describe a language.


@language,wdt:P31,wd:Q34770,,# instance of a language
@language,wdt:P1705,LITERAL,,# native name
@language,wdt:P17,.,+,# spoken in country
@language,wdt:P2989,.,+,# grammatical cases
@language,wdt:P282,.,+,# writing system
@language,wdt:P1098,.,+,# speakers
@language,wdt:P1999,.,*,# UNESCO language status
@language,wdt:P2341,.,+,# indigenous to

There are five columns in the CSV file.

  • Column 1 is used for specifying the node name, starting with @.
  • Column 2 for specifying the property value
  • Column 3 for a set of possible values
  • Column 4 for cardinality (+,*)
  • Column 5 for comments. Comments start with #.

Columns 1, 2, 3 are mandatory. Column 3 can be a special value like . (period to say 'any' value). The first three lines in the above file are used for specifying the prefixes. In this case, columns 3,4 and 5 are empty.

Cardinality can be any one of the following values

  • * : zero or more values
  • + : one or more values
  • m : m number of values
  • m,n : any number of values between m and n (including m and n).

Run the following command for the above file.

$ ./ examples/language.csv

The shape expression generated by ShExStatements will look like

PREFIX xsd: <>
PREFIX wd: <>
PREFIX wdt: <>
start = @<language>
<language> {
  wdt:P31 [ wd:Q34770  ] ;# instance of a language
  wdt:P1705 LITERAL ;# native name
  wdt:P17 .+ ;# spoken in country
  wdt:P2989 .+ ;# grammatical cases
  wdt:P282 .+ ;# writing system
  wdt:P1098 .+ ;# speakers
  wdt:P1999 .* ;# UNESCO language status
  wdt:P2341 .+ ;# indigenous to

CSV file can use delimiters like semicolon (;). Take for example, the following command works with a file using semi-colon as a delimiter.

$ ./ examples/languagedelimsemicolon.csv --delim ";"

But sometimes, users may like to specify the header. In that case, they can make use of -s or --skipheader to tell the generator to skip the header (firsrt line of CSV).

$ ./ --skipheader examples/languageheader.csv

Web interface

shexstatements can also be accessed from a web interface. Clone the ShExStatements repository.

$ git clone

Go to ShExStatements directory.

$ cd ShExStatements

Install modules required by **ShExStatements** (here: installing into a virtual environment).

$ python3 -m venv .venv
$ source ./.venv/bin/activate
$ pip3 install .

Now run the application.

$ python3

Check the URL