SlideShare a Scribd company logo
1 of 28
SHACL Specification Draft
Holger Knublauch
W3C RDF Data Shapes Meeting
2015-05-19
History Lesson: Protégé-2000
• Frame-based, closed-world modeling tool
• Declarative core language, extended by
• Protégé Axiom Language (PAL)
Source: http://protege.stanford.edu/plugins/paltabs/pal-quickguide/PALTutorial.pdf
Where did PAL go?
• Lack of Standardization
• Lack of support outside of academia
• Wave of Open-World RDFS/OWL enthusiasm
• Fundamentally different situation with SPARQL
• SHACL can stand on the shoulders of giants
SHACL Draft Status
• This draft includes contributions from almost
everyone in the WG
• Covers all approved requirements
• Prototype (Open Source Jena API & TBC Free)
could be made available anytime
• TopQuadrant’s interests align with community
• Able to evolve quickly, willing to listen
Basic Principles
• Simple, declarative vocabulary for common
cases (“Core” or “Lite”)
• Fully integrated mechanism for complex cases
– SPARQL, but adding JavaScript etc is easy
• Macro facility to make complex cases simple
• Core language itself is defined as Macros
• Very consistent design, easy to implement
• Designed for both the Web and Intranets
Vocabulary
• Focus node: currently validated RDF node
• Constraint: condition that can be validated,
producing errors or warnings
• Shape: collection of constraints about the
same focus node
• Template: reusable constraint wrapped into
new high-level vocabulary term
ex:ExampleConstraintViolation
a sh:Error ;
sh:root ex:MyCurrentNode ;
sh:subject ex:MyCurrentNode ;
sh:predicate ex:someProperty ;
sh:object ex:someInvalidValue ;
sh:message "Incorrect value: expected something else" .
Constraint Violations
sh:ConstraintViolation
sh:message : xsd:string
sh:root : rdfs:Resource
sh:subject : rdfs:Resource
sh:predicate : rdf:Property
sh:object
sh:detail
sh:Warning sh:Error
sh:FatalError
sh:Constraint
sh:source
User Story 1
s1:PropertyMustHaveDomainShape
a sh:Shape ;
rdfs:comment "Every rdf:Property must have at least one rdfs:domain statement." ;
sh:scopeClass rdf:Property ;
sh:property [
sh:predicate rdfs:domain ;
sh:minCount 1 ;
] .
User Story 2
s2:PersonShape
a sh:Shape ;
rdfs:comment "Persons must have at least one name (xsd:string)." ;
sh:scopeClass s2:Person ;
sh:property [
sh:predicate s2:name ;
sh:datatype xsd:string ;
sh:minCount 1 ;
] .
User Story 2 (with ShapeClass)
s2b:Person
a sh:ShapeClass ;
rdfs:label "Person" ;
sh:property [
sh:predicate s2b:name ;
sh:datatype xsd:string ;
sh:minCount 1 ;
rdfs:comment "Persons must have at least one name (xsd:string)." ;
] .
{
"@id" : "s2b:Person",
"@type" : "sh:ShapeClass",
"label" : "Person",
"property" : {
"predicate" : "s2b:name",
"datatype" : "xsd:string",
"minCount" : 1,
"comment" : "Persons must have at least one name (xsd:string)."
}
}
Turtle
JSON-LD
User Story 3
s3:PersonMarriageShape
a sh:Shape ;
sh:scopeClass s3:Person ;
sh:constraint [
sh:message "Same-sex marriage is not permitted (in this model) – spouse is {?gender}." ;
sh:predicate s3:spouse ;
sh:severity sh:Warning ;
sh:sparql """
SELECT ?this (?this AS ?subject) (?spouse AS ?object) ?gender
WHERE {
?this s3:gender ?gender .
?this s3:spouse ?spouse .
?spouse s3:gender ?gender .
}""" ;
] .
User Story 4 (1/4)
• Issue tracker with context-specific constraints
• Issues may be assigned, unassigned, resolved
– Resolved issues must not have assignedTo
– The submitter of unresolved issues must have
email address
• Also: IssueShape is closed, i.e. only the three
enumerated properties are permitted
User Story 4 (2/4)
s4:IssueShape
a sh:Shape ;
sh:constraint sh:ClosedShape ;
sh:scopeClass s4:Issue ;
sh:property [
sh:predicate s4:assignedTo ;
sh:valueType s4:Person ;
] ;
sh:property [
sh:predicate s4:status ;
sh:maxCount 1 ;
sh:minCount 1 ;
sh:valueType s4:Status ;
] ;
sh:property [
sh:predicate s4:submittedBy ;
sh:valueType s4:Person ;
] .
s4:PendingIssueShape
a sh:Shape ;
rdfs:comment "Shape for Issues that are not resolved yet." ;
sh:scopeClass s4:Issue ;
sh:scopeShape [
sh:property [
sh:predicate s4:status ;
sh:allowedValues ( s4:assigned s4:unassigned ) ;
sh:minCount 1 ;
] ;
] ;
sh:property [
rdfs:comment "Pending issues must be submitted by someone who has an email address." ;
sh:predicate s4:submittedBy ;
sh:valueShape [
sh:property [
sh:predicate s4:email ;
sh:minCount 1 ;
] ;
] ;
] .
User Story 4 (3/4)
Scope for which this shape applies
s4:ResolvedIssueShape
a sh:Shape ;
rdfs:comment "Shape for Issues that are resolved." ;
sh:scopeClass s4:Issue ;
sh:scopeShape [
sh:property [
sh:predicate s4:status ;
sh:hasValue s4:resolved ;
] ;
] ;
sh:property [
sh:predicate s4:assignedTo ;
rdfs:comment "Resolved issues must not be assigned to anyone." ;
sh:maxCount 0 ;
] .
User Story 4 (4/4)
Scope for which this shape applies
OrConstraint Example from EDM
ore:Aggregation
sh:constraint [
a sh:OrConstraint ;
rdfs:comment "#7 edm:aggregatedCHO, edm:isShownAt or edm:isShownBy must be present" ;
sh:shapes (
[ sh:property [
sh:predicate edm:aggregatedCHO ;
sh:minCount 1 ;
] ;
]
[ sh:property [
sh:predicate edm:isShownAt ;
sh:minCount 1 ;
] ;
]
[ sh:property [
sh:predicate edm:isShownBy ;
sh:minCount 1 ;
] ;
]
) ;
] .
ore:Aggregation
sh:constraint [
sh:sparql """
SELECT ?this
WHERE {
FILTER NOT EXISTS {
?this edm:aggregatedCHO |
edm:isShownAt |
edm:isShownBy ?any
}
} """ ;
]
User Story 21
s21:UniqueLanguagePropertyConstraint
a sh:ConstraintTemplate ;
rdfs:label "Unique language property constraint" ;
rdfs:subClassOf sh:AbstractPropertyConstraint ;
sh:message "Language {?lang} is used more than once for {?predicate}" ;
sh:sparql """
SELECT ?this (lang(?label1) AS ?lang) (?this AS ?subject) ?predicate (?label1 AS ?object)
WHERE {
?this ?predicate ?label1 .
?this ?predicate ?label2 .
FILTER ((lang(?label1) = lang(?label2)) && (?label1 != ?label2)) .
}""" .
Reusable constraint macro
s21:SKOSConceptShape
a sh:Shape ;
sh:scopeClass skos:Concept ;
sh:constraint [
a s21:UniqueLanguagePropertyConstraint ;
sh:predicate skos:prefLabel ;
] .
User Story 23 (1/3)
s23:FlightReservationShape
a sh:Shape ;
sh:scopeClass schema:FlightReservation ;
sh:property [
sh:predicate schema:reservationFor ;
sh:valueShape [
sh:constraint [
sh:message "A future date is required to show a boarding pass."
sh:predicate schema:departureTime ;
sh:sparql """
SELECT ?this (?this AS ?subject) (?t AS ?object)
WHERE {
?this schema:departureTime ?t .
FILTER (?t <= NOW())
}""" ;
] ;
] ;
] .
User Story 23 (2/3)
s23:IrreflexiveChildrenShape
a sh:Shape ;
sh:scopeClass schema:Person ;
sh:property [
a s23:IrreflexivePropertyConstraint ;
sh:predicate schema:children ;
sh:valueType schema:Person ;
] .
s23:IrreflexivePropertyConstraint
a sh:ConstraintTemplate ;
rdfs:subClassOf sh:PropertyConstraint ;
rdfs:comment "Detects triples where ?this points to itself." ;
sh:message "For {?predicate} a focus not cannot point to itself." ;
sh:sparql """
SELECT ?this (?this AS ?subject) ?predicate (?this AS ?object)
WHERE {
?this ?predicate ?this
}""" .
s23:MrSelfie
a schema:Person ;
schema:children s23:MrSelfie .
User Story 23 (3/3)
s23:OrderedPropertyPairConstraint
a sh:ConstraintTemplate ;
rdfs:subClassOf sh:TemplateConstraint ;
sh:argument [
rdfs:label "The property with the smaller values." ;
sh:predicate s23:property1 ;
sh:valueType rdf:Property ;
] ;
sh:argument [
rdfs:label "The property with the larger values." ;
sh:predicate s23:property2 ;
sh:valueType rdf:Property ;
] ;
sh:message "{?property1} cannot be larger than {?property2}" ;
sh:sparql """
SELECT ?this (?this AS ?subject) (?property1 AS ?predicate) (?value1 AS ?object) ?property1 ?property2
WHERE {
?this ?property1 ?value1 .
?this ?property2 ?value2 .
FILTER (?value1 > ?value2)
}""" .
s23:MsImpossible
a schema:Person ;
schema:birthDate "2015-05-10"^^xsd:date ;
schema:deathDate "2015-05-09"^^xsd:date .
s23:BirthAndDeathDateShape
a sh:Shape ;
sh:scopeClass schema:Person ;
sh:constraint [
a s23:OrderedPropertyPairConstraint ;
s23:property1 schema:birthDate ;
s23:property2 schema:deathDate ;
] .
Same for start & end date
and other pairs
Reuse of Templates for EDM
rda:Person
a sh:ShapeClass ;
sh:constraint [
a edmsh:OrderedPropertyPairConstraint ;
edmsh:property1 rdaGr2:dateOfBirth ;
edmsh:property2 rdaGr2:dateOfDeath ;
rdfs:comment "#4 rdaGr2:dateofBirth must be earlier than
rdaGr2:dateOfDeath and rdaGr2:dateOfDeath must be later than
rdaGr2:dateofBirth (DC:R-43) (W3:R-6.6) (W3:R-5.9.1)" ;
] .
rdfs:Resource
sh:constraint [
a edmsh:LanguageShouldBePresentPropertyConstraint ;
sh:predicate skos:prefLabel ;
rdfs:comment "#5 Ideally the language tag should be present for skos:prefLabel" ;
] ;
sh:constraint [
a edmsh:UniqueLanguagePropertyConstraint ;
sh:predicate skos:prefLabel ;
rdfs:comment "#5 We must have only one skos:prefLabel per language." ;
] .
SHACL Design Axis
• Pragmatic design for real-world problems
• Based on many years of industry experience
• Trade-off between declarative and expressive
• Half of the examples needed SPARQL
• Declarative sub-languages can have
non-SPARQL implementations
Declarativeness Expressiveness
SPARQL JavaScriptSHACL Core Other SHACL Templates
Popular Templates evolve into Standards
The Current Draft
http://w3c.github.io/data-shapes/shacl/
Elements of the Draft
• Self-contained, consistent document
• “Core” and “Advanced” parts
• Plenty of examples (we can wait with Primer)
• Open Issues/TODOs are clearly marked
• Includes SHACL system vocabulary in Turtle
• SHACL is defined in itself
SHACL Metamodel
sh:Shape rdfs:Class
sh:ShapeClass
sh:scopeClass
sh:scopeShape
rdfs:Resource
rdf:typesh:nodeShape
sh:Shape
sh:Constraint
sh:PropertyConstraint
sh:minCount : xsd:integer
sh:maxCount : xsd:integer
sh:defaultValue
sh:allowedValues : rdf:List
sh:hasValue
sh:datatype : rdfs:Datatype
sh:nodeKind : sh:NodeKind
sh:valueType : rdfs:Class
sh:valueShape : sh:Shape
sh:AbstractPropertyConstraint
sh:predicate : rdf:Property
rdfs:label : xsd:string
rdfs:comment : xsd:string
sh:InversePropertyConstraint
sh:minCount : xsd:integer
sh:maxCount : xsd:integer
sh:valueType : rdfs:Class
… ?
sh:constraint
sh:inverseProperty
sh:property
sh:TemplateConstraintsh:NativeConstraint
sh:sparql : xsd:string
Example Definition (sh:hasValue)
A Future-Proof SHACL
• Most W3C languages were not really designed for
the Web, have hard-coded syntax and semantics
• Templates: new high-level language elements
• Functions: SPARQL extensions
– Some with SPARQL bodies
– Some with other executable languages (JS etc)
– Some provided by custom extensions (e.g. GeoSPARQL)
• Directly benefits from SPARQL’s evolution,
new SPARQL end points, database features etc
• Open to future developments (JSON-LD etc)
• sh:rule could be added consistently

More Related Content

What's hot

RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesKurt Cagle
 
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
 
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...
2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop...Dr.-Ing. Thomas Hartmann
 
Towards an RDF Validation Language based on Regular Expression Derivatives
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
 
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
 
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
 
SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020andyseaborne
 
Solid pods and the future of the spatial web
Solid pods and the future of the spatial webSolid pods and the future of the spatial web
Solid pods and the future of the spatial webKurt Cagle
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIsJosef Petrák
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic webMarakana Inc.
 

What's hot (19)

RDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data FramesRDF SHACL, Annotations, and Data Frames
RDF SHACL, Annotations, and Data Frames
 
Data shapes-test-suite
Data shapes-test-suiteData shapes-test-suite
Data shapes-test-suite
 
RDF data validation 2017 SHACL
RDF data validation 2017 SHACLRDF data validation 2017 SHACL
RDF data validation 2017 SHACL
 
ShEx by Example
ShEx by ExampleShEx by Example
ShEx by Example
 
RDF Data Model
RDF Data ModelRDF Data Model
RDF Data Model
 
Challenges and applications of RDF shapes
Challenges and applications of RDF shapesChallenges and applications of RDF shapes
Challenges and applications of RDF shapes
 
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...
2016.02 - Validating RDF Data Quality using Constraints to Direct the Develop...
 
Towards an RDF Validation Language based on Regular Expression Derivatives
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 RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectivesValidating RDF data: Challenges and perspectives
Validating RDF data: Challenges and perspectives
 
RDF Validation Future work and applications
RDF Validation Future work and applicationsRDF Validation Future work and applications
RDF Validation Future work and applications
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020
 
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
 
RDF briefing
RDF briefingRDF briefing
RDF briefing
 
Solid pods and the future of the spatial web
Solid pods and the future of the spatial webSolid pods and the future of the spatial web
Solid pods and the future of the spatial web
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 
A hands on overview of the semantic web
A hands on overview of the semantic webA hands on overview of the semantic web
A hands on overview of the semantic web
 
RDFa Tutorial
RDFa TutorialRDFa Tutorial
RDFa Tutorial
 
Jena framework
Jena frameworkJena framework
Jena framework
 

Similar to SHACL Specification Draft

Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2Dimitris Kontokostas
 
Part04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxPart04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxvudinhphuong96
 
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
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"George Stathis
 
SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)Péter Király
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)javier ramirez
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKrAlvaro Graves
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsDr. Neil Brittliff
 
RESTFul development with Apache sling
RESTFul development with Apache slingRESTFul development with Apache sling
RESTFul development with Apache slingSergii Fesenko
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017Gregg Kellogg
 
Transformational Tricks for RDF.pptx
Transformational Tricks for RDF.pptxTransformational Tricks for RDF.pptx
Transformational Tricks for RDF.pptxKurt Cagle
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebShamod Lacoul
 
Midgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsMidgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsHenri Bergius
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage灿辉 葛
 
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesSyntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesTara Athan
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDBrogerbodamer
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data ModelingDATAVERSITY
 

Similar to SHACL Specification Draft (20)

Graph databases & data integration v2
Graph databases & data integration v2Graph databases & data integration v2
Graph databases & data integration v2
 
Part04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptxPart04_SHACL By Example presentation.pptx
Part04_SHACL By Example presentation.pptx
 
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
 
Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"Elasticsearch & "PeopleSearch"
Elasticsearch & "PeopleSearch"
 
JSON-LD Update
JSON-LD UpdateJSON-LD Update
JSON-LD Update
 
Optimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdfOptimizing SPARQL Queries with SHACL.pdf
Optimizing SPARQL Queries with SHACL.pdf
 
SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)SHACL shortly (ELAG 2018)
SHACL shortly (ELAG 2018)
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
 
RESTFul development with Apache sling
RESTFul development with Apache slingRESTFul development with Apache sling
RESTFul development with Apache sling
 
JSON-LD update DC 2017
JSON-LD update DC 2017JSON-LD update DC 2017
JSON-LD update DC 2017
 
Transformational Tricks for RDF.pptx
Transformational Tricks for RDF.pptxTransformational Tricks for RDF.pptx
Transformational Tricks for RDF.pptx
 
A Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic WebA Hands On Overview Of The Semantic Web
A Hands On Overview Of The Semantic Web
 
HyperGraphQL
HyperGraphQLHyperGraphQL
HyperGraphQL
 
Midgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applicationsMidgard2 - Content Repository for mobile applications
Midgard2 - Content Repository for mobile applications
 
Rdf data-model-and-storage
Rdf data-model-and-storageRdf data-model-and-storage
Rdf data-model-and-storage
 
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation LanguagesSyntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
Syntax Reuse: XSLT as a Metalanguage for Knowledge Representation Languages
 
Schema Design with MongoDB
Schema Design with MongoDBSchema Design with MongoDB
Schema Design with MongoDB
 
10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling10gen Presents Schema Design and Data Modeling
10gen Presents Schema Design and Data Modeling
 

Recently uploaded

buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?Watsoo Telematics
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 

Recently uploaded (20)

buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?What are the features of Vehicle Tracking System?
What are the features of Vehicle Tracking System?
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 

SHACL Specification Draft

  • 1. SHACL Specification Draft Holger Knublauch W3C RDF Data Shapes Meeting 2015-05-19
  • 2. History Lesson: Protégé-2000 • Frame-based, closed-world modeling tool • Declarative core language, extended by • Protégé Axiom Language (PAL) Source: http://protege.stanford.edu/plugins/paltabs/pal-quickguide/PALTutorial.pdf
  • 3. Where did PAL go? • Lack of Standardization • Lack of support outside of academia • Wave of Open-World RDFS/OWL enthusiasm • Fundamentally different situation with SPARQL • SHACL can stand on the shoulders of giants
  • 4. SHACL Draft Status • This draft includes contributions from almost everyone in the WG • Covers all approved requirements • Prototype (Open Source Jena API & TBC Free) could be made available anytime • TopQuadrant’s interests align with community • Able to evolve quickly, willing to listen
  • 5. Basic Principles • Simple, declarative vocabulary for common cases (“Core” or “Lite”) • Fully integrated mechanism for complex cases – SPARQL, but adding JavaScript etc is easy • Macro facility to make complex cases simple • Core language itself is defined as Macros • Very consistent design, easy to implement • Designed for both the Web and Intranets
  • 6. Vocabulary • Focus node: currently validated RDF node • Constraint: condition that can be validated, producing errors or warnings • Shape: collection of constraints about the same focus node • Template: reusable constraint wrapped into new high-level vocabulary term
  • 7. ex:ExampleConstraintViolation a sh:Error ; sh:root ex:MyCurrentNode ; sh:subject ex:MyCurrentNode ; sh:predicate ex:someProperty ; sh:object ex:someInvalidValue ; sh:message "Incorrect value: expected something else" . Constraint Violations sh:ConstraintViolation sh:message : xsd:string sh:root : rdfs:Resource sh:subject : rdfs:Resource sh:predicate : rdf:Property sh:object sh:detail sh:Warning sh:Error sh:FatalError sh:Constraint sh:source
  • 8. User Story 1 s1:PropertyMustHaveDomainShape a sh:Shape ; rdfs:comment "Every rdf:Property must have at least one rdfs:domain statement." ; sh:scopeClass rdf:Property ; sh:property [ sh:predicate rdfs:domain ; sh:minCount 1 ; ] .
  • 9. User Story 2 s2:PersonShape a sh:Shape ; rdfs:comment "Persons must have at least one name (xsd:string)." ; sh:scopeClass s2:Person ; sh:property [ sh:predicate s2:name ; sh:datatype xsd:string ; sh:minCount 1 ; ] .
  • 10. User Story 2 (with ShapeClass) s2b:Person a sh:ShapeClass ; rdfs:label "Person" ; sh:property [ sh:predicate s2b:name ; sh:datatype xsd:string ; sh:minCount 1 ; rdfs:comment "Persons must have at least one name (xsd:string)." ; ] . { "@id" : "s2b:Person", "@type" : "sh:ShapeClass", "label" : "Person", "property" : { "predicate" : "s2b:name", "datatype" : "xsd:string", "minCount" : 1, "comment" : "Persons must have at least one name (xsd:string)." } } Turtle JSON-LD
  • 11. User Story 3 s3:PersonMarriageShape a sh:Shape ; sh:scopeClass s3:Person ; sh:constraint [ sh:message "Same-sex marriage is not permitted (in this model) – spouse is {?gender}." ; sh:predicate s3:spouse ; sh:severity sh:Warning ; sh:sparql """ SELECT ?this (?this AS ?subject) (?spouse AS ?object) ?gender WHERE { ?this s3:gender ?gender . ?this s3:spouse ?spouse . ?spouse s3:gender ?gender . }""" ; ] .
  • 12. User Story 4 (1/4) • Issue tracker with context-specific constraints • Issues may be assigned, unassigned, resolved – Resolved issues must not have assignedTo – The submitter of unresolved issues must have email address • Also: IssueShape is closed, i.e. only the three enumerated properties are permitted
  • 13. User Story 4 (2/4) s4:IssueShape a sh:Shape ; sh:constraint sh:ClosedShape ; sh:scopeClass s4:Issue ; sh:property [ sh:predicate s4:assignedTo ; sh:valueType s4:Person ; ] ; sh:property [ sh:predicate s4:status ; sh:maxCount 1 ; sh:minCount 1 ; sh:valueType s4:Status ; ] ; sh:property [ sh:predicate s4:submittedBy ; sh:valueType s4:Person ; ] .
  • 14. s4:PendingIssueShape a sh:Shape ; rdfs:comment "Shape for Issues that are not resolved yet." ; sh:scopeClass s4:Issue ; sh:scopeShape [ sh:property [ sh:predicate s4:status ; sh:allowedValues ( s4:assigned s4:unassigned ) ; sh:minCount 1 ; ] ; ] ; sh:property [ rdfs:comment "Pending issues must be submitted by someone who has an email address." ; sh:predicate s4:submittedBy ; sh:valueShape [ sh:property [ sh:predicate s4:email ; sh:minCount 1 ; ] ; ] ; ] . User Story 4 (3/4) Scope for which this shape applies
  • 15. s4:ResolvedIssueShape a sh:Shape ; rdfs:comment "Shape for Issues that are resolved." ; sh:scopeClass s4:Issue ; sh:scopeShape [ sh:property [ sh:predicate s4:status ; sh:hasValue s4:resolved ; ] ; ] ; sh:property [ sh:predicate s4:assignedTo ; rdfs:comment "Resolved issues must not be assigned to anyone." ; sh:maxCount 0 ; ] . User Story 4 (4/4) Scope for which this shape applies
  • 16. OrConstraint Example from EDM ore:Aggregation sh:constraint [ a sh:OrConstraint ; rdfs:comment "#7 edm:aggregatedCHO, edm:isShownAt or edm:isShownBy must be present" ; sh:shapes ( [ sh:property [ sh:predicate edm:aggregatedCHO ; sh:minCount 1 ; ] ; ] [ sh:property [ sh:predicate edm:isShownAt ; sh:minCount 1 ; ] ; ] [ sh:property [ sh:predicate edm:isShownBy ; sh:minCount 1 ; ] ; ] ) ; ] . ore:Aggregation sh:constraint [ sh:sparql """ SELECT ?this WHERE { FILTER NOT EXISTS { ?this edm:aggregatedCHO | edm:isShownAt | edm:isShownBy ?any } } """ ; ]
  • 17. User Story 21 s21:UniqueLanguagePropertyConstraint a sh:ConstraintTemplate ; rdfs:label "Unique language property constraint" ; rdfs:subClassOf sh:AbstractPropertyConstraint ; sh:message "Language {?lang} is used more than once for {?predicate}" ; sh:sparql """ SELECT ?this (lang(?label1) AS ?lang) (?this AS ?subject) ?predicate (?label1 AS ?object) WHERE { ?this ?predicate ?label1 . ?this ?predicate ?label2 . FILTER ((lang(?label1) = lang(?label2)) && (?label1 != ?label2)) . }""" . Reusable constraint macro s21:SKOSConceptShape a sh:Shape ; sh:scopeClass skos:Concept ; sh:constraint [ a s21:UniqueLanguagePropertyConstraint ; sh:predicate skos:prefLabel ; ] .
  • 18. User Story 23 (1/3) s23:FlightReservationShape a sh:Shape ; sh:scopeClass schema:FlightReservation ; sh:property [ sh:predicate schema:reservationFor ; sh:valueShape [ sh:constraint [ sh:message "A future date is required to show a boarding pass." sh:predicate schema:departureTime ; sh:sparql """ SELECT ?this (?this AS ?subject) (?t AS ?object) WHERE { ?this schema:departureTime ?t . FILTER (?t <= NOW()) }""" ; ] ; ] ; ] .
  • 19. User Story 23 (2/3) s23:IrreflexiveChildrenShape a sh:Shape ; sh:scopeClass schema:Person ; sh:property [ a s23:IrreflexivePropertyConstraint ; sh:predicate schema:children ; sh:valueType schema:Person ; ] . s23:IrreflexivePropertyConstraint a sh:ConstraintTemplate ; rdfs:subClassOf sh:PropertyConstraint ; rdfs:comment "Detects triples where ?this points to itself." ; sh:message "For {?predicate} a focus not cannot point to itself." ; sh:sparql """ SELECT ?this (?this AS ?subject) ?predicate (?this AS ?object) WHERE { ?this ?predicate ?this }""" . s23:MrSelfie a schema:Person ; schema:children s23:MrSelfie .
  • 20. User Story 23 (3/3) s23:OrderedPropertyPairConstraint a sh:ConstraintTemplate ; rdfs:subClassOf sh:TemplateConstraint ; sh:argument [ rdfs:label "The property with the smaller values." ; sh:predicate s23:property1 ; sh:valueType rdf:Property ; ] ; sh:argument [ rdfs:label "The property with the larger values." ; sh:predicate s23:property2 ; sh:valueType rdf:Property ; ] ; sh:message "{?property1} cannot be larger than {?property2}" ; sh:sparql """ SELECT ?this (?this AS ?subject) (?property1 AS ?predicate) (?value1 AS ?object) ?property1 ?property2 WHERE { ?this ?property1 ?value1 . ?this ?property2 ?value2 . FILTER (?value1 > ?value2) }""" . s23:MsImpossible a schema:Person ; schema:birthDate "2015-05-10"^^xsd:date ; schema:deathDate "2015-05-09"^^xsd:date . s23:BirthAndDeathDateShape a sh:Shape ; sh:scopeClass schema:Person ; sh:constraint [ a s23:OrderedPropertyPairConstraint ; s23:property1 schema:birthDate ; s23:property2 schema:deathDate ; ] . Same for start & end date and other pairs
  • 21. Reuse of Templates for EDM rda:Person a sh:ShapeClass ; sh:constraint [ a edmsh:OrderedPropertyPairConstraint ; edmsh:property1 rdaGr2:dateOfBirth ; edmsh:property2 rdaGr2:dateOfDeath ; rdfs:comment "#4 rdaGr2:dateofBirth must be earlier than rdaGr2:dateOfDeath and rdaGr2:dateOfDeath must be later than rdaGr2:dateofBirth (DC:R-43) (W3:R-6.6) (W3:R-5.9.1)" ; ] . rdfs:Resource sh:constraint [ a edmsh:LanguageShouldBePresentPropertyConstraint ; sh:predicate skos:prefLabel ; rdfs:comment "#5 Ideally the language tag should be present for skos:prefLabel" ; ] ; sh:constraint [ a edmsh:UniqueLanguagePropertyConstraint ; sh:predicate skos:prefLabel ; rdfs:comment "#5 We must have only one skos:prefLabel per language." ; ] .
  • 22. SHACL Design Axis • Pragmatic design for real-world problems • Based on many years of industry experience • Trade-off between declarative and expressive • Half of the examples needed SPARQL • Declarative sub-languages can have non-SPARQL implementations Declarativeness Expressiveness SPARQL JavaScriptSHACL Core Other SHACL Templates Popular Templates evolve into Standards
  • 24. Elements of the Draft • Self-contained, consistent document • “Core” and “Advanced” parts • Plenty of examples (we can wait with Primer) • Open Issues/TODOs are clearly marked • Includes SHACL system vocabulary in Turtle • SHACL is defined in itself
  • 26. sh:Shape sh:Constraint sh:PropertyConstraint sh:minCount : xsd:integer sh:maxCount : xsd:integer sh:defaultValue sh:allowedValues : rdf:List sh:hasValue sh:datatype : rdfs:Datatype sh:nodeKind : sh:NodeKind sh:valueType : rdfs:Class sh:valueShape : sh:Shape sh:AbstractPropertyConstraint sh:predicate : rdf:Property rdfs:label : xsd:string rdfs:comment : xsd:string sh:InversePropertyConstraint sh:minCount : xsd:integer sh:maxCount : xsd:integer sh:valueType : rdfs:Class … ? sh:constraint sh:inverseProperty sh:property sh:TemplateConstraintsh:NativeConstraint sh:sparql : xsd:string
  • 28. A Future-Proof SHACL • Most W3C languages were not really designed for the Web, have hard-coded syntax and semantics • Templates: new high-level language elements • Functions: SPARQL extensions – Some with SPARQL bodies – Some with other executable languages (JS etc) – Some provided by custom extensions (e.g. GeoSPARQL) • Directly benefits from SPARQL’s evolution, new SPARQL end points, database features etc • Open to future developments (JSON-LD etc) • sh:rule could be added consistently