This book describes two languages for implementing constraints on RDF data, describing the main features of both Shape Expressions (ShEx) and Shapes Constraints Language (SHACL) from a user perspective, and also offering a comparison of the technologies. Throughout this book, we develop a small number of examples that typify validation requirements and demonstrate how they can be met with ShEx and SHACL. The book is not intended to be a formal specification of the languages, for which the interested reader can consult the corresponding reference documents, but rather, it is meant to serve as an introduction to the technologies with some background about the rationale of their design and some points of comparison.

Chapter 1 provides a brief introduction to the topic. Chapter 2 presents a short overview of the RDF data model and RDF-related technologies; this chapter could be skipped by any reader who already knows RDF or Turtle. Chapter 3 helps the reader to understand what to expect from data validation. It describes the problem of RDF validation and some approaches that have been proposed. This book specifically reviews two of these approaches in further detail: ShEx (Chapter 4) and SHACL (Chapter 5). These chapters describe each language and provide a practical introduction using examples. Following the discussion of both languages, Chapter 6 presents some applications using either ShEx, SHACL, or both. Finally, Chapter 7 compares ShEx and SHACL and offers some conclusions.

The goal of this book is to serve as a practical introduction to ShEx and SHACL using examples. While we omitted formal definitions or specifications, references for further reading can be found at the end of each chapter. We give a quick overview of some background and related technologies so that readers without RDF knowledge can follow the book's contents. Also, it is not necessary to have any prior knowledge of programming or ontologies to understand RDF validation technologies. The intended audience is anyone interested in data representation and quality.

About the Author(s)

Jose Emilio Labra Gayo, University of OviedoFounder and main researcher of WESO (Web Semantics Oviedo) research group, which collaborates with different companies around the world applying semantic web technologies to solve practical problems. The development of data portals for several companies and public administrations led to his interest on RDF validation. Member of the W3C Data Shapes working group and of three W3C community groups: Shape Expressions, SHACL and RAX (RDF and XML interoperability). Chairman of the Best practices of Multilingual Linked Open Data community group. He implemented the SHACL and ShEx library Shaclex and maintains an online RDF validator service. He has also written an introductory book about Semantic Web in Spanish.

Eric Prudhommeaux, W3CEric is the W3C staff contact for the Health Care and Life Sciences Interest Group, RDF Data Shapes (RDF Validation), LDP, RDF 1.1, SPARQL 1.1, RDB2RDF, SPARQL 1.0, SAWSDL and XML Protocol Working Groups. He has developed and designed multiple languages, including a signiï¬cant contribution to SPARQL and ShEx. He developed the Javascript ShEx library to promote understanding about and exploitation of Shape Expressions.

Iovka Boneva, University of LilleIovka is an Associate Professor at University of Lille, France, and member of the Links research project affiliated to Inria - Lille Nord Europe and CRIStAL (Centre de Recherche en Informatique, Signal et Automatique). She has been working on expressive languages for describing and querying tree-structured data, and more recently on data exchange for relational and graph data. She was a member of the W3C RDF Data Shapes Working Group and is a member of the W3C Shape Expressions community group. She has developed the theoretical foundations of the Shape Expressions Language.

Dimitris Kontokostas, University of LeipzigDimitris is a Knowledge Engineer and Semantic Web researcher at the University of Leipzig and the DBpedia Association. He has been working on knowledge representation and knowledge management of large-scale knowledge graphs and data quality. Dimitris is a member of the RDF Data Shapes working group, a member and the chairman of the Shape Expressions Community Group and co-editor of SHACL. He is the creator of RDFUnit, a tool and unit-testing framework for RDF validation that supports SHACL, OSLC Resource Shapes and DC Description Set Profiles.