Skip to main content

Validating Shacl Constraints over a Sparql Endpoint

  • Conference paper
  • First Online:
Book cover The Semantic Web – ISWC 2019 (ISWC 2019)

Part of the book series: Lecture Notes in Computer Science ((LNISA,volume 11778))

Included in the following conference series:

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 to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    https://www.w3.org/TR/shacl/.

  2. 2.

    https://w3c.github.io/data-shapes/data-shapes-test-suite/.

  3. 3.

    with the exception of Shaclex [4], which can handle recursion, but not recursion and negation together in a principled way.

  4. 4.

    More exactly, I is an abstraction, standing for any syntactic constraint over an rdf term: exact value, datatype, regex, etc.

  5. 5.

    shacl paths are built like sparql property paths, but without the NegatedPropertySet operator.

  6. 6.

    We omit the trivial FILTER (?y1 = ?y1 AND ?y2 = ?y2) for readability.

  7. 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

  1. DBpedia. wiki.dbpedia.org/downloads-2016-10

  2. Extended version. https://www.inf.unibz.it/krdb/tech-reports/

  3. SHACL Test Suite. w3c.github.io/data-shapes/data-shapes-test-suite/

  4. Shaclex. http://github.com/labra/shaclex/

  5. Shex.js. http://github.com/shexSpec/shex.js/

  6. Source code and experiment’s material. http://github.com/rdfshapes/shacl-sparql

  7. Stardog ICV. https://www.stardog.com/blog/data-quality-with-icv/

  8. TopBraid Composer. http://www.topquadrant.com/products/topbraid-composer/

  9. Boneva, I., Labra Gayo, J.E., Prud’hommeaux, E.G.: Semantics and validation of shapes schemas for RDF. In: ISWC 2017

    Google Scholar 

  10. 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

    Chapter  Google Scholar 

  11. 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/

    Google Scholar 

  12. Corman, J., Reutter, J.L., Savković, O.: A tractable notion of stratification for SHACL. In: ISWC 2018

    Google Scholar 

  13. Kontokostas, D., et al.: Test-driven evaluation of linked data quality. In: WWW (2014)

    Google Scholar 

  14. 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)

    Article  Google Scholar 

  15. 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

    Chapter  Google Scholar 

  16. 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)

    Google Scholar 

  17. Tao, J., Sirin, E., Bao, J., McGuinness, D.L.: Integrity constraints in owl. In: AAAI (2010)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Julien Corman .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics