RDF validation tutorial

Jose Emilio Labra Gayo
Jose Emilio Labra GayoResearcher - University of Oviedo at University of Oviedo
RDF Validation tutorial
ShEx/SHACL by example
Eric Prud'hommeaux
World Wide Web, USA
Harold Solbrig
Mayo Clinic, USA
Jose Emilio Labra Gayo
WESO Research group
Spain
Iovka Boneva
LINKS, INRIA & CNRS, France
Contents
Overview of RDF data model
Motivation for RDF Validation and previous approaches
ShEx by example
SHACL by example
ShEx vs SHACL
RDF Data Model
Overview of RDF Data Model and simple exercise
Link to slides about
RDF Data Model
http://www.slideshare.net/jelabra/rdf-data-model
RDF, the good parts...
RDF as an integration language
RDF as a lingua franca for semantic web and linked data
RDF data stores & SPARQL
RDF flexibility
Data can be adapted to multiple environments
Open and reusable data by default
RDF, the other parts
Inference & knowledge representation
RDF should combine well with KR vocabularies (RDF Schema, OWL...)
Performance of RDF based systems with inference = challenging
Consuming & producing RDF
Multiple serializations: Turtle, RDF/XML, JSON-LD, ...
Embedding RDF in HTML
Describing and validating RDF content
Why describe & validate RDF?
For RDF producers
Developers can understand the contents they are going to produce
They can ensure they produce the expected structure
Advertise the structure
Generate interfaces
For RDF consumers
Understand the contents
Verify the structure before processing it
Query generation & optimization
Similar technologies
Technology Schema
Relational Databases DDL
XML DTD, XML Schema, RelaxNG
Json Json Schema
RDF ?
Our goal is to fill that gap
Understanding the problem
RDF is composed by nodes and arcs between nodes
We can describe/check
form of the node itself (node constraint)
number of possible arcs incoming/outgoing from a node
possible values associated with those arcs
:alice schema:name "Alice";
schema:knows :bob .
IRI schema:name string (1, 1) ;
schema:knows IRI (0, *)
RDF Node
Shape of RDF
Nodes that
represent Users
<User> IRI {
schema:name xsd:string ;
schema:knows IRI *
}
ShEx
Understanding the problem
RDF validation ≠ ontology definition ≠ instance data
Ontologies are usually focused on real world entities
RDF validation is focused on RDF graph features (lower level)
Ontology
Constraints
RDF Validation
Instance data
Different levels
:alice schema:name "Alice";
schema:knows :bob .
<User> IRI {
schema:name xsd:string ;
schema:knows IRI
}
schema:knows a owl:ObjectProperty ;
rdfs:domain schema:Person ;
rdfs:range schema:Person .
A user must have only two properties:
schema:name of value xsd:string
schema:knows with an IRI value
Understanding the problem
Shapes ≠ types
Nodes in RDF graphs can have zero, one or many rdf:type arcs
One type can be used for multiple purposes (foaf:Person)
Data doesn't need to be annotated with fully discriminating types
foaf:Person can represent friend, invitee, patient,...
Different meanings and different structure depending on the context
We should be able to define specific validation constraints in different contexts
Understanding the problem
RDF flexibility
Mixed use of objects & literals
schema:creator can be a string or schema:Person in the same data
:angie schema:creator "Keith Richards" ,
[ a schema:Person ;
schema:singleName "Mick" ;
schema:lastName "Jagger"
] .
See other examples from http://schema.org
Understanding the problem
Repeated properties
Sometimes, the same property is used for different purposes in the
same data
Example: A book record must have 2 codes with different structure
:book schema:productID "isbn:123-456-789";
schema:productID "code456" .
A practical example from FHIR
See: http://hl7-fhir.github.io/observation-example-bloodpressure.ttl.html
Previous RDF validation approaches
SPARQL based
Plain SPARQL
SPIN: http://spinrdf.org/
OWL based
Stardog ICV
http://docs.stardog.com/icv/icv-specification.html
Grammar based
OSLC Resource Shapes
https://www.w3.org/Submission/2014/SUBM-shapes-20140211/
Use SPARQL queries to detect errors
Pros:
Expressive
Ubiquitous
Cons
Expressive
Idiomatic - many ways to encode
the same constraint
ASK {{ SELECT ?Person {
?Person schema:name ?o .
} GROUP BY ?Person HAVING (COUNT(*)=1)
}
{ SELECT ?Person {
?Person schema:name ?o .
FILTER ( isLiteral(?o) &&
datatype(?o) = xsd:string )
} GROUP BY ?Person HAVING (COUNT(*)=1)
}
{ SELECT ?Person (COUNT(*) AS ?c1) {
?Person schema:gender ?o .
} GROUP BY ?Person HAVING (COUNT(*)=1)}
{ SELECT ?Person (COUNT(*) AS ?c2) {
?S schema:gender ?o .
FILTER ((?o = schema:Female ||
?o = schema:Male))
} GROUP BY ?Person HAVING (COUNT(*)=1)}
FILTER (?c1 = ?c2)
}
Example:
schema:name must be a xsd:string
schema:gender must be schema:Male or schema:Female
SPIN
SPARQL inferencing notation http://spinrdf.org/
Developed by TopQuadrant
Commercial product
Vocabulary associated with user-defined functions in SPARQL
SPIN has influenced SHACL (see later)
Stardog ICV
ICV - Integrity Constraint Validation
Commercial product
OWL with unique name assumption and closed world
Compiled to SPARQL
More info: http://docs.stardog.com/icv/icv-specification.html
OSLC Resource Shapes
OSLC Resource Shapes
https://www.w3.org/Submission/shapes/
Grammar based approach
Language for RDF validation
Less expressive than ShEx
:user a rs:ResourceShape ;
rs:property [
rs:name "name" ;
rs:propertyDefinition schema:name ;
rs:valueType xsd:string ;
rs:occurs rs:Exactly-one ;
] ;
rs:property [
rs:name "gender" ;
rs:propertyDefinition schema:gender ;
rs:allowedValue schema:Male, schema:Female ;
rs:occurs rs:Zero-or-one ;
].
Other approaches
Dublin Core Application profiles (K. Coyle, T. Baker)
http://dublincore.org/documents/dc-dsp/
RDF Data Descriptions (Fischer et al)
http://ceur-ws.org/Vol-1330/paper-33.pdf
RDFUnit (D. Kontokostas)
http://aksw.org/Projects/RDFUnit.html
...
ShEx and SHACL
2013 RDF Validation Workshop
Conclusions of the workshop:
There is a need of a higher level, concise language for RDF Validation
ShEx initially proposed by Eric Prud'hommeaux
2014 W3c Data Shapes WG chartered
2015 SHACL as a deliverable from the WG
Continue this tutorial with...
ShEx by example
SHACL by example
ShEx vs SHACL
Future work and
applications
http://www.slideshare.net/jelabra/shex-by-example
http://www.slideshare.net/jelabra/shacl-by-example
http://www.slideshare.net/jelabra/shex-vs-shacl
http://www.slideshare.net/jelabra/rdf-validation-future-work-and-applications
1 of 20

Recommended

SHACL: Shaping the Big Ball of Data Mud by
SHACL: Shaping the Big Ball of Data MudSHACL: Shaping the Big Ball of Data Mud
SHACL: Shaping the Big Ball of Data MudRichard Cyganiak
6.5K views50 slides
RDF data validation 2017 SHACL by
RDF data validation 2017 SHACLRDF data validation 2017 SHACL
RDF data validation 2017 SHACLJean-Paul Calbimonte
901 views54 slides
SHACL by example by
SHACL by exampleSHACL by example
SHACL by exampleJose Emilio Labra Gayo
13.6K views44 slides
ShEx vs SHACL by
ShEx vs SHACLShEx vs SHACL
ShEx vs SHACLJose Emilio Labra Gayo
5.6K views33 slides
ShEx by Example by
ShEx by ExampleShEx by Example
ShEx by ExampleJose Emilio Labra Gayo
1.7K views58 slides
RDF data model by
RDF data modelRDF data model
RDF data modelJose Emilio Labra Gayo
3.3K views12 slides

More Related Content

What's hot

An Introduction to SPARQL by
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
15K views52 slides
RDF Data Model by
RDF Data ModelRDF Data Model
RDF Data ModelJose Emilio Labra Gayo
2.6K views49 slides
Validating RDF data: Challenges and perspectives by
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesJose Emilio Labra Gayo
1.3K views63 slides
Mapping Hierarchical Sources into RDF using the RML Mapping Language by
Mapping Hierarchical Sources into RDF using the RML Mapping LanguageMapping Hierarchical Sources into RDF using the RML Mapping Language
Mapping Hierarchical Sources into RDF using the RML Mapping Languageandimou
2.1K views41 slides
JSON-LD and SHACL for Knowledge Graphs by
JSON-LD and SHACL for Knowledge GraphsJSON-LD and SHACL for Knowledge Graphs
JSON-LD and SHACL for Knowledge GraphsFranz Inc. - AllegroGraph
1.2K views29 slides
SPARQL-DL - Theory & Practice by
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
4K views27 slides

What's hot(20)

An Introduction to SPARQL by Olaf Hartig
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
Olaf Hartig15K views
Mapping Hierarchical Sources into RDF using the RML Mapping Language by andimou
Mapping Hierarchical Sources into RDF using the RML Mapping LanguageMapping Hierarchical Sources into RDF using the RML Mapping Language
Mapping Hierarchical Sources into RDF using the RML Mapping Language
andimou2.1K views
SPARQL-DL - Theory & Practice by Adriel Café
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
Adriel Café4K views
SPARQL Tutorial by Leigh Dodds
SPARQL TutorialSPARQL Tutorial
SPARQL Tutorial
Leigh Dodds20.3K views
SPARQL Cheat Sheet by LeeFeigenbaum
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
LeeFeigenbaum92.3K views
Jena – A Semantic Web Framework for Java by Aleksander Pohl
Jena – A Semantic Web Framework for JavaJena – A Semantic Web Framework for Java
Jena – A Semantic Web Framework for Java
Aleksander Pohl5.2K views
RDF 개념 및 구문 소개 by Dongbum Kim
RDF 개념 및 구문 소개RDF 개념 및 구문 소개
RDF 개념 및 구문 소개
Dongbum Kim21.2K views
Building Next-Generation Web APIs with JSON-LD and Hydra by Markus Lanthaler
Building Next-Generation Web APIs with JSON-LD and HydraBuilding Next-Generation Web APIs with JSON-LD and Hydra
Building Next-Generation Web APIs with JSON-LD and Hydra
Markus Lanthaler42K views
SHACL in Apache jena - ApacheCon2020 by andyseaborne
SHACL in Apache jena - ApacheCon2020SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020
andyseaborne383 views
SPARQL 사용법 by 홍수 허
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
홍수 허897 views
Introduction to RDF by Narni Rajesh
Introduction to RDFIntroduction to RDF
Introduction to RDF
Narni Rajesh6.4K views
Introduction To RDF and RDFS by Nilesh Wagmare
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
Nilesh Wagmare1.2K views
Getting Started with Knowledge Graphs by Peter Haase
Getting Started with Knowledge GraphsGetting Started with Knowledge Graphs
Getting Started with Knowledge Graphs
Peter Haase13.9K views
온톨로지 개념 및 표현언어 by Dongbum Kim
온톨로지 개념 및 표현언어온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어
Dongbum Kim12.4K views

Similar to RDF validation tutorial

Understanding RDF: the Resource Description Framework in Context (1999) by
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)Dan Brickley
7.3K views19 slides
Towards an RDF Validation Language based on Regular Expression Derivatives by
Towards an RDF Validation Language based on Regular Expression DerivativesTowards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression DerivativesJose Emilio Labra Gayo
1.7K views28 slides
Validating and Describing Linked Data Portals using RDF Shape Expressions by
Validating and Describing Linked Data Portals using RDF Shape ExpressionsValidating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape ExpressionsJose Emilio Labra Gayo
1.6K views29 slides
A year on the Semantic Web @ W3C by
A year on the Semantic Web @ W3CA year on the Semantic Web @ W3C
A year on the Semantic Web @ W3CIvan Herman
865 views42 slides
Semantic web meetup – sparql tutorial by
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialAdonisDamian
6.2K views25 slides
SWT Lecture Session 2 - RDF by
SWT Lecture Session 2 - RDFSWT Lecture Session 2 - RDF
SWT Lecture Session 2 - RDFMariano Rodriguez-Muro
2.2K views86 slides

Similar to RDF validation tutorial(20)

Understanding RDF: the Resource Description Framework in Context (1999) by Dan Brickley
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
Dan Brickley7.3K views
Towards an RDF Validation Language based on Regular Expression Derivatives by Jose Emilio Labra Gayo
Towards an RDF Validation Language based on Regular Expression DerivativesTowards an RDF Validation Language based on Regular Expression Derivatives
Towards an RDF Validation Language based on Regular Expression Derivatives
Validating and Describing Linked Data Portals using RDF Shape Expressions by Jose Emilio Labra Gayo
Validating and Describing Linked Data Portals using RDF Shape ExpressionsValidating and Describing Linked Data Portals using RDF Shape Expressions
Validating and Describing Linked Data Portals using RDF Shape Expressions
A year on the Semantic Web @ W3C by Ivan Herman
A year on the Semantic Web @ W3CA year on the Semantic Web @ W3C
A year on the Semantic Web @ W3C
Ivan Herman865 views
Semantic web meetup – sparql tutorial by AdonisDamian
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
AdonisDamian6.2K views
Rdf data-model-and-storage by 灿辉 葛
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage
灿辉 葛945 views
Sparql service-description by STIinnsbruck
Sparql service-descriptionSparql service-description
Sparql service-description
STIinnsbruck239 views
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio by Open Knowledge Belgium
Do it on your own - From 3 to 5 Star Linked Open Data with RMLioDo it on your own - From 3 to 5 Star Linked Open Data with RMLio
Do it on your own - From 3 to 5 Star Linked Open Data with RMLio
2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop... by Dr.-Ing. Thomas Hartmann
2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop...2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop...
2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop...
Introduction to Application Profiles by Diane Hillmann
Introduction to Application ProfilesIntroduction to Application Profiles
Introduction to Application Profiles
Diane Hillmann3.8K views
A Hands On Overview Of The Semantic Web by Shamod Lacoul
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
Shamod Lacoul6.1K views
CSHALS 2010 W3C Semanic Web Tutorial by LeeFeigenbaum
CSHALS 2010 W3C Semanic Web TutorialCSHALS 2010 W3C Semanic Web Tutorial
CSHALS 2010 W3C Semanic Web Tutorial
LeeFeigenbaum2.5K views
SemanticWeb Nuts 'n Bolts by Rinke Hoekstra
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n Bolts
Rinke Hoekstra2.1K views
Doctoral Examination at the Karlsruhe Institute of Technology (08.07.2016) by Dr.-Ing. Thomas Hartmann
Doctoral Examination at the Karlsruhe Institute of Technology (08.07.2016)Doctoral Examination at the Karlsruhe Institute of Technology (08.07.2016)
Doctoral Examination at the Karlsruhe Institute of Technology (08.07.2016)

More from Jose Emilio Labra Gayo

Publicaciones de investigación by
Publicaciones de investigaciónPublicaciones de investigación
Publicaciones de investigaciónJose Emilio Labra Gayo
420 views28 slides
Introducción a la investigación/doctorado by
Introducción a la investigación/doctoradoIntroducción a la investigación/doctorado
Introducción a la investigación/doctoradoJose Emilio Labra Gayo
252 views16 slides
Legislative data portals and linked data quality by
Legislative data portals and linked data qualityLegislative data portals and linked data quality
Legislative data portals and linked data qualityJose Emilio Labra Gayo
460 views60 slides
Wikidata by
WikidataWikidata
WikidataJose Emilio Labra Gayo
4.3K views49 slides
Legislative document content extraction based on Semantic Web technologies by
Legislative document content extraction based on Semantic Web technologiesLegislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologiesJose Emilio Labra Gayo
661 views34 slides
Introduction to SPARQL by
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQLJose Emilio Labra Gayo
554 views78 slides

More from Jose Emilio Labra Gayo(20)

Legislative document content extraction based on Semantic Web technologies by Jose Emilio Labra Gayo
Legislative document content extraction based on Semantic Web technologiesLegislative document content extraction based on Semantic Web technologies
Legislative document content extraction based on Semantic Web technologies

Recently uploaded

SPICE PARK DEC2023 (6,625 SPICE Models) by
SPICE PARK DEC2023 (6,625 SPICE Models) SPICE PARK DEC2023 (6,625 SPICE Models)
SPICE PARK DEC2023 (6,625 SPICE Models) Tsuyoshi Horigome
14 views218 slides
Dynamics of Hard-Magnetic Soft Materials by
Dynamics of Hard-Magnetic Soft MaterialsDynamics of Hard-Magnetic Soft Materials
Dynamics of Hard-Magnetic Soft MaterialsShivendra Nandan
13 views32 slides
Solar PV by
Solar PVSolar PV
Solar PVIwiss Tools Co.,Ltd
12 views4 slides
SEMI CONDUCTORS by
SEMI CONDUCTORSSEMI CONDUCTORS
SEMI CONDUCTORSpavaniaalla2005
19 views8 slides
A multi-microcontroller-based hardware for deploying Tiny machine learning mo... by
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...A multi-microcontroller-based hardware for deploying Tiny machine learning mo...
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...IJECEIAES
10 views10 slides
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L... by
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...Anowar Hossain
10 views34 slides

Recently uploaded(20)

Dynamics of Hard-Magnetic Soft Materials by Shivendra Nandan
Dynamics of Hard-Magnetic Soft MaterialsDynamics of Hard-Magnetic Soft Materials
Dynamics of Hard-Magnetic Soft Materials
Shivendra Nandan13 views
A multi-microcontroller-based hardware for deploying Tiny machine learning mo... by IJECEIAES
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...A multi-microcontroller-based hardware for deploying Tiny machine learning mo...
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...
IJECEIAES10 views
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L... by Anowar Hossain
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
DevOps to DevSecOps: Enhancing Software Security Throughout The Development L...
Anowar Hossain10 views
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx by AnnieRachelJohn
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptxSTUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx
AnnieRachelJohn25 views
7_DVD_Combinational_MOS_Logic_Circuits.pdf by Usha Mehta
7_DVD_Combinational_MOS_Logic_Circuits.pdf7_DVD_Combinational_MOS_Logic_Circuits.pdf
7_DVD_Combinational_MOS_Logic_Circuits.pdf
Usha Mehta50 views
2_DVD_ASIC_Design_FLow.pdf by Usha Mehta
2_DVD_ASIC_Design_FLow.pdf2_DVD_ASIC_Design_FLow.pdf
2_DVD_ASIC_Design_FLow.pdf
Usha Mehta14 views
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,... by AakashShakya12
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
Literature review and Case study on Commercial Complex in Nepal, Durbar mall,...
AakashShakya1245 views

RDF validation tutorial

  • 1. RDF Validation tutorial ShEx/SHACL by example Eric Prud'hommeaux World Wide Web, USA Harold Solbrig Mayo Clinic, USA Jose Emilio Labra Gayo WESO Research group Spain Iovka Boneva LINKS, INRIA & CNRS, France
  • 2. Contents Overview of RDF data model Motivation for RDF Validation and previous approaches ShEx by example SHACL by example ShEx vs SHACL
  • 3. RDF Data Model Overview of RDF Data Model and simple exercise Link to slides about RDF Data Model http://www.slideshare.net/jelabra/rdf-data-model
  • 4. RDF, the good parts... RDF as an integration language RDF as a lingua franca for semantic web and linked data RDF data stores & SPARQL RDF flexibility Data can be adapted to multiple environments Open and reusable data by default
  • 5. RDF, the other parts Inference & knowledge representation RDF should combine well with KR vocabularies (RDF Schema, OWL...) Performance of RDF based systems with inference = challenging Consuming & producing RDF Multiple serializations: Turtle, RDF/XML, JSON-LD, ... Embedding RDF in HTML Describing and validating RDF content
  • 6. Why describe & validate RDF? For RDF producers Developers can understand the contents they are going to produce They can ensure they produce the expected structure Advertise the structure Generate interfaces For RDF consumers Understand the contents Verify the structure before processing it Query generation & optimization
  • 7. Similar technologies Technology Schema Relational Databases DDL XML DTD, XML Schema, RelaxNG Json Json Schema RDF ? Our goal is to fill that gap
  • 8. Understanding the problem RDF is composed by nodes and arcs between nodes We can describe/check form of the node itself (node constraint) number of possible arcs incoming/outgoing from a node possible values associated with those arcs :alice schema:name "Alice"; schema:knows :bob . IRI schema:name string (1, 1) ; schema:knows IRI (0, *) RDF Node Shape of RDF Nodes that represent Users <User> IRI { schema:name xsd:string ; schema:knows IRI * } ShEx
  • 9. Understanding the problem RDF validation ≠ ontology definition ≠ instance data Ontologies are usually focused on real world entities RDF validation is focused on RDF graph features (lower level) Ontology Constraints RDF Validation Instance data Different levels :alice schema:name "Alice"; schema:knows :bob . <User> IRI { schema:name xsd:string ; schema:knows IRI } schema:knows a owl:ObjectProperty ; rdfs:domain schema:Person ; rdfs:range schema:Person . A user must have only two properties: schema:name of value xsd:string schema:knows with an IRI value
  • 10. Understanding the problem Shapes ≠ types Nodes in RDF graphs can have zero, one or many rdf:type arcs One type can be used for multiple purposes (foaf:Person) Data doesn't need to be annotated with fully discriminating types foaf:Person can represent friend, invitee, patient,... Different meanings and different structure depending on the context We should be able to define specific validation constraints in different contexts
  • 11. Understanding the problem RDF flexibility Mixed use of objects & literals schema:creator can be a string or schema:Person in the same data :angie schema:creator "Keith Richards" , [ a schema:Person ; schema:singleName "Mick" ; schema:lastName "Jagger" ] . See other examples from http://schema.org
  • 12. Understanding the problem Repeated properties Sometimes, the same property is used for different purposes in the same data Example: A book record must have 2 codes with different structure :book schema:productID "isbn:123-456-789"; schema:productID "code456" . A practical example from FHIR See: http://hl7-fhir.github.io/observation-example-bloodpressure.ttl.html
  • 13. Previous RDF validation approaches SPARQL based Plain SPARQL SPIN: http://spinrdf.org/ OWL based Stardog ICV http://docs.stardog.com/icv/icv-specification.html Grammar based OSLC Resource Shapes https://www.w3.org/Submission/2014/SUBM-shapes-20140211/
  • 14. Use SPARQL queries to detect errors Pros: Expressive Ubiquitous Cons Expressive Idiomatic - many ways to encode the same constraint ASK {{ SELECT ?Person { ?Person schema:name ?o . } GROUP BY ?Person HAVING (COUNT(*)=1) } { SELECT ?Person { ?Person schema:name ?o . FILTER ( isLiteral(?o) && datatype(?o) = xsd:string ) } GROUP BY ?Person HAVING (COUNT(*)=1) } { SELECT ?Person (COUNT(*) AS ?c1) { ?Person schema:gender ?o . } GROUP BY ?Person HAVING (COUNT(*)=1)} { SELECT ?Person (COUNT(*) AS ?c2) { ?S schema:gender ?o . FILTER ((?o = schema:Female || ?o = schema:Male)) } GROUP BY ?Person HAVING (COUNT(*)=1)} FILTER (?c1 = ?c2) } Example: schema:name must be a xsd:string schema:gender must be schema:Male or schema:Female
  • 15. SPIN SPARQL inferencing notation http://spinrdf.org/ Developed by TopQuadrant Commercial product Vocabulary associated with user-defined functions in SPARQL SPIN has influenced SHACL (see later)
  • 16. Stardog ICV ICV - Integrity Constraint Validation Commercial product OWL with unique name assumption and closed world Compiled to SPARQL More info: http://docs.stardog.com/icv/icv-specification.html
  • 17. OSLC Resource Shapes OSLC Resource Shapes https://www.w3.org/Submission/shapes/ Grammar based approach Language for RDF validation Less expressive than ShEx :user a rs:ResourceShape ; rs:property [ rs:name "name" ; rs:propertyDefinition schema:name ; rs:valueType xsd:string ; rs:occurs rs:Exactly-one ; ] ; rs:property [ rs:name "gender" ; rs:propertyDefinition schema:gender ; rs:allowedValue schema:Male, schema:Female ; rs:occurs rs:Zero-or-one ; ].
  • 18. Other approaches Dublin Core Application profiles (K. Coyle, T. Baker) http://dublincore.org/documents/dc-dsp/ RDF Data Descriptions (Fischer et al) http://ceur-ws.org/Vol-1330/paper-33.pdf RDFUnit (D. Kontokostas) http://aksw.org/Projects/RDFUnit.html ...
  • 19. ShEx and SHACL 2013 RDF Validation Workshop Conclusions of the workshop: There is a need of a higher level, concise language for RDF Validation ShEx initially proposed by Eric Prud'hommeaux 2014 W3c Data Shapes WG chartered 2015 SHACL as a deliverable from the WG
  • 20. Continue this tutorial with... ShEx by example SHACL by example ShEx vs SHACL Future work and applications http://www.slideshare.net/jelabra/shex-by-example http://www.slideshare.net/jelabra/shacl-by-example http://www.slideshare.net/jelabra/shex-vs-shacl http://www.slideshare.net/jelabra/rdf-validation-future-work-and-applications