This project will slowly be replaced by an updated version, found here.
Originally this project was written in function of our paper. However, because of significant improvements in the logical syntax parser, this project is in the process of being rewritten with the improved parser. This new project will therefore also be the continuation of the SPARQL Shape Fragment implementation.
The main goal of this project is to translate SHACL shapes to corresponding SPARQL queries according to the shape fragments specification.
It provides three features of interest:
- Parsing a shapes graph to a schema of SANodes (Shape Algebra Nodes)
- Translating SANodes to unary SPARQL queries which retrieve the nodes conforming to the SANode
- Translating SANodes to SPARQL queries according to the Shape Fragments specification
- python 3.9.7
- python packages listed in
requirements.txt
Set up a Python virtual environment and install packages from requirements.txt
.
Let's say the virtual environment is located in .env
:
$ source .env/bin/activate
$ python -m pip install -r requirements.txt
The interface to the software is located in ssf.py
.
To run the program (while having the virtual environment activated):
$ python ssf.py
This will display the help string. To generate a SPARQL query from a shapes graph:
$ python ssf.py --frag shapesgraph.ttl
where shapesgraph.ttl
is the relevant shapes graph in turtle format.
To generate SPARQL queries which ignore tests (as generated for the experiments in the paper):
$ python ssf.py --frag -i shapesgraph.ttl