Home

Awesome

ShEx-s

Scala implementation of SHEX.

This project contains an implementation of Shape Expressions (ShEx).

Continuous Integration Codacy Badge codecov Maven Central

Introduction

This project contains a Scala implementation of ShEx. The library handles RDF using a simple RDF library, which at this moment has 2 implementations, one using Apache Jena and another one using RDF4j. This means that it is possible to use this library to validate RDF models from either Jena or RDF4J models, as well as from external SPARQL endpoints.

Installation and compilation

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

Command line usage

It is possible to run shex-s as a command line tool.

To create the executable you can use the following command:

sbt universal:packageBin

and it will generate a zip file in the folder: target/universal which contains an executable called shexs

Usage:
    shexs mapping
    shexs validate
    shexs shapePath
    shexs manifest
    shexs wikibase
    shexs schema

ShEx-Scala command line tool

Options and flags:
    --help
        Display this help text.
    --version, -v
        Print the version number and exit.

Subcommands:
    mapping
        Convert a schema through a mapping
    validate
        Validate RDF data using a schema and a shape map
    shapePath
        Validate a shape path
    manifest
        Run manifest file containing tests
    wikibase
        Validate RDF data from wikibase
    schema
        Schema processing actions

It is possible to create binaries for different platforms like Linux, Windows, MacOS, etc. We would like to publish those binaries with each release as discribed in this issue.

Validate option

You can run the following in the examples folder to validate the turtle file user.ttl according to the ShEx file user.shex and the shape map user.sm:

shexs validate --schema user.shex --data user.ttl --shapeMap user.sm

Other options for validation are available as:

Usage:
    shexs validate --schema <path> [--schemaFormat <format>] [--baseIRI <string>] --data <path> [--dataFormat <string>] --shapeMap <path> [--shapeMapFormat <string>] [--validator version <string>] [--showResultFormat <string>] [--output <path>] [--verbose <string>]
    shexs validate --schema <path> [--schemaFormat <format>] [--baseIRI <string>] --endpoint <string> --shapeMap <path> [--shapeMapFormat <string>] [--validator version <string>] [--showResultFormat <string>] [--output <path>] [--verbose <string>]
    shexs validate --schemaURL <string> [--baseIRI <string>] --data <path> [--dataFormat <string>] --shapeMap <path> [--shapeMapFormat <string>] [--validator version <string>] [--showResultFormat <string>] [--output <path>] [--verbose <string>]
    shexs validate --schemaURL <string> [--baseIRI <string>] --endpoint <string> --shapeMap <path> [--shapeMapFormat <string>] [--validator version <string>] [--showResultFormat <string>] [--output <path>] [--verbose <string>]

Validate RDF data using a schema and a shape map

Options and flags:
    --help
        Display this help text.
    --schema <path>, -s <path>
        Path to ShEx file.
    --schemaFormat <format>
        Schema format, default = (ShExC). Possible values = (ShExC,ShExJ)
    --baseIRI <string>
        base IRI
    --schemaURL <string>
        URL of schema
    --data <path>, -d <path>
        Path to data file.
    --dataFormat <string>
        Data format. Default=Turtle, available=Turtle,NTriples,RDF/XML,JSON-LD
    --endpoint <string>
        endpoint URL
    --shapeMap <path>, -s <path>, -m <path>
        Path to shapeMap file.
    --shapeMapFormat <string>
        ShapeMap format, default=Compact, available formats=List(Compact, JSON)
    --validator version <string>, -e <string>
        version of validator. Default = 2.2. Other values = 2.1,ref
    --showResultFormat <string>
        showResultFormat
    --output <path>
        Output to file (default = console)
    --verbose <string>, -v <string>
        verbose level (0-nothing,1-basic,2-info,3-details,4-debug,5-step,6-all)

Implementation details

Compatibility tests

We also pass the ShEx test-suite.

<!-- In order to run the shex test-suite and generate the EARL report, you can do the following: ``` sbt ... sbt:shexRoot> project shex sbt:shex> test ``` -->

Generating docs page

Publishing to OSS-Sonatype

This project uses the sbt ci release plugin for publishing to OSS Sonatype.

SNAPSHOT Releases

Open a PR and merge it to watch the CI release a -SNAPSHOT version

Full Library Releases
  1. Push a tag and watch the CI do a regular release
  2. git tag -a v0.1.0 -m "v0.1.0"
  3. git push origin v0.1.0 Note that the tag version MUST start with v.

More information

Author & contributors

Contributors:

Adopters

Contribution

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

<a href="https://github.com/weso/shex-s/graphs/contributors"> <img src="https://contributors-img.web.app/image?repo=weso/shex-s" /> </a>