Towards an RDF Validation Language based on Regular Expression Derivatives

Jose Emilio Labra Gayo
Jose Emilio Labra GayoResearcher - University of Oviedo at University of Oviedo
Towards an RDF Validation Language
based on Regular Expression Derivatives
Eric Prud'hommeaux
World Wide Web
Consortium
MIT, Cambridge, MA, USA
Harold Solbrig
Mayo Clinic
USA
College of Medicine, Rochester,
MN, USA
Jose Emilio Labra Gayo
WESO Research group
University of Oviedo
Spain
Sławek Staworko
LINKS, INRIA & CNRS
University of Lille, France
Overview
Shape Expressions for RDF validation - Justification
Regular Shape Expressions
Axiomatic Semantics
Implementation based on Derivatives
Regular Shape Expression Schemas
Adapt Axiomatic Semantics to Schemas
Adapt Implementation based on Derivatives
Conclusions & Future work
Shape Expressions
Simple and intuitive language that can:
Describe the topology of RDF data
Validate that RDF instance data matches a shape
Two syntaxes
Compact syntax (inspired by RelaxNG, Turtle and SPARQL)
RDF
Related to W3c RDF Data Shapes Working Group
Example: RDF model of a Person
Person__
foaf:age xsd:integer
foaf:name xsd:string +
0..*
foaf:knows
:john foaf:age 23;
foaf:name "John";
foaf:knows :bob .
:bob foaf:age 34;
foaf:name "Bob", "Robert" .


<Person> {
foaf:age xsd:integer
, foaf:name xsd:string+
, foaf:knows @<Person>*
}
Shape Expressions Schema
Some RDF data
:mary foaf:age 50, 65 .
E-R Diagram
Why not SPARQL?
<Person> {
foaf:age xsd:integer
, foaf:name xsd:string+
, foaf:knows @<Person>*
}ASK { { SELECT ?Person {
?Person foaf:age ?o .
} GROUP BY ?Person HAVING (COUNT(*)=1)
}
{ SELECT ?Person {
?Person foaf:age ?o .
FILTER ( isLiteral(?o) &&
datatype(?o) = xsd:integer )
} GROUP BY ?Person HAVING (COUNT(*)=1)
}
...
1
2
3
4
5
6
7
8
9
10
...
...
{ SELECT ?Person (COUNT(*) AS ?Person_c0) {
?Person foaf:name ?o .
} GROUP BY ?Person HAVING (COUNT(*)>=1)
}
{ SELECT ?Person (COUNT(*) AS ?Person_c1) {
?Person foaf:name ?o .
FILTER (isLiteral(?o) &&
datatype(?o) = xsd:string)
} GROUP BY ?Person HAVING (COUNT(*)>=1) }
FILTER (?Person_c0 = ?Person_c1)
...
...
11
12
13
14
15
16
17
18
19
20
...
...
{ { { SELECT ?Person (COUNT(*) AS ?Person_c2) {
?Person foaf:knows ?o .
} GROUP BY ?Person }
{ SELECT ?Person (COUNT(*) AS ?Person_c3) {
?Person foaf:knows ?o .
FILTER ((isIRI(?o) || isBlank(?o)))
} GROUP BY ?Person HAVING (COUNT(*) >= 1)
}
FILTER (?Person_c2 = ?Person_c3)
}
...
...
21
22
23
24
25
26
27
28
29
30
...
...
UNION {
SELECT ?Person {
OPTIONAL { ?Person foaf:knows ?o }
FILTER (!bound(?o))
}
}
}
}
...
31
32
33
34
35
36
37
38
1
2
3
4
5
Regular Shape Expressions (RSEs)
Simplified version of Shape Expressions
Based on Regular Expressions
Sets of triples instead of list of characters
Interleave instead of concatenation
Abstract syntax
Shape Expressions vs RSEs*
<Shape1> {
foaf:age xsd:integer
, foaf:name xsd:string*
}
Example1:
Shape Expression RSE
* Note: We are considering a subset of Shape Expressions with Closed Shapes, and inclusive Or
<Shape2> {
:a ( 1 )
, :b ( 1 2 ) *
}
Example 2:
Cardinalities in RSEs
Cardinalities can be defined as:
Example:
Shape of a RSE:
Example
Simplification rules
It is easy to show that the operators obey:
Matching triples with RSEs
Example matching tree
Rules employed
Derivatives of RSEs
Brzozowski's algorithm (1964) developed for Regular Expressions
We adapted that algorithm to RSEs
Calculates the derivative of a RSE with respect to a triple t:
Definition:
Calculating the derivative Definitions







Matching using derivatives
Auxiliary function that returns true if a RSE matches the empty graph
The matching relation can be expressed as:
Example trace:






Regular Shape Expression Schemas
Given a set of labels, a RSE schema is a function
where we extend RSEs to admit label references
Example 1:
Example 2:
<Person> {
foaf:age xsd:integer
, foaf:knows @<Person>*
}
Corresponds to:
From matching to typing
We extend previous definitions to include the notion of typing
A typing associates a label to a node in a context
Definitions on typings
The matching algorithm returns the typing in the context:
Matching RSEs Schemas
We define the matching of a RSE e with a set of triples as a partial
function that returns a typing.
The function takes a typing context as argument
and we extend previous axiomatic definitions as...
Axiomatic definitions adapted RSE Schemas
Derivative of a RSE in a typing context
We adapt previous definitions to typing contexts
where
Example:
Implementations
The algorithm has been implemented in Scala
Available at: http://labra.github.io/shexcala
We have also implemented a simplified prototype following the paper
definitions in Haskell
Available at: http://labra.github.io/Haws
An online version is also available at: http://rdfshape.weso.es
First experimental results
Comparison between derivatives (deriv) and backtracking (back)
Conclusions & Future work
Declarative algorithm to match Regular Shape Expressions
Based on equational reasoning
Theoretical complexity is unaffected
However, the derivatives algorithm behaves better than backtracking in practice
Future work:
Prove the correctness of the algorithm
Experimental results
Align this work with current RDF Data Shapes development
End of Presentation
SHACL vs RSEs
At this moment, SHACL is being defined by the RDF Data Shapes WG
Some differences:
Open Shapes (allow remaining triples)
Arcs check that there are no other arcs with the same predicate and different
values
And operator instead of interleave
Inclusive vs Exclusive-or
Semantics of all these features is under discussion
Example of derivatives that don't match
1 of 28

Recommended

Data shapes-test-suite by
Data shapes-test-suiteData shapes-test-suite
Data shapes-test-suiteJose Emilio Labra Gayo
981 views10 slides
Shape Expressions: An RDF validation and transformation language by
Shape Expressions: An RDF validation and transformation languageShape Expressions: An RDF validation and transformation language
Shape Expressions: An RDF validation and transformation languageJose Emilio Labra Gayo
3.1K views30 slides
ShEx by Example by
ShEx by ExampleShEx by Example
ShEx by ExampleJose Emilio Labra Gayo
1.7K views58 slides
SHACL by example by
SHACL by exampleSHACL by example
SHACL by exampleJose Emilio Labra Gayo
13.7K views44 slides
RDF validation tutorial by
RDF validation tutorialRDF validation tutorial
RDF validation tutorialJose Emilio Labra Gayo
2.9K views20 slides
ShEx vs SHACL by
ShEx vs SHACLShEx vs SHACL
ShEx vs SHACLJose Emilio Labra Gayo
5.6K views33 slides

More Related Content

What's hot

Challenges and applications of RDF shapes by
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapesJose Emilio Labra Gayo
343 views61 slides
RDF Validation Future work and applications by
RDF Validation Future work and applicationsRDF Validation Future work and applications
RDF Validation Future work and applicationsJose Emilio Labra Gayo
925 views19 slides
Introduction to SPARQL by
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQLJose Emilio Labra Gayo
3.9K views78 slides
SHACL Overview by
SHACL OverviewSHACL Overview
SHACL OverviewIrene Polikoff
1.4K views42 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
RDF Data Model by
RDF Data ModelRDF Data Model
RDF Data ModelJose Emilio Labra Gayo
2.6K views49 slides

What's hot(20)

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
SHACL: Shaping the Big Ball of Data Mud by Richard Cyganiak
SHACL: Shaping the Big Ball of Data MudSHACL: Shaping the Big Ball of Data Mud
SHACL: Shaping the Big Ball of Data Mud
Richard Cyganiak6.5K views
Two graph data models : RDF and Property Graphs by andyseaborne
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
andyseaborne2.4K views
SHACL in Apache jena - ApacheCon2020 by andyseaborne
SHACL in Apache jena - ApacheCon2020SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020
andyseaborne388 views
RDF SHACL, Annotations, and Data Frames by Kurt Cagle
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data Frames
Kurt Cagle405 views
Graph Data -- RDF and Property Graphs by andyseaborne
Graph Data -- RDF and Property GraphsGraph Data -- RDF and Property Graphs
Graph Data -- RDF and Property Graphs
andyseaborne7.9K views

Viewers also liked

Arquitectura de la Web y Computación en el Servidor by
Arquitectura de la Web y Computación en el ServidorArquitectura de la Web y Computación en el Servidor
Arquitectura de la Web y Computación en el ServidorJose Emilio Labra Gayo
1.9K views52 slides
RDF data model by
RDF data modelRDF data model
RDF data modelJose Emilio Labra Gayo
3.3K views12 slides
Hydra: A Vocabulary for Hypermedia-Driven Web APIs by
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIsMarkus Lanthaler
27.5K views17 slides
2 Introducción al lenguaje Ruby by
2 Introducción al lenguaje Ruby2 Introducción al lenguaje Ruby
2 Introducción al lenguaje RubyJose Emilio Labra Gayo
1.9K views59 slides
Pumping lemma for regular set h1 by
Pumping lemma for regular set h1Pumping lemma for regular set h1
Pumping lemma for regular set h1Rajendran
7.8K views19 slides
Model Your Application Domain, Not Your JSON Structures by
Model Your Application Domain, Not Your JSON StructuresModel Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON StructuresMarkus Lanthaler
29.3K views22 slides

Viewers also liked(13)

Hydra: A Vocabulary for Hypermedia-Driven Web APIs by Markus Lanthaler
Hydra: A Vocabulary for Hypermedia-Driven Web APIsHydra: A Vocabulary for Hypermedia-Driven Web APIs
Hydra: A Vocabulary for Hypermedia-Driven Web APIs
Markus Lanthaler27.5K views
Pumping lemma for regular set h1 by Rajendran
Pumping lemma for regular set h1Pumping lemma for regular set h1
Pumping lemma for regular set h1
Rajendran 7.8K views
Model Your Application Domain, Not Your JSON Structures by Markus Lanthaler
Model Your Application Domain, Not Your JSON StructuresModel Your Application Domain, Not Your JSON Structures
Model Your Application Domain, Not Your JSON Structures
Markus Lanthaler29.3K views
Theory of Automata and formal languages unit 1 by Abhimanyu Mishra
Theory of Automata and formal languages unit 1Theory of Automata and formal languages unit 1
Theory of Automata and formal languages unit 1
Abhimanyu Mishra2.1K views
Theory of Automata and formal languages unit 2 by Abhimanyu Mishra
Theory of Automata and formal languages unit 2Theory of Automata and formal languages unit 2
Theory of Automata and formal languages unit 2
Abhimanyu Mishra1.7K views
JSON-LD: JSON for Linked Data by Gregg Kellogg
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
Gregg Kellogg73.4K views
From Strings to Things to a Web of Services by Markus Lanthaler
From Strings to Things to a Web of ServicesFrom Strings to Things to a Web of Services
From Strings to Things to a Web of Services
Markus Lanthaler3.5K views

Similar to Towards an RDF Validation Language based on Regular Expression Derivatives

Sparql by
SparqlSparql
SparqlTamrat Amare
1.1K views34 slides
SPARQL introduction and training (130+ slides with exercices) by
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)Thomas Francart
2.1K views134 slides
Dsm as theory building by
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
519 views34 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
SPARQL Query Containment with ShEx Constraints by
SPARQL Query Containment with ShEx ConstraintsSPARQL Query Containment with ShEx Constraints
SPARQL Query Containment with ShEx ConstraintsAbdullah Abbas
41 views58 slides
Information extraction for Free Text by
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Textbutest
906 views60 slides

Similar to Towards an RDF Validation Language based on Regular Expression Derivatives(20)

SPARQL introduction and training (130+ slides with exercices) by Thomas Francart
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart2.1K views
Dsm as theory building by ClarkTony
Dsm as theory buildingDsm as theory building
Dsm as theory building
ClarkTony519 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
SPARQL Query Containment with ShEx Constraints by Abdullah Abbas
SPARQL Query Containment with ShEx ConstraintsSPARQL Query Containment with ShEx Constraints
SPARQL Query Containment with ShEx Constraints
Abdullah Abbas41 views
Information extraction for Free Text by butest
Information extraction for Free TextInformation extraction for Free Text
Information extraction for Free Text
butest906 views
SPARQL Cheat Sheet by LeeFeigenbaum
SPARQL Cheat SheetSPARQL Cheat Sheet
SPARQL Cheat Sheet
LeeFeigenbaum92.4K views
Functional programming in Java 8 - workshop at flatMap Oslo 2014 by Fredrik Vraalsen
Functional programming in Java 8 - workshop at flatMap Oslo 2014Functional programming in Java 8 - workshop at flatMap Oslo 2014
Functional programming in Java 8 - workshop at flatMap Oslo 2014
Fredrik Vraalsen1.2K views
Optimized index structures for querying rdf from the web by Mahdi Atawneh
Optimized index structures for querying rdf from the webOptimized index structures for querying rdf from the web
Optimized index structures for querying rdf from the web
Mahdi Atawneh250 views
Facilitating Busines Interoperability from the Semantic Web by Roberto García
Facilitating Busines Interoperability from the Semantic WebFacilitating Busines Interoperability from the Semantic Web
Facilitating Busines Interoperability from the Semantic Web
Roberto García1.3K 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
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j by Connected Data World
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4jExplicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
Explicit Semantics in Graph DBs Driving Digital Transformation With Neo4j
SOLID mit Java 8 by Roland Mast
SOLID mit Java 8SOLID mit Java 8
SOLID mit Java 8
Roland Mast681 views

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
463 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
Introducción a la Web Semántica by
Introducción a la Web SemánticaIntroducción a la Web Semántica
Introducción a la Web SemánticaJose Emilio Labra Gayo
551 views71 slides

More from Jose Emilio Labra Gayo(17)

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

40th TWNIC Open Policy Meeting: APNIC PDP update by
40th TWNIC Open Policy Meeting: APNIC PDP update40th TWNIC Open Policy Meeting: APNIC PDP update
40th TWNIC Open Policy Meeting: APNIC PDP updateAPNIC
106 views20 slides
The Boys – Season 4 by
The Boys – Season 4The Boys – Season 4
The Boys – Season 4phamthebach2210
7 views2 slides
The Dark Web : Hidden Services by
The Dark Web : Hidden ServicesThe Dark Web : Hidden Services
The Dark Web : Hidden ServicesAnshu Singh
22 views24 slides
the internet.pptx by
the internet.pptxthe internet.pptx
the internet.pptxSrihariJena
6 views9 slides
hamro digital logics.pptx by
hamro digital logics.pptxhamro digital logics.pptx
hamro digital logics.pptxtupeshghimire
11 views36 slides
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxCracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxLeasedLinesQuote
5 views8 slides

Recently uploaded(15)

40th TWNIC Open Policy Meeting: APNIC PDP update by APNIC
40th TWNIC Open Policy Meeting: APNIC PDP update40th TWNIC Open Policy Meeting: APNIC PDP update
40th TWNIC Open Policy Meeting: APNIC PDP update
APNIC106 views
The Dark Web : Hidden Services by Anshu Singh
The Dark Web : Hidden ServicesThe Dark Web : Hidden Services
The Dark Web : Hidden Services
Anshu Singh22 views
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx by LeasedLinesQuote
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptxCracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Cracking the Code Decoding Leased Line Quotes for Connectivity Excellence.pptx
Liberando a produccion con confidencia.pdf by Andres Almiray
Liberando a produccion con confidencia.pdfLiberando a produccion con confidencia.pdf
Liberando a produccion con confidencia.pdf
Andres Almiray6 views
40th TWNIC Open Policy Meeting: A quick look at QUIC by APNIC
40th TWNIC Open Policy Meeting: A quick look at QUIC40th TWNIC Open Policy Meeting: A quick look at QUIC
40th TWNIC Open Policy Meeting: A quick look at QUIC
APNIC109 views
ATPMOUSE_융합2조.pptx by kts120898
ATPMOUSE_융합2조.pptxATPMOUSE_융합2조.pptx
ATPMOUSE_융합2조.pptx
kts12089835 views
Penetration Testing for Cybersecurity Professionals by 211 Check
Penetration Testing for Cybersecurity ProfessionalsPenetration Testing for Cybersecurity Professionals
Penetration Testing for Cybersecurity Professionals
211 Check49 views
WITS Deck by W.I.T.S.
WITS DeckWITS Deck
WITS Deck
W.I.T.S.36 views
cis5-Project-11a-Harry Lai by harrylai126
cis5-Project-11a-Harry Laicis5-Project-11a-Harry Lai
cis5-Project-11a-Harry Lai
harrylai1269 views
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download by APNIC
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
40th TWNIC OPM: On LEOs (Low Earth Orbits) and Starlink Download
APNIC112 views

Towards an RDF Validation Language based on Regular Expression Derivatives

  • 1. Towards an RDF Validation Language based on Regular Expression Derivatives Eric Prud'hommeaux World Wide Web Consortium MIT, Cambridge, MA, USA Harold Solbrig Mayo Clinic USA College of Medicine, Rochester, MN, USA Jose Emilio Labra Gayo WESO Research group University of Oviedo Spain Sławek Staworko LINKS, INRIA & CNRS University of Lille, France
  • 2. Overview Shape Expressions for RDF validation - Justification Regular Shape Expressions Axiomatic Semantics Implementation based on Derivatives Regular Shape Expression Schemas Adapt Axiomatic Semantics to Schemas Adapt Implementation based on Derivatives Conclusions & Future work
  • 3. Shape Expressions Simple and intuitive language that can: Describe the topology of RDF data Validate that RDF instance data matches a shape Two syntaxes Compact syntax (inspired by RelaxNG, Turtle and SPARQL) RDF Related to W3c RDF Data Shapes Working Group
  • 4. Example: RDF model of a Person Person__ foaf:age xsd:integer foaf:name xsd:string + 0..* foaf:knows :john foaf:age 23; foaf:name "John"; foaf:knows :bob . :bob foaf:age 34; foaf:name "Bob", "Robert" .   <Person> { foaf:age xsd:integer , foaf:name xsd:string+ , foaf:knows @<Person>* } Shape Expressions Schema Some RDF data :mary foaf:age 50, 65 . E-R Diagram
  • 5. Why not SPARQL? <Person> { foaf:age xsd:integer , foaf:name xsd:string+ , foaf:knows @<Person>* }ASK { { SELECT ?Person { ?Person foaf:age ?o . } GROUP BY ?Person HAVING (COUNT(*)=1) } { SELECT ?Person { ?Person foaf:age ?o . FILTER ( isLiteral(?o) && datatype(?o) = xsd:integer ) } GROUP BY ?Person HAVING (COUNT(*)=1) } ... 1 2 3 4 5 6 7 8 9 10 ... ... { SELECT ?Person (COUNT(*) AS ?Person_c0) { ?Person foaf:name ?o . } GROUP BY ?Person HAVING (COUNT(*)>=1) } { SELECT ?Person (COUNT(*) AS ?Person_c1) { ?Person foaf:name ?o . FILTER (isLiteral(?o) && datatype(?o) = xsd:string) } GROUP BY ?Person HAVING (COUNT(*)>=1) } FILTER (?Person_c0 = ?Person_c1) ... ... 11 12 13 14 15 16 17 18 19 20 ... ... { { { SELECT ?Person (COUNT(*) AS ?Person_c2) { ?Person foaf:knows ?o . } GROUP BY ?Person } { SELECT ?Person (COUNT(*) AS ?Person_c3) { ?Person foaf:knows ?o . FILTER ((isIRI(?o) || isBlank(?o))) } GROUP BY ?Person HAVING (COUNT(*) >= 1) } FILTER (?Person_c2 = ?Person_c3) } ... ... 21 22 23 24 25 26 27 28 29 30 ... ... UNION { SELECT ?Person { OPTIONAL { ?Person foaf:knows ?o } FILTER (!bound(?o)) } } } } ... 31 32 33 34 35 36 37 38 1 2 3 4 5
  • 6. Regular Shape Expressions (RSEs) Simplified version of Shape Expressions Based on Regular Expressions Sets of triples instead of list of characters Interleave instead of concatenation Abstract syntax
  • 7. Shape Expressions vs RSEs* <Shape1> { foaf:age xsd:integer , foaf:name xsd:string* } Example1: Shape Expression RSE * Note: We are considering a subset of Shape Expressions with Closed Shapes, and inclusive Or <Shape2> { :a ( 1 ) , :b ( 1 2 ) * } Example 2:
  • 8. Cardinalities in RSEs Cardinalities can be defined as: Example:
  • 9. Shape of a RSE: Example
  • 10. Simplification rules It is easy to show that the operators obey:
  • 13. Derivatives of RSEs Brzozowski's algorithm (1964) developed for Regular Expressions We adapted that algorithm to RSEs Calculates the derivative of a RSE with respect to a triple t: Definition:
  • 14. Calculating the derivative Definitions       
  • 15. Matching using derivatives Auxiliary function that returns true if a RSE matches the empty graph The matching relation can be expressed as:
  • 17. Regular Shape Expression Schemas Given a set of labels, a RSE schema is a function where we extend RSEs to admit label references Example 1: Example 2: <Person> { foaf:age xsd:integer , foaf:knows @<Person>* } Corresponds to:
  • 18. From matching to typing We extend previous definitions to include the notion of typing A typing associates a label to a node in a context Definitions on typings The matching algorithm returns the typing in the context:
  • 19. Matching RSEs Schemas We define the matching of a RSE e with a set of triples as a partial function that returns a typing. The function takes a typing context as argument and we extend previous axiomatic definitions as...
  • 21. Derivative of a RSE in a typing context We adapt previous definitions to typing contexts where
  • 23. Implementations The algorithm has been implemented in Scala Available at: http://labra.github.io/shexcala We have also implemented a simplified prototype following the paper definitions in Haskell Available at: http://labra.github.io/Haws An online version is also available at: http://rdfshape.weso.es
  • 24. First experimental results Comparison between derivatives (deriv) and backtracking (back)
  • 25. Conclusions & Future work Declarative algorithm to match Regular Shape Expressions Based on equational reasoning Theoretical complexity is unaffected However, the derivatives algorithm behaves better than backtracking in practice Future work: Prove the correctness of the algorithm Experimental results Align this work with current RDF Data Shapes development
  • 27. SHACL vs RSEs At this moment, SHACL is being defined by the RDF Data Shapes WG Some differences: Open Shapes (allow remaining triples) Arcs check that there are no other arcs with the same predicate and different values And operator instead of interleave Inclusive vs Exclusive-or Semantics of all these features is under discussion
  • 28. Example of derivatives that don't match