Skip to content

Latest commit

 

History

History
124 lines (84 loc) · 2.31 KB

File metadata and controls

124 lines (84 loc) · 2.31 KB

ShExStatements Documentation

ShExStatements converts CSV-like statements and spreadsheet files into Shape Expressions (ShEx).

Supported usage modes

  1. WASM (in-browser conversion via Pyodide)
  2. Docker (frontend + backend services)
  3. Python (CLI and legacy Flask web app)

1) Python mode

Clone and install:

git clone https://github.com/johnsamuelwrites/ShExStatements.git
cd ShExStatements
python3 -m venv .venv
source .venv/bin/activate
pip3 install .

Run CLI conversion:

./shexstatements.sh examples/language.csv

Use a different delimiter:

./shexstatements.sh examples/languagedelimsemicolon.csv --delim ";"

Skip CSV header:

./shexstatements.sh --skipheader examples/header/languageheader.csv

Convert spreadsheet files:

./shexstatements.sh examples/language.ods
./shexstatements.sh examples/language.xls
./shexstatements.sh examples/language.xlsx

Run legacy Flask UI:

./shexstatements.sh -r

Legacy UI URL: http://127.0.0.1:5000/

2) Docker mode

From repository root:

cd docker
docker compose up

Services:

  • Frontend: http://localhost:3000
  • Backend API: http://localhost:8000
  • Swagger UI: http://localhost:8000/docs

Development mode:

cd docker
docker compose -f docker-compose.yml -f docker-compose.dev.yml up

3) WASM mode

The frontend can convert in the browser with runtime mode set to wasm (for example in GitHub Pages builds).

In WASM mode:

  • Text conversion is done fully in-browser.
  • File conversion supports .csv, .xlsx, .xls, and .ods.
  • Python packages are installed in Pyodide at runtime.

ShExStatements input format

Typical row structure:

@node|property|value|cardinality|comment

Column expectations:

  • 1: node name
  • 2: property
  • 3: allowed value(s)
  • 4: cardinality (optional)
  • 5: comment (optional, starts with #)

Cardinality values:

  • *: zero or more
  • +: one or more
  • m: exactly m
  • m,n: between m and n, inclusive

Application profile CSV format:

Entity_name,Property,Property_label,Mand,Repeat,Value,Value_type,Annotation

Command:

./shexstatements.sh -ap --skipheader examples/languageap.csv

Examples are available in the examples directory.