Abstract
shacl (Shapes Constraint Language) is a specification for describing and validating RDF graphs that has recently become a W3C recommendation. While the language is gaining traction in the industry, algorithms for shacl constraint validation are still at an early stage. A first challenge comes from the fact that RDF graphs are often exposed as sparql endpoints, and therefore only accessible via queries. Another difficulty is the absence of guidelines about the way recursive constraints should be handled. In this paper, we provide algorithms for validating a graph against a shacl schema, which can be executed over a sparql endpoint. We first investigate the possibility of validating a graph through a single query for non-recursive constraints. Then for the recursive case, since the problem has been shown to be NP-hard, we propose a strategy that consists in evaluating a small number of sparql queries over the endpoint, and using the answers to build a set of propositional formulas that are passed to a SAT solver. Finally, we show that the process can be optimized when dealing with recursive but tractable fragments of shacl, without the need for an external solver. We also present a proof-of-concept evaluation of this last approach.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
- 2.
- 3.
with the exception of Shaclex [4], which can handle recursion, but not recursion and negation together in a principled way.
- 4.
More exactly, I is an abstraction, standing for any syntactic constraint over an rdf term: exact value, datatype, regex, etc.
- 5.
shacl paths are built like sparql property paths, but without the NegatedPropertySet operator.
- 6.
We omit the trivial FILTER (?y1 = ?y1 AND ?y2 = ?y2) for readability.
- 7.
For some normalized schemas, it could happen that \([\![q_{{{\,\mathrm{def}\,}}(s)} ]\!]^{\mathcal {G}}\) always retrieves all nodes from \(\mathcal {G} \). This would be the case for example if \({{\,\mathrm{def}\,}}(s) = s_1 \wedge s_2\). A simple optimization technique here consists in not executing such queries, and instantiate instead the rule pattern \(p_{{{\,\mathrm{def}\,}}(s)}\) with all nodes retrieved by all other queries (and bound to variable ?x).
References
DBpedia. wiki.dbpedia.org/downloads-2016-10
Extended version. https://www.inf.unibz.it/krdb/tech-reports/
SHACL Test Suite. w3c.github.io/data-shapes/data-shapes-test-suite/
Shaclex. http://github.com/labra/shaclex/
Shex.js. http://github.com/shexSpec/shex.js/
Source code and experiment’s material. http://github.com/rdfshapes/shacl-sparql
Stardog ICV. https://www.stardog.com/blog/data-quality-with-icv/
TopBraid Composer. http://www.topquadrant.com/products/topbraid-composer/
Boneva, I., Labra Gayo, J.E., Prud’hommeaux, E.G.: Semantics and validation of shapes schemas for RDF. In: ISWC 2017
Corman, J., Reutter, J.L., Savković, O.: Semantics and validation of recursive SHACL. In: Vrandečić, D., Bontcheva, K., Suárez-Figueroa, M.C., Presutti, V., Celino, I., Sabou, M., Kaffee, L.-A., Simperl, E. (eds.) ISWC 2018. LNCS, vol. 11136, pp. 318–336. Springer, Cham (2018). https://doi.org/10.1007/978-3-030-00671-6_19
Corman, J., Reutter, J.L., Savković, O.: Semantics and validation of recursive SHACL (extended version). Technical report KRDB18-1, Free University Bozen-Bolzano (2018). https://www.inf.unibz.it/krdb/tech-reports/
Corman, J., Reutter, J.L., Savković, O.: A tractable notion of stratification for SHACL. In: ISWC 2018
Kontokostas, D., et al.: Test-driven evaluation of linked data quality. In: WWW (2014)
Motik, B., Horrocks, I., Sattler, U.: Bridging the gap between OWL and relational databases. Web Semant.: Sci. Serv. Agents World Wide Web 7(2), 74–89 (2009)
Reutter, J.L., Soto, A., Vrgoč, D.: Recursion in SPARQL. In: Arenas, M., et al. (eds.) ISWC 2015. LNCS, vol. 9366, pp. 19–35. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-25007-6_2
Staworko, S., Boneva, I., Labra Gayo, J.E., Hym, S., Prud’hommeaux, E.G., Solbrig, H.: Complexity and expressiveness of ShEx for RDF. In: ICDT (2015)
Tao, J., Sirin, E., Bao, J., McGuinness, D.L.: Integrity constraints in owl. In: AAAI (2010)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Corman, J., Florenzano, F., Reutter, J.L., Savković, O. (2019). Validating Shacl Constraints over a Sparql Endpoint. In: Ghidini, C., et al. The Semantic Web – ISWC 2019. ISWC 2019. Lecture Notes in Computer Science(), vol 11778. Springer, Cham. https://doi.org/10.1007/978-3-030-30793-6_9
Download citation
DOI: https://doi.org/10.1007/978-3-030-30793-6_9
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-30792-9
Online ISBN: 978-3-030-30793-6
eBook Packages: Computer ScienceComputer Science (R0)