oeg-upm / astrea

Astrea is a software that generates SHACL shapes for one or more OWL ontologies using a set of SPARQL queries that hold the equivalence between those two specifications
https://astrea.linkeddata.es/
Apache License 2.0
13 stars 4 forks source link

Astrea

Astrea is a software capable of generate SHACL shapes from one or more given ontologies. It relies on a set of equivalences between the OWL2 constructs and the SHACL constructs, which are exploit by means of a set of SPARQL queries. The idea behind Astrea is to rely on a set of mappings between such specifications, and a list of queries so by just applying the queries over one or more owl files the associated shapes can be generated.

In this repository the software provided imports all the ontologies associated to the construct owl:imports for an input ontology, in addition in its methods counts with the option of importing more than one ontology URL to generate their shapes. Consider that the shapes generated are associated only to the types and properties specified in the ontology, therefore providing more than one URL can be useful if one ontology references elements from another but it does not import it.

The Astrea resources, besides the java library which latest version can be downloaded from the releases tab, include the following elements:

Astrea Demo: Astrea has been integrated as a web service and published online. In addition, the source code of this demo can be found at its GitHub repository

1 - Install Astrea

In order to use the Astrea as java library for third-party components there are two approaches: import the library as a jar or install Astrea as a local maven dependency and then use your pom.xml to import it. Following we provide a guide for both options.

1.1 Import Astrea as a jar

Download the last release from our GitHub. Then, import the jar file in a project .

1.2 Instaling as local maven dependency

Astrea can be installed as a local dependency. For this purpose download the code from this repository:

git clone https://github.com/oeg-upm/Astrea.git

Then, install the project as a local maven dependency, for which you can run the script that we provide

bash mvn-install.sh

Finally, import in a project the Astrea maven dependency using the following code in your pom.xml:

<dependency>
    <groupId>oeg.validation</groupId>
    <artifactId>astrea</artifactId>
    <version>1.2.1</version>
</dependency>

Alternatively, Astrea can be installed as a local dependency following these steps:

  1. Compile the project:
    mvn clean package -Dskiptests
  2. Compile the project:
    mvn install:install-file -Dfile=./target/astrea-1.2.1.jar -DgroupId=oeg.validation -DartifactId=astrea -Dversion=1.2.1 -Dpackaging=jar
  3. Import the dependency in your project using the pom file relying on the previous snipped

2 - Quick start

Astrea can be used as a java library for third-party java projects, in you code create an instance of our Astrea object as follows:

ShaclFromOwl sharper = new OwlGenerator();

Having this object the shapes, which will be provided as jena Models, can be generated using different methods:

Keep in mind that Astrea will automatically include all the ontologies that are specified under the owl:imports statement, and therefore, it will generate their shapes as well.

To check other constructors of the OwlGenerator class read our java doc