The document discusses RDF Shapes, which are used to describe and validate RDF data. It provides examples of using ShEx and SHACL to define shapes for RDF graphs and validate instance data against those shapes. Key points covered include the differences between ShEx and SHACL, such as ShEx focusing on defining structures while SHACL adds target declarations, and how both can be used to generate validation reports.
22. Why not using SPARQL to validate?
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: Define SPARQL query to check:
There must be one schema:name which
must be a xsd:string, and one
schema:gender which must be
schema:Male or schema:Female
39. ShEx and SHACL compared
ShEx SHACL
Underlying philosophy Structure definition Constraint checking
Syntax Compact syntax + RDF RDF
Notion of shape Only structure Structure + target decls.
Default cardinalities {1,1} {0,*}
Shapes and inference No SHACL specific entailment
Recursion Part of the language Undefined
Repeated properties Part of the language Conjunction by default
Requires qualifiedValueShapes
Property paths Nested shapes SPARQL like
Property pair comparisons Unsupported in current version Part of the language
Extension mechanism Semantic actions SHACL-SPARQL
Validation triggering Query shape map Target declarations
Result of validation Result shape map Validation report
48. Schema ecosystems: Solid project
Data
pod
Shape
A
Shape
C
Shape
B
App
1
App
2
App
3
"...I just can’t stop thinking about shapes.", Ruben Verborgh
https://ruben.verborgh.org/blog/2019/06/17/shaping-linked-data-apps/