Skip to content

Commit

Permalink
Merge pull request #36 from SHACL-X/py-ext
Browse files Browse the repository at this point in the history
Add SHACL-Py implementation
  • Loading branch information
ashleycaselli authored Mar 6, 2024
2 parents 28a6d4b + 6efc4d8 commit 3e1e033
Show file tree
Hide file tree
Showing 72 changed files with 3,822 additions and 764 deletions.
77 changes: 9 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,78 +1,19 @@
![GitHub CI](https://github.com/ashleycaselli/shacl/actions/workflows/build-maven.yml/badge.svg)
![GitHub CI](https://github.com/ashleycaselli/shacl-x/actions/workflows/build-maven.yml/badge.svg)

# TopBraid SHACL API
# TopBraid SHACL API Extended

**An open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.**
**This is a fork of the [TopBraid SHACL API](https://github.com/TopQuadrant/shacl), an open source implementation of the W3C Shapes Constraint Language (SHACL) based on Apache Jena.**

Contact: Holger Knublauch ([email protected])
Starting from [SHACL API v1.4.0](https://github.com/TopQuadrant/shacl/releases/tag/v1.4.0), the SHACL-JS support was removed to avoid Nashorn issues.

This fork brings the SHACL JavaScript Extensions (SHACL-JS) features back by leveraging GraalVM and its Polyglot APIs. Not only the SHACL-JS features are brought back but new extensions are introduced, such as the SHACL Python Extensions (SHACL-Py).

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:
* [SHACL Core and SHACL-SPARQL validation](https://www.w3.org/TR/shacl/)
* [SHACL Advanced Features (Rules etc)](https://www.w3.org/TR/shacl-af/)
* [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/)
* [SHACL Compact Syntax](https://w3c.github.io/shacl/shacl-compact-syntax/)
* [SHACL JavaScript Extensions](https://www.w3.org/TR/shacl-js/)
* SHACL Python Extensions

See [SHACL-JS](https://github.com/TopQuadrant/shacl-js) for a pure JavaScript implementation.

The same code is used in the TopBraid products (currently aligned with the TopBraid 6.3 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](../master/src/test/java/org/topbraid/shacl/ValidationExample.java)

## 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: validate (performs constraint validation) and infer (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.0.0-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.0.0-bin/shacl-1.0.0/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.

Currently only Turtle (.ttl) files and SHACL Compact Syntax (.shaclc) files are supported.

The tools print the validation report or the inferences graph to the output screen.
Contact: Ashley Caselli ([[email protected]](mailto:[email protected]))
42 changes: 21 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,14 @@

<modelVersion>4.0.0</modelVersion>

<groupId>org.topbraid</groupId>
<artifactId>shacl</artifactId>
<groupId>io.github.shacl-x</groupId>
<artifactId>shacl-x</artifactId>
<version>1.3.3-SNAPSHOT</version>
<packaging>jar</packaging>

<name>TopBraid SHACL API</name>
<description>TopBraid SHACL API</description>
<url>http://topbraid.org/shacl/api</url>

<organization>
<name>TopQuadrant, Inc.</name>
<url>http://topquadrant.com</url>
</organization>
<name>SHACL eXtended (SHACL-X)</name>
<description>This SHACL implementation is an extension of the TopBraid SHACL API</description>
<url>https://shacl-x.github.io/docs/</url>

<licenses>
<license>
Expand All @@ -44,29 +39,25 @@
</licenses>

<issueManagement>
<url>https://github.com/TopQuadrant/shacl/issues</url>
<url>https://github.com/shacl-x/shacl-x/issues</url>
</issueManagement>

<developers>
<developer>
<name>Ashley Caselli</name>
<organization>University of Geneva</organization>
</developer>
<developer>
<name>Holger Knublauch</name>
</developer>
</developers>

<contributors>
<contributor>
<!-- Github contributors page -->
<url>https://github.com/TopQuadrant/shacl/graphs/contributors</url>
<url>https://github.com/shacl-x/shacl-x/graphs/contributors</url>
</contributor>
</contributors>

<scm>
<url>https://github.com/TopQuadrant/shacl</url>
<connection>scm:git:https://github.com/TopQuadrant/shacl</connection>
<developerConnection>scm:git:[email protected]:TopQuadrant/shacl.git</developerConnection>
<tag>shacl-1.3.2</tag>
</scm>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ver.jena>3.17.0</ver.jena>
Expand All @@ -76,6 +67,7 @@
<ver.log4j1>1.2.17</ver.log4j1>
<ver.graalvm>23.1.2</ver.graalvm>
<ver.graalvm-js>23.1.2</ver.graalvm-js>
<ver.graalvm-py>23.1.1</ver.graalvm-py>
</properties>

<dependencies>
Expand All @@ -92,6 +84,14 @@
<type>pom</type>
</dependency>

<dependency>
<groupId>org.graalvm.polyglot</groupId>
<artifactId>python</artifactId>
<version>${ver.graalvm-py}</version>
<scope>runtime</scope>
<type>pom</type>
</dependency>

<dependency>
<groupId>org.apache.jena</groupId>
<artifactId>jena-arq</artifactId>
Expand Down Expand Up @@ -120,7 +120,7 @@
<!-- Logging : <optional> so the application chooses the provider for slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<artifactId>slf4j-reload4j</artifactId>
<version>${ver.slf4j}</version>
<optional>true</optional>
<scope>test</scope>
Expand Down
Loading

0 comments on commit 3e1e033

Please sign in to comment.