mfsy / shaclex   0.0.63-nexus2

MIT License Website GitHub

SHACL/ShEx implementation

Scala versions: 2.12

shaclex

SHACL and SHEX Implementation.

This project contains an implementation of SHACL and ShEx

Codacy Badge Build Status

Introduction

This project contains an implementation of SHACL and ShEx.

Both are implemented using the same underlying mechanism which is based on a purely functional approach.

Installation and compilation

The projects uses sbt for compilation as well as Java 1.8.

  • sbt test compiles and runs the tests

Usage

Once compiled, the program can be run as a command line tool. It is possible to run the program inside sbt as:

Validating RDF data with SHACL

Example:

sbt "run -d examples/shacl/good1.ttl --engine ShaClex"

Validating RDF with ShEx

Example:

sbt "run -e ShEx -s examples/shex/good1.shex --schemaFormat ShExC -d examples/shex/good1.ttl"

Interactive mode with sbt

It is usually faster to run the sbt command, which opens the interactive sbt shell and inside that shell, execute the different commands.

$ sbt
... several information about loading libraries
sbt> run -d examples/shacl/good1.ttl --engine ShaClex  

Binary mode

The fastest way to run Shaclex is to compile the code and generate a binary. The following command:

$ sbt universal:packageBin  

generates the file:

target/universal/shaclex-N.N.N.zip

which contains the compressed binary code.

Server mode

The --server option activates server mode.

sbt "run --server"

Implementation details

  • The engine is based on Monads using the cats library
  • The ShEx compact syntax parser
    is implemented using the following Antlr grammar (previous versions used Scala Parser Combinators) which is based on this grammar
  • JSON encoding and decoding uses the Json structure defined here and is implemented using Circe

More information

This project is a continuation of ShExcala which was focused on Shape Expressions only. In this project the underlying validation computation is based on Monad transformers.

Author

Contribution

Contributions are greatly appreciated. Please fork this repository and open a pull request to add more features or submit issues