Astrea Documentation

Astrea Licensing

In this section we provide the materials on top of which Astrea is built and how to reference or cite them. Our contributions are the following:

How to cite Astrea

Cimmino, A., Fernández-Izquierdo, A., & García-Castro, R. (2020). Astrea: automatic generation of SHACL shapes from ontologies. In European Semantic Web Conference..

Astrea Knowledge Graph

Astrea relies on its Knowledge Graph, which contains all the mappings required to generate the SHACL shapes from the given ontologies. Although the mappings within the Knowledge Graph are listed below in this documentation, the RDF dataset can be downloaded from the Zenodo repository.

Astrea (interactive) REST API

Astrea can be used through the web or thorugh its REST API that allows the generating of SHACL shapes from a set of Ontology urls, or directly posting an ontology content. In addition, the REST API counts with a validation interface that given an RDF document and a SHAPE outputs a validation report. This validation has as an aditional feature that can specify in the report which types from the data were covered by the provided shape; consider that all the data not covered by the shape is always validated as true. For more information, visit the REST API interactive documentation

Astrea Ontology

The Astrea Knowledge Graph, available at Zenodo, contains and publishes the information of the 157 mappings developed. A vocabulary to model these mappings has been defined. Figure 1 shows an overview of such vocabulary, which models the relation between the mappings between ontology and SHACL construct patterns, and the mappings implementation as SPARQL queries.

Figure 1 - Ontology developed to express the Astrea mappings.

As depicted in Figure 1,two Patterns can be mapped by each other, which indicates that they are equivalent. Any of these pattern could be an OntologyPattern, if the pattern includes statements that contain any construct from OWL, RDFs, or XSD. Alternatively a pattern may be a SHACLPattern, if it includes statements that contain SHACL constructs. A Pattern can be mapped by other Pattern, and this relation is symmetric. Furthermore, each Pattern is related to a MappingImplementation which contains the necessary information to translate this source pattern to the equivalent target pattern.

An example of mapping is depicted in Figure 2. It can be observed that the OntologyPattern is capturing the cardinality pattern when is specified as an owl:Restriction for an owl:Class. Similarly, the SHACLPattern refers to a sh:PropertyShape related to a sh:NodeShape, which has a sh:minCount and sh:maxCount. These two patterns are related by means of the isMappedBy relation, which indicates that the OntologyPattern is mapped by the SHACLPattern and vice versa.

Figure 2 - Exmaple of mapping expressed with this ontology.

Finally, in order to generate a shape the OntologyPattern is related to a MappingImplementation instance that implements such translation by means of a SPARQL query; notice that the WHERE clause encodes the ontology contruct pattern and the CONTRUCT the SHACL contruct pattern.

Mappings description

The cornerstone element to automatically generate shapes from a set of ontologies are the mappings within the Astrea-KG. These mappings relate one, or more, ontology construct patterns with their equivalent SHACL construct patterns. The ontology constructs patterns include constructs from the wellknown OWL 2, RDFS, and XSD specifications. In addition, the mappings have been implemented as SPARQL CONSTRUCT queries in which the WHERE clause contains the ontology construct patterns, and the CONSTRUCT clause the SHACL construct patterns.

Notice that from a conceptual point of view the mappings are bi-directional, since they relate construct patterns. Nevertheless, their implementation is not bi-directional: the current SPARQL queries identify ontology construct patterns and translates them into the equivalent SHACL construct pattern.

Previous works already stated the similarity between OWL and SHACL constructs. However, during the development of the mappings we notice that the relation between single constructs was not enough to generate the shapes. The reason is that an ontology construct may be specified within different contextsand the equivalent SHACL may change depending on such context. As a result, the mappings relate patterns of constructs rather than just constructs.

For instance, the RDFS construct rdfs:range can be considered equivalent to the SHACL construct sh:class. But in order to such equivalence be correct the rdfs:range has to be defined in the context of an owl:ObjectProperty. Figure 1 shows the SHACL construct pattern of the sh:class that is related to the ontology contruct rdfs:range. Notice that this SHACL construct makes only sense in the context of a sh:PropertyShape.

Figure 1 - SHACL contruct pattern for sh:class.

Figure 2 reports the ontology construct pattern for rdfs:range that is equivalent to the one of Figure 1. However, the statement rdfs:range could be expressed alternatively: instead of having an URL in its range it may have a blank node that has different properties owl:unionOf, owl:someValuesFrom, or owl:allValuesFrom among others. For these cases other ontology construct patterns must be specified, like the one reported in Figure 3. Both ontology construct patterns are different yet they are equivalent to the same SHACL construct pattern.

Figure 2 - Ontology construct pattern for rdfs:range.
Figure 3 - Alternative ontology construct pattern for rdfs:range.

As it can be noticed the constructs are not enough to automatically generate shapes, patterns of constructs are required in the mappings to generate the shapes. Also, it is worth mentioning that different ontology constructs patterns may generate the same SHACL construct pattern, or vice versa.

Mappings list

The following table shows the mappings identified between the Ontology construct patterns and SHACL construct patterns. The tables includes the constructs, their associated patterns, and a SPARQL query that implements the transformation from ontology to shape.

In addition, the search form can be used to filter the table with some suitable constructs that a user may would like to found in the table.