Giter Site home page Giter Site logo

revnixcad / topquadrant-shacl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from topquadrant/shacl

0.0 0.0 0.0 2.76 MB

SHACL API in Java based on Apache Jena

License: Apache License 2.0

Shell 0.58% Java 99.11% Batchfile 0.12% Dockerfile 0.19%

topquadrant-shacl's Introduction

TopBraid SHACL API

An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.

Contact: Holger Knublauch ([email protected])

Can be used to perform SHACL constraint checking and rule inferencing in any Jena-based Java application. This API also serves as a reference implementation of the SHACL spec.

Coverage:

Former Coverage until version 1.4.0

Former Coverage until version 1.3.2

The TopBraid SHACL API is internally used by the European Commission's generic SHACL-based RDF validator (used to validate RDF content against SHACL shapes) and SHACL shape validator (used to validate SHACL shapes themselves).

The same code is used in the TopBraid products (currently aligned with the TopBraid 7.1 release).

Feedback and questions should become GitHub issues or sent to TopBraid Users mailing list: https://groups.google.com/forum/#!forum/topbraid-users Please prefix your messages with [SHACL API]

To get started, look at the class ValidationUtil in the package org.topbraid.shacl.validation. There is also an Example Test Case

Application dependency

Releases are available in the central maven repository:

<dependency>
  <groupId>org.topbraid</groupId>
  <artifactId>shacl</artifactId>
  <version>*VER*</version>
</dependency>

Command Line Usage

Download the latest release from:

https://repo1.maven.org/maven2/org/topbraid/shacl/

The binary distribution is:

https://repo1.maven.org/maven2/org/topbraid/shacl/*VER*/shacl-*VER*-bin.zip.

Two command line utilities are included: shaclvalidate (performs constraint validation) and shaclinfer (performs SHACL rule inferencing).

To use them, set up your environment similar to https://jena.apache.org/documentation/tools/ (note that the SHACL download includes Jena).

For example, on Windows:

SET SHACLROOT=C:\Users\Holger\Desktop\shacl-1.4.1-bin
SET PATH=%PATH%;%SHACLROOT%\bin

As another example, for Linux, add to .bashrc these lines:

# for shacl
export SHACLROOT=/home/holger/shacl/shacl-1.4.1-bin/shacl-1.4.1/bin
export PATH=$SHACLROOT:$PATH 

Both tools take the following parameters, for example:

shaclvalidate.bat -datafile myfile.ttl -shapesfile myshapes.ttl

where -shapesfile is optional and falls back to using the data graph as shapes graph. Add -validateShapes in case you want to include the metashapes (from the tosh namespace in particular).

Currently only Turtle (.ttl) files are supported.

The tools print the validation report or the inferences graph to the output screen.

Dockerfile Usage

The Dockerfile in the .docker folder includes a minimal Java Runtime Environment for the SHACL API that clocks in at 144Mb. To build the docker image use:

docker build -f .docker/Dockerfile -t ghcr.io/topquadrant/shacl:1.4.2 --build-arg VERSION=1.4.2 .

To use the Docker image, there are two possible commands. To run the validator:

docker run --rm -v /path/to/data:/data ghcr.io/topquadrant/shacl:1.4.2 validate -datafile /data/myfile.ttl -shapesfile /data/myshapes.ttl

To run rule inferencing:

docker run --rm -v /path/to/data:/data ghcr.io/topquadrant/shacl:1.4.2 infer -datafile /data/myfile.ttl -shapesfile /data/myshapes.ttl

Any other command after ghcr.io/topquadrant/shacl:1.4.2 will print the following help page:

Please use this docker image as follows:
docker run -v /path/to/data:/data ghcr.io/topquadrant/shacl:1.4.2 [COMMAND] [PARAMETERS]
COMMAND:
	validate 
		to run validation
	infer
		to run rule inferencing
PARAMETERS:
	-datafile /data/myfile.ttl [MANDATORY]
		input to be validated (only .ttl format supported)
	-shapesfile /data/myshapes.ttl [OPTIONAL]
		shapes for validation (only .ttl format supported)

topquadrant-shacl's People

Contributors

afs avatar antoniogarrote avatar ashleysommer avatar cmdoret avatar fekaputra avatar gutee avatar holgerknublauch avatar locke avatar supermaxiste avatar tfrancart avatar vonunige avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.