SlideShare una empresa de Scribd logo
1 de 44
SHACL by example
RDF Validation tutorial
Eric Prud'hommeaux
World Wide Web Consortium
MIT, Cambridge, MA, USA
Harold Solbrig
Mayo Clinic, USA
Jose Emilio Labra Gayo
WESO Research group
University of Oviedo, Spain
Iovka Boneva
LINKS, INRIA & CNRS
University of Lille, France
SHACL
W3c Data Shapes WG deliverable
https://www.w3.org/TR/shacl/
Inspired by SPIN, OSLC & bits of ShEx
SPARQL based extension mechanism
RDF vocabulary
Human friendly syntax inspired by ShEx proposed as a WG Note *
* https://w3c.github.io/data-shapes/shacl-compact-syntax/
Some definitions about SHACL
Shape: collection of targets and constraints components
Targets: specify which nodes in the data graph must conform to a shape
Constraint components: Determine how to validate a node
Shapes graph: an RDF graph that contains shapes
Data graph: an RDF graph that contains data to be validated
Example
Try it. RDFShape http://goo.gl/FqXQpD
prefix : <http://example.org/>
prefix sh: <http://www.w3.org/ns/shacl#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix schema: <http://schema.org/>
:UserShape a sh:NodeShape ;
sh:targetNode :alice, :bob, :carol ;
sh:property [
sh:path schema:name ;
sh:minCount 1;
sh:maxCount 1;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:email ;
sh:minCount 1;
sh:maxCount 1;
sh:nodeKind sh:IRI ;
] .
:alice schema:name "Alice Cooper" ;
schema:email <mailto:alice@mail.org> .
:bob schema:firstName "Bob" ;
schema:email <mailto:bob@mail.org> .
:carol schema:name "Carol" ;
schema:email "carol@mail.org" .
Shapes graph
Data graph


Target declarations
Targets specify nodes that must be validated against the shape
Several types
Value Description
targetNode Directly point to a node
targetClass All nodes that have a given type
targetProperty All nodes that have a given property
target General mechanism based on SPARQL
Target node
Directly declare which nodes must validate the against the shape
:UserShape a sh:NodeShape ;
sh:targetNode :alice, :bob, :carol ;
sh:property [
sh:path schema:name ;
sh:minCount 1;
sh:maxCount 1;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:email ;
sh:minCount 1;
sh:maxCount 1;
sh:nodeKind sh:IRI ;
] .
:alice schema:name "Alice Cooper" ;
schema:email <mailto:alice@mail.org> .
:bob schema:givenName "Bob" ;
schema:email <mailto:bob@mail.org> .
:carol schema:name "Carol" ;
schema:email "carol@mail.org" .
Target class
Selects all nodes that have a given type
Looks for rdf:type declarations*
* Also looks for rdfs:subClassOf*/rdf:type declarations
:UserShape a sh:NodeShape ;
sh:targetClass :User ;
sh:property [
sh:path schema:name ;
sh:minCount 1;
sh:maxCount 1;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:email ;
sh:minCount 1;
sh:maxCount 1;
sh:nodeKind sh:IRI ;
] .
:alice a :User;
schema:name "Alice Cooper" ;
schema:email <mailto:alice@mail.org> .
:bob a :User;
schema:givenName "Bob" ;
schema:email <mailto:bob@mail.org> .
:carol a :User;
schema:name "Carol" ;
schema:email "carol@mail.org" .
Implicit target class
A shape with type sh:Shape and rdfs:Class is a scope class of itself
The targetClass declaration is implicit
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path schema:name ;
sh:minCount 1;
sh:maxCount 1;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:email ;
sh:minCount 1;
sh:maxCount 1;
sh:nodeKind sh:IRI ;
] .
:alice a :User;
schema:name "Alice Cooper" ;
schema:email <mailto:alice@mail.org> .
:bob a :User;
schema:givenName "Bob" ;
schema:email <mailto:bob@mail.org> .
:carol a :User;
schema:name "Carol" ;
schema:email "carol@mail.org" .
Types of shapes
Type Description
Node shapes Constraints about a given focus node
Property shapes Constraints about a property and the values of a path
for a node
Shape
target declarations
NodeShape PropertyShape
constraint components
constraint components
sh:path: rdfs:Resource
:alice a :User .
<http://example.org/bob> a :User .
_:1 a :User .
Node Shapes
Constraints about a focus node

:User a sh:NodeShape ;
sh:nodeKind sh:IRI .
Property shapes
Constraints about a given property and its values for the focus node
sh:property associates a shape with a property constraint
sh:path identifies the path
:User a sh:NodeShape ;
sh:property [
sh:path schema:email ;
sh:nodeKind sh:IRI
] .
:alice a :User ;
schema:email <mailto:alice@mail.org> .
:bob a :User;
schema:email <mailto:bob@mail.org> .
:carol a :User;
schema:email "carol@mail.org" .


Paths in property shapes
Example with inverse path
inversePath, zeroOrMorePath, alternativePath,
oneOrMorePath, ...
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path [sh:inversePath schema:follows ];
sh:nodeKind sh:IRI ;
] .
:alice a :User;
schema:follows :bob .
:bob a :User .
:carol a :User;
schema:follows :alice .
_:1 schema:follows :bob .

Core constraint components
Type Constraints
Cardinality minCount, maxCount
Types of values class, datatype, nodeKind
Values node, in, hasValue
Range of values minInclusive, maxInclusive
minExclusive, maxExclusive
String based minLength, maxLength, pattern, stem, uniqueLang
Logical constraints not, and, or, xone
Closed shapes closed, ignoredProperties
Property pair constraints equals, disjoint, lessThan, lessThanOrEquals
Non-validating constraints name, value, defaultValue
Qualified shapes qualifiedValueShape, qualifiedMinCount, qualifiedMaxCount
Cardinality constraints
Constraint Description
minCount Restricts minimum number of triples involving the focus
node and a given predicate.
Default value: 0
maxCount Restricts maximum number of triples involving the focus
node and a given predicate.
If not defined = unbounded
Try it. http://goo.gl/9AwtFK
:User a sh:NodeShape ;
sh:property [
sh:path schema:follows ;
sh:minCount 2 ;
sh:maxCount 3 ;
] .
:alice schema:follows :bob,
:carol .
:bob schema:follows :alice .
:carol schema:follows :alice,
:bob,
:carol,
:dave .


Datatypes of values
Constraint Description
datatype Restrict the datatype of all value nodes to a given value
:User a sh:NodeShape ;
sh:property [
sh:path schema:birthDate ;
sh:datatype xsd:date ;
] .
Try it: http://goo.gl/eDwxsU
:alice schema:birthDate "1985-08-20"^^xsd:date .
:bob schema:birthDate "Unknown"^^xsd:date .
:carol schema:birthDate 1990 .


Class of values
Constraint Description
class Verify that each node in an instance of some class
It also allows instances of subclasses*
(*) The notion of SHACL instance is different from RDFS
It is defined as rdfs:subClassOf*/rdf:type
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path schema:follows ;
sh:class :User
] .
:Manager rdfs:subClassOf :User .
:alice a :User;
schema:follows :bob .
:bob a :Manager ;
schema:follows :alice .
:carol a :User;
schema:follows :alice, :dave .
:dave a :Employee .

Kind of values
Constraint Description
nodeKind Possible values:
BlankNode, IRI, Literal,
BlankNodeOrIRI, BlankNodeOrLiteral, IRIOrLiteral
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path schema:name ;
sh:nodeKind sh:Literal ;
];
sh:property [
sh:path schema:follows ;
sh:nodeKind sh:BlankNodeOrIRI
];
sh:nodeKind sh:IRI .
:alice a :User;
schema:name _:1 ;
schema:follows :bob .
:bob a :User;
schema:name "Robert";
schema:follows [ schema:name "Dave" ] .
:carol a :User;
schema:name "Carol" ;
schema:follows "Dave" .
_:1 a :User . 


Constraints on values
Constraint Description
hasValue Verifies that the focus node has a given value
in Enumerates the value nodes that a property may have
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path schema:affiliation ;
sh:hasValue :OurCompany ;
];
sh:property [
sh:path schema:gender ;
sh:in (schema:Male schema:Female)
] .
:alice a :User;
schema:affiliation :OurCompany ;
schema:gender schema:Female .
:bob a :User;
schema:affiliation :AnotherCompany ;
schema:gender schema:Male .
:carol a :User;
schema:affiliation :OurCompany ;
schema:gender schema:Unknown . 

Constraints on values with another shape
Constraint Description
node* All values of a given property must have a given shape
Recursion is not allowed in current SHACL
:User a sh:NodeShape, rdfs:Class ;
sh:property [
sh:path schema:worksFor ;
sh:node :Company ;
] .
:Company a sh:Shape ;
sh:property [
sh:path schema:name ;
sh:datatype xsd:string ;
] .
:alice a :User;
schema:worksFor :OurCompany .
:bob a :User;
schema:worksFor :Another .
:OurCompany
schema:name "OurCompany" .
:Another
schema:name 23 .

*recently renamed as sh:shape
Value shapes and recursion
Could we define cyclic data models as the following?
:User a sh:NodeShape ;
sh:property [
sh:path schema:worksFor ;
sh:node :Company ;
] .
:Company a sh:Shape ;
sh:property [
sh:path schema:name ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:employee ;
sh:node :User ;
] .
:User :Company
schema:name xsd:string
schema:worksFor
schema:employee
No, current SHACL specification doesn't allow this
:alice schema:worksFor :OneCompany .
:bob schema:worksFor :OneCompany .
:carol schema:worksFor :OneCompany .
:OneCompany schema:name "One" ;
schema:employee :alice, :bob, :carol .
Don't try it 
SHACL approach to avoid recursion
Add rdf:type arcs for every resource and use sh:class
:User a sh:NodeShape ;
sh:property [
sh:path schema:worksFor ;
sh:class :Company ;
] .
:Company a sh:Shape ;
sh:property [
sh:path schema:name ;
sh:datatype xsd:string ;
] ;
sh:property [
sh:path schema:employee ;
sh:class :User ;
] .
:User :Company
schema:name xsd:string
schema:worksFor
schema:employee
Try it: http://goo.gl/wlVZJR
:alice a :User ;
schema:worksFor :OneCompany .
:bob a :User ;
schema:worksFor :OneCompany .
:carol a :User ;
schema:worksFor :Something .
:OneCompany a :Company ;
schema:name "One" ;
schema:employee :alice, :bob, :carol .

Logical Operators
Constraint Description
and Conjunction of a list of shapes
or Disjunction of a list of shapes
not Negation of a shape
xone Exactly one (similar XOR for 2 arguments)
and
Default behavior
:User a sh:NodeShape ;
sh:and (
[ sh:property [
sh:path schema:name;
sh:minCount 1;
]
]
[ sh:property [
sh:path schema:affiliation;
sh:minCount 1;
]
]
) .
:User a sh:Shape ;
[ sh:property [
sh:path schema:name;
sh:minCount 1;
]
]
[ sh:property [
sh:path schema:affiliation;
sh:minCount 1;
]
]
.
≡
or
:User a sh:NodeShape ;
sh:or (
[ sh:property [
sh:predicate foaf:name;
sh:minCount 1;
]
]
[ sh:property [
sh:predicate schema:name;
sh:minCount 1;
]
]
) .
:alice schema:name "Alice" .
:bob foaf:name "Robert" .
:carol rdfs:label "Carol" . 
not
:NotFoaf a sh:NodeShape ;
sh:not [ a sh:Shape ;
sh:property [
sh:predicate foaf:name ;
sh:minCount 1 ;
] ;
] .
:alice schema:name "Alice" .
:bob foaf:name "Robert" .
:carol rdfs:label "Carol" .

Exactly one
Pending example...
Value ranges
Constraint Description
minInclusive
maxInclusive
minExclusive
maxExclusive
Try it: http://goo.gl/qnd66j
:Rating a sh:NodeShape ;
sh:property [
sh:path schema:ratingValue ;
sh:minInclusive 1 ;
sh:maxInclusive 5 ;
sh:datatype xsd:integer
] .
:bad schema:ratingValue 1 .
:average schema:ratingValue 3 .
:veryGood schema:ratingValue 5 .
:zero schema:ratingValue 0 .
String based constraints
Constraint Description
minLength Restricts the minimum string length on value nodes
maxLength Restricts the maximum string length on value nodes
pattern Checks if the string value matches a regular expression
stem Checks if all value nodes are IRIs and the IRI starts with a given string value
uniqueLang Checks that no pair of nodes use the same language tag
minLength/maxLength
Try it: http://goo.gl/NrJl83
:User a sh:NodeShape ;
sh:property [
sh:path schema:name ;
sh:minLength 4 ;
sh:maxLength 10 ;
] .
:alice schema:name "Alice" .
:bob schema:name "Bob" .
:carol schema:name :Carol .
:strange schema:name _:strange .

Checks the string representation of the value
This cannot be applied to blank nodes
If minLength = 0, no restriction on string length

pattern
Checks if the values matches a regular expression
It can be combined with sh:flags
:Product a sh:NodeShape ;
sh:property [
sh:path schema:productID ;
sh:pattern "^Pd{3,4}" ;
sh:flags "i" ;
] .
:car schema:productID "P2345" .
:bus schema:productID "p567" .
:truck schema:productID "P12" .
:bike schema:productID "B123" . 

Try it: http://goo.gl/BsHpqu
uniqueLang
Checks that no pair of nodes use the same language tag
Try it: http://goo.gl/B1PNcO
:Country a sh:NodeShape ;
sh:property [
sh:path schema:name ;
sh:uniqueLang true
] .
:spain schema:name "Spain"@en,
"España"@es .
:france schema:name "France"@en,
"Francia"@es .
:usa schema:name "USA"@en,
"United States"@en. 
Property pair constraints
Constraint Description
equals The sets of values of both properties at a given focus node must be equal
disjoint The sets of values of both properties at a given focus node must be different
lessThan The values must be smaller than the values of another property
lessThanOrEquals The values must be smaller or equal than the values of another property
Try it: http://goo.gl/BFzMoz
:User a sh:NodeShape ;
sh:property [
sh:path schema:givenName ;
sh:equals foaf:firstName
];
sh:property [
sh:path schema:givenName ;
sh:disjoint schema:lastName
] .
:alice schema:givenName "Alice";
schema:lastName "Cooper";
foaf:firstName "Alice" .
:bob schema:givenName "Bob";
schema:lastName "Smith" ;
foaf:firstName "Robert" .
:carol schema:givenName "Carol";
schema:lastName "Carol" ;
foaf:firstName "Carol" .


Closed shapes
Constraint Description
closed Valid resources must only have values for properties that appear in sh:property
ignoredProperties Optional list of properties that are also permitted
:User a sh:NodeShape ;
sh:closed true ;
sh:ignoredProperties ( rdf:type ) ;
sh:property [
sh:path schema:givenName ;
];
sh:property [
sh:path schema:lastName ;
] .
:alice schema:givenName "Alice";
schema:lastName "Cooper" .
:bob a :Employee ;
schema:givenName "Bob";
schema:lastName "Smith" .
:carol schema:givenName "Carol";
schema:lastName "King" ;
rdfs:label "Carol" .

Try it: http://goo.gl/wcW16o
Non-validating constraints
Can be useful to annotate shapes or design UI forms
Constraint Description
name Provide human-readable labels for a property
description Provide a description of a property
order Relative order of the property
group Group several constraints together
:User a sh:NodeShape ;
sh:property [
sh:path schema:url ;
sh:name "URL";
sh:description "User URL";
sh:order 1
];
sh:property [
sh:path schema:name ;
sh:name "Name";
sh:description "User name";
sh:order 2
] .
Non-validating constraints
:User a sh:NodeShape ;
sh:property [ sh:path schema:url ;
sh:name "URL";
sh:group :userDetails
];
sh:property [ sh:path schema:name ;
sh:name "Name"; sh:group :userDetails
];
sh:property [ sh:path schema:address ;
sh:name "Address"; sh:group :location
];
sh:property [ sh:path schema:country ;
sh:name "Country"; sh:group :location
] .
:userDetails a sh:PropertyGroup ;
sh:order 0 ;
rdfs:label "User details" .
:location a sh:PropertyGroup ;
sh:order 1 ;
rdfs:label "Location" .
User details
URL: _____________________
Name: ___________________
Location
Address: __________________
Country: __________________
An agent could generate a form like:
Partitions and qualified values
Problem with repeated properties
Example: Books have two IDs (an isbn and an internal code)
:Book a sh:Shape ;
sh:property [
sh:predicate schema:productID ;
sh:minCount 1;
sh:datatype xsd:string ;
sh:pattern "^isbn"
];
sh:property [
sh:predicate schema:productID ;
sh:minCount 1;
sh:datatype xsd:string ;
sh:pattern "^code"
] .
:b1 schema:productID "isbn:123-456-789" ;
schema:productID "code234" .
It fails!!
Try it: http://goo.gl/x7oHpi
Partitions and qualified value shapes
Qualified value shapes verify that certain number of values of a given
property have a given shape
:Book a sh:Shape ;
sh:property [
sh:predicate schema:productID ;
sh:minCount 2; sh:maxCount 2; ];
sh:property [
sh:predicate schema:productID ;
sh:qualifiedMinCount 1 ;
sh:qualifiedValueShape [
sh:constraint [sh:pattern "^isbn" ]]];
sh:property [
sh:predicate schema:productID ;
sh:qualifiedMinCount 1 ;
sh:qualifiedValueShape [
sh:constraint [ sh:pattern "^code" ; ]]];
.
Try it: http://goo.gl/v6Zffe
Partitions and qualified value shapes
partition declares a partition on the set of values
:Book a sh:Shape ;
sh:property [
sh:predicate schema:productID ;
sh:partition (
[sh:minCount 1; sh:maxCount 1; sh:pattern "^isbn"]
[sh:minCount 1; sh:maxCount 1; sh:pattern "^code"]
)
] .
Don't try it
Not yet implemented
NOTE:
This feature is under development
The specification defines a Greedy algorithm and the violation errors depend on the order of the elements on the list
This can be tricky when some values overlap several elements in the partition
Filters
Filters limit the nodes that are in scope to those that satisfy the filter
Similar to: "if <filter> then ..."
Try it: http://goo.gl/vadFMk
:User a sh:Shape ;
sh:scopeClass schema:Person ;
sh:filterShape [
a sh:Shape ; # Optional triple
sh:property [
sh:predicate schema:worksFor ;
sh:hasValue :OurCompany ;
]
] ;
sh:property [
sh:predicate schema:url ;
sh:stem "http://ourcompany.org/" ;
] .
:alice a schema:Person ;
schema:worksFor :OurCompany ;
schema:url <http://ourcompany.org/alice> .
:bob a schema:Person ;
schema:worksFor :OurCompany ;
schema:url <http://othercompany.org/bob> .
:carol a schema:Person ;
schema:worksFor :OtherCompany ;
schema:url <http://othercompany.org/carol> .

SPARQL constraints
Constraints based on SPARQL code.
The query returns validation errors
Constraint Description
SPARQLConstraint Type of constraints that will be considered as SPARQL constraints
message Message in case of error
sparql SPARQL code to be executed
prefix Declare reusable prefix
SPARQL constraints
Special variables are used to bind values between SHACL and
SPARQL processors
Constraint Description
$this Focus Node
$shapesGraph Can be used to query the shapes graph
$currentShape Current validated shape
SPARQL constraints
Mappings between result rows and error validation information
Constraint Description
sh:focusNode Value of $this variable
sh:subject Value of ?subject variable
sh:predicate Value of ?predicate variable
sh:object Value of ?object variable
sh:message Value of ?message variable
sh:sourceConstraint The constraint that was validated against
sh:sourceShape The shape that was validated against
sh:severity sh:ViolationError by default or the value of sh:severity
Extension mechanism
SHACL offers an extension mechanism based on SPARQL
In principle, it should be possible to add other mechanisms
<http://www.w3.org/2000/01/rdf-schema#> sh:prefix "rdfs" .
:SpanishLabelsShape a sh:Shape ;
sh:constraint [
a sh:SPARQLConstraint ;
sh:message "Values must be literals with Spanish language tag." ;
sh:sparql """SELECT $this ($this AS ?subject)
(rdfs:label AS ?predicate)
(?value AS ?object)
WHERE { $this rdfs:label ?value .
FILTER (!isLiteral(?value) || !langMatches(lang(?value), "es"))""" ;
] .
Try it: http://goo.gl/Wf1Lxn
Other features
Several features are currently under discussion
SPARQL scopes and SPARQL functions
Extension mechanism for other languages
Recursion
User-friendly syntax

Más contenido relacionado

La actualidad más candente

Debunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative FactsDebunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative FactsNeo4j
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataGregg Kellogg
 
Getting Started with Knowledge Graphs
Getting Started with Knowledge GraphsGetting Started with Knowledge Graphs
Getting Started with Knowledge GraphsPeter Haase
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQLOlaf Hartig
 
SPARQL in a nutshell
SPARQL in a nutshellSPARQL in a nutshell
SPARQL in a nutshellFabien Gandon
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDFNarni Rajesh
 
Introduction to Knowledge Graphs and Semantic AI
Introduction to Knowledge Graphs and Semantic AIIntroduction to Knowledge Graphs and Semantic AI
Introduction to Knowledge Graphs and Semantic AISemantic Web Company
 
온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어Dongbum Kim
 
Introduction of Knowledge Graphs
Introduction of Knowledge GraphsIntroduction of Knowledge Graphs
Introduction of Knowledge GraphsJeff Z. Pan
 
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus Helicopters
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus HelicoptersCIMPA : Enhancing Data Exposition & Digital Twin for Airbus Helicopters
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus HelicoptersNeo4j
 
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022Jim Dowling
 
Introduction to RDF & SPARQL
Introduction to RDF & SPARQLIntroduction to RDF & SPARQL
Introduction to RDF & SPARQLOpen Data Support
 

La actualidad más candente (20)

JSON-LD and SHACL for Knowledge Graphs
JSON-LD and SHACL for Knowledge GraphsJSON-LD and SHACL for Knowledge Graphs
JSON-LD and SHACL for Knowledge Graphs
 
Debunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative FactsDebunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative Facts
 
RDF data model
RDF data modelRDF data model
RDF data model
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
RDF data validation 2017 SHACL
RDF data validation 2017 SHACLRDF data validation 2017 SHACL
RDF data validation 2017 SHACL
 
JSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked DataJSON-LD: JSON for Linked Data
JSON-LD: JSON for Linked Data
 
Getting Started with Knowledge Graphs
Getting Started with Knowledge GraphsGetting Started with Knowledge Graphs
Getting Started with Knowledge Graphs
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
An Introduction to SPARQL
An Introduction to SPARQLAn Introduction to SPARQL
An Introduction to SPARQL
 
SPARQL in a nutshell
SPARQL in a nutshellSPARQL in a nutshell
SPARQL in a nutshell
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Introduction to Knowledge Graphs and Semantic AI
Introduction to Knowledge Graphs and Semantic AIIntroduction to Knowledge Graphs and Semantic AI
Introduction to Knowledge Graphs and Semantic AI
 
온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어온톨로지 개념 및 표현언어
온톨로지 개념 및 표현언어
 
ShEx by Example
ShEx by ExampleShEx by Example
ShEx by Example
 
RDF and OWL
RDF and OWLRDF and OWL
RDF and OWL
 
Introduction of Knowledge Graphs
Introduction of Knowledge GraphsIntroduction of Knowledge Graphs
Introduction of Knowledge Graphs
 
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus Helicopters
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus HelicoptersCIMPA : Enhancing Data Exposition & Digital Twin for Airbus Helicopters
CIMPA : Enhancing Data Exposition & Digital Twin for Airbus Helicopters
 
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022Real-Time Recommendations  with Hopsworks and OpenSearch - MLOps World 2022
Real-Time Recommendations with Hopsworks and OpenSearch - MLOps World 2022
 
Introduction to RDF & SPARQL
Introduction to RDF & SPARQLIntroduction to RDF & SPARQL
Introduction to RDF & SPARQL
 

Similar a SHACL by example RDF Validation tutorial

Part04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxPart04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxvudinhphuong96
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapesJose Emilio Labra Gayo
 
SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)Péter Király
 
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)Péter Király
 
RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesKurt Cagle
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2Dimitris Kontokostas
 
What’s in a structured value?
What’s in a structured value?What’s in a structured value?
What’s in a structured value?Andy Powell
 
Validating and Describing Linked Data Portals using RDF Shape Expressions
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
 
20th Feb 2020 json-ld-rdf-im-proposal.pdf
20th Feb 2020 json-ld-rdf-im-proposal.pdf20th Feb 2020 json-ld-rdf-im-proposal.pdf
20th Feb 2020 json-ld-rdf-im-proposal.pdfMichal Miklas
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...Alasdair Gray
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphsandyseaborne
 
Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Sumant Tambe
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage灿辉 葛
 
LinkML presentation to Yosemite Group
LinkML presentation to Yosemite GroupLinkML presentation to Yosemite Group
LinkML presentation to Yosemite GroupChris Mungall
 

Similar a SHACL by example RDF Validation tutorial (20)

Part04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxPart04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptx
 
SHACL Specification Draft
SHACL Specification DraftSHACL Specification Draft
SHACL Specification Draft
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
 
SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)
 
Optimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdfOptimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdf
 
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)
Validating JSON, XML and CSV data with SHACL-like constraints (DINI-KIM 2022)
 
RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data Frames
 
JSON-LD Update
JSON-LD UpdateJSON-LD Update
JSON-LD Update
 
Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2
 
What’s in a structured value?
What’s in a structured value?What’s in a structured value?
What’s in a structured value?
 
Validating and Describing Linked Data Portals using RDF Shape Expressions
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
 
SPIN and Shapes
SPIN and ShapesSPIN and Shapes
SPIN and Shapes
 
20th Feb 2020 json-ld-rdf-im-proposal.pdf
20th Feb 2020 json-ld-rdf-im-proposal.pdf20th Feb 2020 json-ld-rdf-im-proposal.pdf
20th Feb 2020 json-ld-rdf-im-proposal.pdf
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
HyperGraphQL
HyperGraphQLHyperGraphQL
HyperGraphQL
 
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...
Tutorial: Describing Datasets with the Health Care and Life Sciences Communit...
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)Native XML processing in C++ (BoostCon'11)
Native XML processing in C++ (BoostCon'11)
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage
 
LinkML presentation to Yosemite Group
LinkML presentation to Yosemite GroupLinkML presentation to Yosemite Group
LinkML presentation to Yosemite Group
 

Más de Jose Emilio Labra Gayo

Introducción a la investigación/doctorado
Introducción a la investigación/doctoradoIntroducción a la investigación/doctorado
Introducción a la investigación/doctoradoJose Emilio Labra Gayo
 
Legislative data portals and linked data quality
Legislative data portals and linked data qualityLegislative data portals and linked data quality
Legislative data portals and linked data qualityJose Emilio Labra Gayo
 
Validating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesJose Emilio Labra Gayo
 
Legislative document content extraction based on Semantic Web technologies
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
 
Como publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosComo publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosJose Emilio Labra Gayo
 
Arquitectura de la Web y Computación en el Servidor
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
 
RDF Validation Future work and applications
RDF Validation Future work and applicationsRDF Validation Future work and applications
RDF Validation Future work and applicationsJose Emilio Labra Gayo
 

Más de Jose Emilio Labra Gayo (20)

Publicaciones de investigación
Publicaciones de investigaciónPublicaciones de investigación
Publicaciones de investigación
 
Introducción a la investigación/doctorado
Introducción a la investigación/doctoradoIntroducción a la investigación/doctorado
Introducción a la investigación/doctorado
 
Legislative data portals and linked data quality
Legislative data portals and linked data qualityLegislative data portals and linked data quality
Legislative data portals and linked data quality
 
Validating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectives
 
Wikidata
WikidataWikidata
Wikidata
 
Legislative document content extraction based on Semantic Web technologies
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
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
Introducción a la Web Semántica
Introducción a la Web SemánticaIntroducción a la Web Semántica
Introducción a la Web Semántica
 
2017 Tendencias en informática
2017 Tendencias en informática2017 Tendencias en informática
2017 Tendencias en informática
 
RDF, linked data and semantic web
RDF, linked data and semantic webRDF, linked data and semantic web
RDF, linked data and semantic web
 
19 javascript servidor
19 javascript servidor19 javascript servidor
19 javascript servidor
 
Como publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazadosComo publicar datos: hacia los datos abiertos enlazados
Como publicar datos: hacia los datos abiertos enlazados
 
16 Alternativas XML
16 Alternativas XML16 Alternativas XML
16 Alternativas XML
 
XSLT
XSLTXSLT
XSLT
 
XPath
XPathXPath
XPath
 
Arquitectura de la Web y Computación en el Servidor
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 Servidor
 
RDF Validation Future work and applications
RDF Validation Future work and applicationsRDF Validation Future work and applications
RDF Validation Future work and applications
 
Máster en Ingeniería Web
Máster en Ingeniería WebMáster en Ingeniería Web
Máster en Ingeniería Web
 
2016 temuco tecnologias_websemantica
2016 temuco tecnologias_websemantica2016 temuco tecnologias_websemantica
2016 temuco tecnologias_websemantica
 
2015 bogota datos_enlazados
2015 bogota datos_enlazados2015 bogota datos_enlazados
2015 bogota datos_enlazados
 

Último

FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsResearcher Researcher
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solidnamansinghjarodiya
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfManish Kumar
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Sumanth A
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsapna80328
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.elesangwon
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communicationpanditadesh123
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfNainaShrivastava14
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 

Último (20)

Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
Novel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending ActuatorsNovel 3D-Printed Soft Linear and Bending Actuators
Novel 3D-Printed Soft Linear and Bending Actuators
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Engineering Drawing section of solid
Engineering Drawing     section of solidEngineering Drawing     section of solid
Engineering Drawing section of solid
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdfModule-1-(Building Acoustics) Noise Control (Unit-3). pdf
Module-1-(Building Acoustics) Noise Control (Unit-3). pdf
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
Robotics-Asimov's Laws, Mechanical Subsystems, Robot Kinematics, Robot Dynami...
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
signals in triangulation .. ...Surveying
signals in triangulation .. ...Surveyingsignals in triangulation .. ...Surveying
signals in triangulation .. ...Surveying
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
2022 AWS DNA Hackathon 장애 대응 솔루션 jarvis.
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
multiple access in wireless communication
multiple access in wireless communicationmultiple access in wireless communication
multiple access in wireless communication
 
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdfPaper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
Paper Tube : Shigeru Ban projects and Case Study of Cardboard Cathedral .pdf
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 

SHACL by example RDF Validation tutorial

  • 1. SHACL by example RDF Validation tutorial Eric Prud'hommeaux World Wide Web Consortium MIT, Cambridge, MA, USA Harold Solbrig Mayo Clinic, USA Jose Emilio Labra Gayo WESO Research group University of Oviedo, Spain Iovka Boneva LINKS, INRIA & CNRS University of Lille, France
  • 2. SHACL W3c Data Shapes WG deliverable https://www.w3.org/TR/shacl/ Inspired by SPIN, OSLC & bits of ShEx SPARQL based extension mechanism RDF vocabulary Human friendly syntax inspired by ShEx proposed as a WG Note * * https://w3c.github.io/data-shapes/shacl-compact-syntax/
  • 3. Some definitions about SHACL Shape: collection of targets and constraints components Targets: specify which nodes in the data graph must conform to a shape Constraint components: Determine how to validate a node Shapes graph: an RDF graph that contains shapes Data graph: an RDF graph that contains data to be validated
  • 4. Example Try it. RDFShape http://goo.gl/FqXQpD prefix : <http://example.org/> prefix sh: <http://www.w3.org/ns/shacl#> prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix schema: <http://schema.org/> :UserShape a sh:NodeShape ; sh:targetNode :alice, :bob, :carol ; sh:property [ sh:path schema:name ; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:email ; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ; ] . :alice schema:name "Alice Cooper" ; schema:email <mailto:alice@mail.org> . :bob schema:firstName "Bob" ; schema:email <mailto:bob@mail.org> . :carol schema:name "Carol" ; schema:email "carol@mail.org" . Shapes graph Data graph  
  • 5. Target declarations Targets specify nodes that must be validated against the shape Several types Value Description targetNode Directly point to a node targetClass All nodes that have a given type targetProperty All nodes that have a given property target General mechanism based on SPARQL
  • 6. Target node Directly declare which nodes must validate the against the shape :UserShape a sh:NodeShape ; sh:targetNode :alice, :bob, :carol ; sh:property [ sh:path schema:name ; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:email ; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ; ] . :alice schema:name "Alice Cooper" ; schema:email <mailto:alice@mail.org> . :bob schema:givenName "Bob" ; schema:email <mailto:bob@mail.org> . :carol schema:name "Carol" ; schema:email "carol@mail.org" .
  • 7. Target class Selects all nodes that have a given type Looks for rdf:type declarations* * Also looks for rdfs:subClassOf*/rdf:type declarations :UserShape a sh:NodeShape ; sh:targetClass :User ; sh:property [ sh:path schema:name ; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:email ; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ; ] . :alice a :User; schema:name "Alice Cooper" ; schema:email <mailto:alice@mail.org> . :bob a :User; schema:givenName "Bob" ; schema:email <mailto:bob@mail.org> . :carol a :User; schema:name "Carol" ; schema:email "carol@mail.org" .
  • 8. Implicit target class A shape with type sh:Shape and rdfs:Class is a scope class of itself The targetClass declaration is implicit :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path schema:name ; sh:minCount 1; sh:maxCount 1; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:email ; sh:minCount 1; sh:maxCount 1; sh:nodeKind sh:IRI ; ] . :alice a :User; schema:name "Alice Cooper" ; schema:email <mailto:alice@mail.org> . :bob a :User; schema:givenName "Bob" ; schema:email <mailto:bob@mail.org> . :carol a :User; schema:name "Carol" ; schema:email "carol@mail.org" .
  • 9. Types of shapes Type Description Node shapes Constraints about a given focus node Property shapes Constraints about a property and the values of a path for a node Shape target declarations NodeShape PropertyShape constraint components constraint components sh:path: rdfs:Resource
  • 10. :alice a :User . <http://example.org/bob> a :User . _:1 a :User . Node Shapes Constraints about a focus node  :User a sh:NodeShape ; sh:nodeKind sh:IRI .
  • 11. Property shapes Constraints about a given property and its values for the focus node sh:property associates a shape with a property constraint sh:path identifies the path :User a sh:NodeShape ; sh:property [ sh:path schema:email ; sh:nodeKind sh:IRI ] . :alice a :User ; schema:email <mailto:alice@mail.org> . :bob a :User; schema:email <mailto:bob@mail.org> . :carol a :User; schema:email "carol@mail.org" .  
  • 12. Paths in property shapes Example with inverse path inversePath, zeroOrMorePath, alternativePath, oneOrMorePath, ... :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path [sh:inversePath schema:follows ]; sh:nodeKind sh:IRI ; ] . :alice a :User; schema:follows :bob . :bob a :User . :carol a :User; schema:follows :alice . _:1 schema:follows :bob . 
  • 13. Core constraint components Type Constraints Cardinality minCount, maxCount Types of values class, datatype, nodeKind Values node, in, hasValue Range of values minInclusive, maxInclusive minExclusive, maxExclusive String based minLength, maxLength, pattern, stem, uniqueLang Logical constraints not, and, or, xone Closed shapes closed, ignoredProperties Property pair constraints equals, disjoint, lessThan, lessThanOrEquals Non-validating constraints name, value, defaultValue Qualified shapes qualifiedValueShape, qualifiedMinCount, qualifiedMaxCount
  • 14. Cardinality constraints Constraint Description minCount Restricts minimum number of triples involving the focus node and a given predicate. Default value: 0 maxCount Restricts maximum number of triples involving the focus node and a given predicate. If not defined = unbounded Try it. http://goo.gl/9AwtFK :User a sh:NodeShape ; sh:property [ sh:path schema:follows ; sh:minCount 2 ; sh:maxCount 3 ; ] . :alice schema:follows :bob, :carol . :bob schema:follows :alice . :carol schema:follows :alice, :bob, :carol, :dave .  
  • 15. Datatypes of values Constraint Description datatype Restrict the datatype of all value nodes to a given value :User a sh:NodeShape ; sh:property [ sh:path schema:birthDate ; sh:datatype xsd:date ; ] . Try it: http://goo.gl/eDwxsU :alice schema:birthDate "1985-08-20"^^xsd:date . :bob schema:birthDate "Unknown"^^xsd:date . :carol schema:birthDate 1990 .  
  • 16. Class of values Constraint Description class Verify that each node in an instance of some class It also allows instances of subclasses* (*) The notion of SHACL instance is different from RDFS It is defined as rdfs:subClassOf*/rdf:type :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path schema:follows ; sh:class :User ] . :Manager rdfs:subClassOf :User . :alice a :User; schema:follows :bob . :bob a :Manager ; schema:follows :alice . :carol a :User; schema:follows :alice, :dave . :dave a :Employee . 
  • 17. Kind of values Constraint Description nodeKind Possible values: BlankNode, IRI, Literal, BlankNodeOrIRI, BlankNodeOrLiteral, IRIOrLiteral :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path schema:name ; sh:nodeKind sh:Literal ; ]; sh:property [ sh:path schema:follows ; sh:nodeKind sh:BlankNodeOrIRI ]; sh:nodeKind sh:IRI . :alice a :User; schema:name _:1 ; schema:follows :bob . :bob a :User; schema:name "Robert"; schema:follows [ schema:name "Dave" ] . :carol a :User; schema:name "Carol" ; schema:follows "Dave" . _:1 a :User .   
  • 18. Constraints on values Constraint Description hasValue Verifies that the focus node has a given value in Enumerates the value nodes that a property may have :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path schema:affiliation ; sh:hasValue :OurCompany ; ]; sh:property [ sh:path schema:gender ; sh:in (schema:Male schema:Female) ] . :alice a :User; schema:affiliation :OurCompany ; schema:gender schema:Female . :bob a :User; schema:affiliation :AnotherCompany ; schema:gender schema:Male . :carol a :User; schema:affiliation :OurCompany ; schema:gender schema:Unknown .  
  • 19. Constraints on values with another shape Constraint Description node* All values of a given property must have a given shape Recursion is not allowed in current SHACL :User a sh:NodeShape, rdfs:Class ; sh:property [ sh:path schema:worksFor ; sh:node :Company ; ] . :Company a sh:Shape ; sh:property [ sh:path schema:name ; sh:datatype xsd:string ; ] . :alice a :User; schema:worksFor :OurCompany . :bob a :User; schema:worksFor :Another . :OurCompany schema:name "OurCompany" . :Another schema:name 23 .  *recently renamed as sh:shape
  • 20. Value shapes and recursion Could we define cyclic data models as the following? :User a sh:NodeShape ; sh:property [ sh:path schema:worksFor ; sh:node :Company ; ] . :Company a sh:Shape ; sh:property [ sh:path schema:name ; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:employee ; sh:node :User ; ] . :User :Company schema:name xsd:string schema:worksFor schema:employee No, current SHACL specification doesn't allow this :alice schema:worksFor :OneCompany . :bob schema:worksFor :OneCompany . :carol schema:worksFor :OneCompany . :OneCompany schema:name "One" ; schema:employee :alice, :bob, :carol . Don't try it 
  • 21. SHACL approach to avoid recursion Add rdf:type arcs for every resource and use sh:class :User a sh:NodeShape ; sh:property [ sh:path schema:worksFor ; sh:class :Company ; ] . :Company a sh:Shape ; sh:property [ sh:path schema:name ; sh:datatype xsd:string ; ] ; sh:property [ sh:path schema:employee ; sh:class :User ; ] . :User :Company schema:name xsd:string schema:worksFor schema:employee Try it: http://goo.gl/wlVZJR :alice a :User ; schema:worksFor :OneCompany . :bob a :User ; schema:worksFor :OneCompany . :carol a :User ; schema:worksFor :Something . :OneCompany a :Company ; schema:name "One" ; schema:employee :alice, :bob, :carol . 
  • 22. Logical Operators Constraint Description and Conjunction of a list of shapes or Disjunction of a list of shapes not Negation of a shape xone Exactly one (similar XOR for 2 arguments)
  • 23. and Default behavior :User a sh:NodeShape ; sh:and ( [ sh:property [ sh:path schema:name; sh:minCount 1; ] ] [ sh:property [ sh:path schema:affiliation; sh:minCount 1; ] ] ) . :User a sh:Shape ; [ sh:property [ sh:path schema:name; sh:minCount 1; ] ] [ sh:property [ sh:path schema:affiliation; sh:minCount 1; ] ] . ≡
  • 24. or :User a sh:NodeShape ; sh:or ( [ sh:property [ sh:predicate foaf:name; sh:minCount 1; ] ] [ sh:property [ sh:predicate schema:name; sh:minCount 1; ] ] ) . :alice schema:name "Alice" . :bob foaf:name "Robert" . :carol rdfs:label "Carol" . 
  • 25. not :NotFoaf a sh:NodeShape ; sh:not [ a sh:Shape ; sh:property [ sh:predicate foaf:name ; sh:minCount 1 ; ] ; ] . :alice schema:name "Alice" . :bob foaf:name "Robert" . :carol rdfs:label "Carol" . 
  • 27. Value ranges Constraint Description minInclusive maxInclusive minExclusive maxExclusive Try it: http://goo.gl/qnd66j :Rating a sh:NodeShape ; sh:property [ sh:path schema:ratingValue ; sh:minInclusive 1 ; sh:maxInclusive 5 ; sh:datatype xsd:integer ] . :bad schema:ratingValue 1 . :average schema:ratingValue 3 . :veryGood schema:ratingValue 5 . :zero schema:ratingValue 0 .
  • 28. String based constraints Constraint Description minLength Restricts the minimum string length on value nodes maxLength Restricts the maximum string length on value nodes pattern Checks if the string value matches a regular expression stem Checks if all value nodes are IRIs and the IRI starts with a given string value uniqueLang Checks that no pair of nodes use the same language tag
  • 29. minLength/maxLength Try it: http://goo.gl/NrJl83 :User a sh:NodeShape ; sh:property [ sh:path schema:name ; sh:minLength 4 ; sh:maxLength 10 ; ] . :alice schema:name "Alice" . :bob schema:name "Bob" . :carol schema:name :Carol . :strange schema:name _:strange .  Checks the string representation of the value This cannot be applied to blank nodes If minLength = 0, no restriction on string length 
  • 30. pattern Checks if the values matches a regular expression It can be combined with sh:flags :Product a sh:NodeShape ; sh:property [ sh:path schema:productID ; sh:pattern "^Pd{3,4}" ; sh:flags "i" ; ] . :car schema:productID "P2345" . :bus schema:productID "p567" . :truck schema:productID "P12" . :bike schema:productID "B123" .   Try it: http://goo.gl/BsHpqu
  • 31. uniqueLang Checks that no pair of nodes use the same language tag Try it: http://goo.gl/B1PNcO :Country a sh:NodeShape ; sh:property [ sh:path schema:name ; sh:uniqueLang true ] . :spain schema:name "Spain"@en, "España"@es . :france schema:name "France"@en, "Francia"@es . :usa schema:name "USA"@en, "United States"@en. 
  • 32. Property pair constraints Constraint Description equals The sets of values of both properties at a given focus node must be equal disjoint The sets of values of both properties at a given focus node must be different lessThan The values must be smaller than the values of another property lessThanOrEquals The values must be smaller or equal than the values of another property Try it: http://goo.gl/BFzMoz :User a sh:NodeShape ; sh:property [ sh:path schema:givenName ; sh:equals foaf:firstName ]; sh:property [ sh:path schema:givenName ; sh:disjoint schema:lastName ] . :alice schema:givenName "Alice"; schema:lastName "Cooper"; foaf:firstName "Alice" . :bob schema:givenName "Bob"; schema:lastName "Smith" ; foaf:firstName "Robert" . :carol schema:givenName "Carol"; schema:lastName "Carol" ; foaf:firstName "Carol" .  
  • 33. Closed shapes Constraint Description closed Valid resources must only have values for properties that appear in sh:property ignoredProperties Optional list of properties that are also permitted :User a sh:NodeShape ; sh:closed true ; sh:ignoredProperties ( rdf:type ) ; sh:property [ sh:path schema:givenName ; ]; sh:property [ sh:path schema:lastName ; ] . :alice schema:givenName "Alice"; schema:lastName "Cooper" . :bob a :Employee ; schema:givenName "Bob"; schema:lastName "Smith" . :carol schema:givenName "Carol"; schema:lastName "King" ; rdfs:label "Carol" .  Try it: http://goo.gl/wcW16o
  • 34. Non-validating constraints Can be useful to annotate shapes or design UI forms Constraint Description name Provide human-readable labels for a property description Provide a description of a property order Relative order of the property group Group several constraints together :User a sh:NodeShape ; sh:property [ sh:path schema:url ; sh:name "URL"; sh:description "User URL"; sh:order 1 ]; sh:property [ sh:path schema:name ; sh:name "Name"; sh:description "User name"; sh:order 2 ] .
  • 35. Non-validating constraints :User a sh:NodeShape ; sh:property [ sh:path schema:url ; sh:name "URL"; sh:group :userDetails ]; sh:property [ sh:path schema:name ; sh:name "Name"; sh:group :userDetails ]; sh:property [ sh:path schema:address ; sh:name "Address"; sh:group :location ]; sh:property [ sh:path schema:country ; sh:name "Country"; sh:group :location ] . :userDetails a sh:PropertyGroup ; sh:order 0 ; rdfs:label "User details" . :location a sh:PropertyGroup ; sh:order 1 ; rdfs:label "Location" . User details URL: _____________________ Name: ___________________ Location Address: __________________ Country: __________________ An agent could generate a form like:
  • 36. Partitions and qualified values Problem with repeated properties Example: Books have two IDs (an isbn and an internal code) :Book a sh:Shape ; sh:property [ sh:predicate schema:productID ; sh:minCount 1; sh:datatype xsd:string ; sh:pattern "^isbn" ]; sh:property [ sh:predicate schema:productID ; sh:minCount 1; sh:datatype xsd:string ; sh:pattern "^code" ] . :b1 schema:productID "isbn:123-456-789" ; schema:productID "code234" . It fails!! Try it: http://goo.gl/x7oHpi
  • 37. Partitions and qualified value shapes Qualified value shapes verify that certain number of values of a given property have a given shape :Book a sh:Shape ; sh:property [ sh:predicate schema:productID ; sh:minCount 2; sh:maxCount 2; ]; sh:property [ sh:predicate schema:productID ; sh:qualifiedMinCount 1 ; sh:qualifiedValueShape [ sh:constraint [sh:pattern "^isbn" ]]]; sh:property [ sh:predicate schema:productID ; sh:qualifiedMinCount 1 ; sh:qualifiedValueShape [ sh:constraint [ sh:pattern "^code" ; ]]]; . Try it: http://goo.gl/v6Zffe
  • 38. Partitions and qualified value shapes partition declares a partition on the set of values :Book a sh:Shape ; sh:property [ sh:predicate schema:productID ; sh:partition ( [sh:minCount 1; sh:maxCount 1; sh:pattern "^isbn"] [sh:minCount 1; sh:maxCount 1; sh:pattern "^code"] ) ] . Don't try it Not yet implemented NOTE: This feature is under development The specification defines a Greedy algorithm and the violation errors depend on the order of the elements on the list This can be tricky when some values overlap several elements in the partition
  • 39. Filters Filters limit the nodes that are in scope to those that satisfy the filter Similar to: "if <filter> then ..." Try it: http://goo.gl/vadFMk :User a sh:Shape ; sh:scopeClass schema:Person ; sh:filterShape [ a sh:Shape ; # Optional triple sh:property [ sh:predicate schema:worksFor ; sh:hasValue :OurCompany ; ] ] ; sh:property [ sh:predicate schema:url ; sh:stem "http://ourcompany.org/" ; ] . :alice a schema:Person ; schema:worksFor :OurCompany ; schema:url <http://ourcompany.org/alice> . :bob a schema:Person ; schema:worksFor :OurCompany ; schema:url <http://othercompany.org/bob> . :carol a schema:Person ; schema:worksFor :OtherCompany ; schema:url <http://othercompany.org/carol> . 
  • 40. SPARQL constraints Constraints based on SPARQL code. The query returns validation errors Constraint Description SPARQLConstraint Type of constraints that will be considered as SPARQL constraints message Message in case of error sparql SPARQL code to be executed prefix Declare reusable prefix
  • 41. SPARQL constraints Special variables are used to bind values between SHACL and SPARQL processors Constraint Description $this Focus Node $shapesGraph Can be used to query the shapes graph $currentShape Current validated shape
  • 42. SPARQL constraints Mappings between result rows and error validation information Constraint Description sh:focusNode Value of $this variable sh:subject Value of ?subject variable sh:predicate Value of ?predicate variable sh:object Value of ?object variable sh:message Value of ?message variable sh:sourceConstraint The constraint that was validated against sh:sourceShape The shape that was validated against sh:severity sh:ViolationError by default or the value of sh:severity
  • 43. Extension mechanism SHACL offers an extension mechanism based on SPARQL In principle, it should be possible to add other mechanisms <http://www.w3.org/2000/01/rdf-schema#> sh:prefix "rdfs" . :SpanishLabelsShape a sh:Shape ; sh:constraint [ a sh:SPARQLConstraint ; sh:message "Values must be literals with Spanish language tag." ; sh:sparql """SELECT $this ($this AS ?subject) (rdfs:label AS ?predicate) (?value AS ?object) WHERE { $this rdfs:label ?value . FILTER (!isLiteral(?value) || !langMatches(lang(?value), "es"))""" ; ] . Try it: http://goo.gl/Wf1Lxn
  • 44. Other features Several features are currently under discussion SPARQL scopes and SPARQL functions Extension mechanism for other languages Recursion User-friendly syntax