SlideShare a Scribd company logo
SPIN and Shapes 
RDF Data Shapes WG F2F, Nov 2014 
Holger Knublauch 
TopQuadrant, Inc.
SPIN History and Status 
• Created at TopQuadrant 2008 
• Addresses requirements from customer projects 
• Supported by TopBraid tools (incl. TBC Free) 
• Open source: http://topbraid.org/spin/api/ 
• Partial support by 3rd party database vendors 
• W3C Member Submission 2011 
• Many SPIN-based systems are in production
Constraints in SPARQL (ASK) 
ss:Square 
spin:constraint [ 
a sp:Ask ; 
sp:text """ 
# Width and height must be equal 
ASK WHERE { 
?this ss:width ?width . 
?this ss:height ?height . 
FILTER (?width != ?height) . 
} 
""" 
]
Constraints in SPARQL (CONSTRUCT) 
ss:Square 
spin:constraint [ 
rdf:type sp:Construct ; 
sp:text """ 
# Width and height must be equal 
CONSTRUCT { 
_:cv a spin:ConstraintViolation ; 
spin:violationRoot ?this ; 
spin:violationPath ss:height ; 
rdfs:label "Width and height must be equal" 
} 
WHERE { 
?this ss:width ?width . 
?this ss:height ?height . 
FILTER (?width != ?height) . 
} 
""" 
]
Possible Syntactic Sugar 
Idea from Simister, Brickley: 
http://www.w3.org/2001/sw/wiki/images/0/00/SimpleApplication- 
SpecificConstraintsforRDFModels.pdf 
ss:Square 
spin:constraint [ 
a spin:Ask ; 
spin:context ss:height ; 
spin:message "Width and height must be equal" ; 
spin:sparql """ 
ASK WHERE { 
?this ss:width ?width . 
?this ss:height ?height . 
FILTER (?width != ?height) . 
} 
""" 
] 
(The current SPIN is just a starting point, it’s an open RDF vocabulary)
Alternative to source code editing 
Syntax checking 
Auto-complete 
Keyword highlighting 
Results preview …
Positive values constraint in SPARQL 
ss:Rectangle 
spin:constraint [ 
a sp:Construct ; 
sp:text """ 
# The value of ss:width must be > 0 
CONSTRUCT { 
_:cv a spin:ConstraintViolation ; 
spin:violationRoot ?this ; 
spin:violationPath ss:width ; 
rdfs:label "The width of a rectangle must be > 0" 
} 
WHERE { 
?this ss:width ?width . 
FILTER (?width <= 0) . 
} 
""" 
] 
… the same would have to be repeated for ss:height
Generalizing the constraint 
ss:Rectangle 
spin:constraint [ 
a sp:Construct ; 
sp:text """ 
# The value of ss:width must be > 0 
CONSTRUCT { 
_:cv a spin:ConstraintViolation ; 
spin:violationRoot ?this ; 
spin:violationPath ss:width ; 
rdfs:label "The width of a rectangle must be > 0" 
} 
WHERE { 
?this ss:width ?width . 
FILTER (?width <= 0) . 
} 
""" 
] 
ss:width could be 
replaced with any 
property, e.g. 
ss:height
Introducing a SPIN Template 
ss:PositivePropertyValueConstraint a spin:ConstructTemplate ; 
spin:constraint [ a spl:Argument 
spl:predicate arg:property ; 
spl:valueType rdf:Property ; 
rdfs:comment "The property to constrain (e.g. ss:width)" 
] ; 
spin:body [ a sp:Construct ; 
sp:text """ 
CONSTRUCT { 
_:cv a spin:ConstraintViolation ; 
spin:violationRoot ?this ; 
spin:violationPath ?property ; 
rdfs:label "Positive value expected" 
} 
WHERE { 
?this ?property ?value . 
FILTER (?value <= 0) . 
} 
""" 
] ;
Using a SPIN Template 
ss:Rectangle 
spin:constraint [ 
a ss:PositivePropertyValueConstraint ; 
arg:property ss:height ; 
] ; 
spin:constraint [ 
a ss:PositivePropertyValueConstraint ; 
arg:property ss:width ; 
] . 
Such templates can be published in libraries, for example for Shapes.
Example Tool Support (1)
Example Tool Support (2)
Example Tool Support (3)
SPIN Templates 
• Can define new modeling languages 
• Template definitions are linked data (URI etc) 
• Encapsulate/hide SPARQL queries 
• Yet executable on standard RDF databases 
• But processors do not have to use SPARQL only 
• Combine maximum flexibility & expressivity 
with a structural user-friendly syntax.
SPIN Functions
SPIN Libraries 
• SPIN templates, functions and constraints can 
be published on the semantic web 
– Example: http://semwebquality.org 
• Libraries define “Profiles” 
• Web provides a natural evolution mechanism 
• This WG would define a standard library
Possible Shapes Architecture
OSLC Bug Example 
oslc_cm:ChangeRequest 
a rdfs:Class ; 
rdfs:label "Change request" ; 
oslc:property [ 
ChangeRequest 
title : string [1..1] 
status : status-values [0..1] 
a oslc:Property ; 
oslc:propertyDefinition dcterms:title ; 
oslc:occurs oslc:Exactly-one 
] ; 
oslc:property [ 
a oslc:Property ; 
oslc:propertyDefinition oslc_cm:status ; 
oslc:allowedValues oslc_cm:status-values ; 
oslc:occurs oslc:Zero-or-one 
] . 
This is a valid SPIN document

More Related Content

PPTX
SHACL Specification Draft
Holger Knublauch
 
PPTX
SPIN in Five Slides
Holger Knublauch
 
PPTX
RDF SHACL, Annotations, and Data Frames
Kurt Cagle
 
PPTX
ElasticSearch AJUG 2013
Roy Russo
 
PDF
Elasticsearch Basics
Shifa Khan
 
PDF
Introduction to Elasticsearch
Sperasoft
 
ODP
Cool bonsai cool - an introduction to ElasticSearch
clintongormley
 
PDF
Polyglot persistence
Otávio Santana
 
SHACL Specification Draft
Holger Knublauch
 
SPIN in Five Slides
Holger Knublauch
 
RDF SHACL, Annotations, and Data Frames
Kurt Cagle
 
ElasticSearch AJUG 2013
Roy Russo
 
Elasticsearch Basics
Shifa Khan
 
Introduction to Elasticsearch
Sperasoft
 
Cool bonsai cool - an introduction to ElasticSearch
clintongormley
 
Polyglot persistence
Otávio Santana
 

What's hot (20)

PDF
Gerry McNicol Graph Databases
Gerry McNicol
 
PDF
Simple search with elastic search
markstory
 
PPTX
Solid pods and the future of the spatial web
Kurt Cagle
 
PPTX
Elastic Search
Navule Rao
 
PDF
Your Data, Your Search, ElasticSearch (EURUKO 2011)
Karel Minarik
 
PDF
Elasticsearch And Ruby [RuPy2012]
Karel Minarik
 
PDF
Analytics and Graph Traversal with Solr - Yonik Seeley, Cloudera
Lucidworks
 
PDF
Elasticsearch (Rubyshift 2013)
Karel Minarik
 
PPTX
Beyond shuffling - Strata London 2016
Holden Karau
 
PPTX
Aem sling resolution
Gaurav Tiwari
 
PPTX
Elastic search Walkthrough
Suhel Meman
 
PPTX
Solr vs. Elasticsearch - Case by Case
Alexandre Rafalovitch
 
PDF
A Survey of Elasticsearch Usage
Greg Brown
 
PPT
Finding knowledge, data and answers on the Semantic Web
ebiquity
 
PDF
Elasticsearch in 15 Minutes
Karel Minarik
 
PPTX
An Introduction to Elastic Search.
Jurriaan Persyn
 
PDF
Json the-x-in-ajax1588
Ramamohan Chokkam
 
PDF
Using Sphinx for Search in PHP
Mike Lively
 
PDF
Introduction to Elasticsearch
Jason Austin
 
PPTX
How to scale relational (OLTP) databases. Think: Sharding @C16LV
Maxym Kharchenko
 
Gerry McNicol Graph Databases
Gerry McNicol
 
Simple search with elastic search
markstory
 
Solid pods and the future of the spatial web
Kurt Cagle
 
Elastic Search
Navule Rao
 
Your Data, Your Search, ElasticSearch (EURUKO 2011)
Karel Minarik
 
Elasticsearch And Ruby [RuPy2012]
Karel Minarik
 
Analytics and Graph Traversal with Solr - Yonik Seeley, Cloudera
Lucidworks
 
Elasticsearch (Rubyshift 2013)
Karel Minarik
 
Beyond shuffling - Strata London 2016
Holden Karau
 
Aem sling resolution
Gaurav Tiwari
 
Elastic search Walkthrough
Suhel Meman
 
Solr vs. Elasticsearch - Case by Case
Alexandre Rafalovitch
 
A Survey of Elasticsearch Usage
Greg Brown
 
Finding knowledge, data and answers on the Semantic Web
ebiquity
 
Elasticsearch in 15 Minutes
Karel Minarik
 
An Introduction to Elastic Search.
Jurriaan Persyn
 
Json the-x-in-ajax1588
Ramamohan Chokkam
 
Using Sphinx for Search in PHP
Mike Lively
 
Introduction to Elasticsearch
Jason Austin
 
How to scale relational (OLTP) databases. Think: Sharding @C16LV
Maxym Kharchenko
 
Ad

Similar to SPIN and Shapes (20)

PPTX
SHACL: Shaping the Big Ball of Data Mud
Richard Cyganiak
 
PPTX
The openCypher Project - An Open Graph Query Language
Neo4j
 
PDF
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
Daniel N
 
PPT
A hands on overview of the semantic web
Marakana Inc.
 
PDF
Kubernetes and AWS Lambda can play nicely together
Edward Wilde
 
KEY
Linked services
Carlos Pedrinaci
 
PDF
All about elasticsearch language clients
Enterprise Search Warsaw Meetup
 
PDF
slides-students-C04.pdf
MonkeyDLuffy708724
 
PDF
Data translation with SPARQL 1.1
andreas_schultz
 
PPT
Web development basics (Part-3)
Rajat Pratap Singh
 
PPTX
From Open Annotations to W3C Web Annotations (and the impact on IIIF Present...
Simeon Warner
 
PPTX
Rik Hepworth - ARM Yourself for Effective Azure Provisioning
WinOps Conf
 
PDF
JSON REST API for WordPress
Taylor Lovett
 
PDF
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Christian Tzolov
 
PDF
Data Science with Solr and Spark
Lucidworks
 
PPTX
Apache HAWQ Architecture
Alexey Grishchenko
 
PPTX
The Pushdown of Everything by Stephan Kessler and Santiago Mola
Spark Summit
 
PDF
GramsciProject - technical presentation
Christian Morbidoni
 
PDF
Solid and Sustainable Development in Scala
scalaconfjp
 
PDF
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital.AI
 
SHACL: Shaping the Big Ball of Data Mud
Richard Cyganiak
 
The openCypher Project - An Open Graph Query Language
Neo4j
 
ElasticSearch: Distributed Multitenant NoSQL Datastore and Search Engine
Daniel N
 
A hands on overview of the semantic web
Marakana Inc.
 
Kubernetes and AWS Lambda can play nicely together
Edward Wilde
 
Linked services
Carlos Pedrinaci
 
All about elasticsearch language clients
Enterprise Search Warsaw Meetup
 
slides-students-C04.pdf
MonkeyDLuffy708724
 
Data translation with SPARQL 1.1
andreas_schultz
 
Web development basics (Part-3)
Rajat Pratap Singh
 
From Open Annotations to W3C Web Annotations (and the impact on IIIF Present...
Simeon Warner
 
Rik Hepworth - ARM Yourself for Effective Azure Provisioning
WinOps Conf
 
JSON REST API for WordPress
Taylor Lovett
 
Using Apache Calcite for Enabling SQL and JDBC Access to Apache Geode and Oth...
Christian Tzolov
 
Data Science with Solr and Spark
Lucidworks
 
Apache HAWQ Architecture
Alexey Grishchenko
 
The Pushdown of Everything by Stephan Kessler and Santiago Mola
Spark Summit
 
GramsciProject - technical presentation
Christian Morbidoni
 
Solid and Sustainable Development in Scala
scalaconfjp
 
Vital AI MetaQL: Queries Across NoSQL, SQL, Sparql, and Spark
Vital.AI
 
Ad

Recently uploaded (20)

PDF
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
PPTX
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
PPTX
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
PDF
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
PDF
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPTX
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
PDF
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
PPTX
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
DOCX
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
PDF
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
PDF
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
PDF
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
PDF
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
PPTX
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
PPTX
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
PDF
Protecting the Digital World Cyber Securit
dnthakkar16
 
PPT
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
PDF
Bandai Playdia The Book - David Glotz
BluePanther6
 
PDF
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 
ChatPharo: an Open Architecture for Understanding How to Talk Live to LLMs
ESUG
 
slidesgo-unlocking-the-code-the-dynamic-dance-of-variables-and-constants-2024...
kr2589474
 
TRAVEL APIs | WHITE LABEL TRAVEL API | TOP TRAVEL APIs
philipnathen82
 
Balancing Resource Capacity and Workloads with OnePlan – Avoid Overloading Te...
OnePlan Solutions
 
Key Features to Look for in Arizona App Development Services
Net-Craft.com
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
ASSIGNMENT_1[1][1][1][1][1] (1) variables.pptx
kr2589474
 
Using licensed Data Loss Prevention (DLP) as a strategic proactive data secur...
Q-Advise
 
The-Dawn-of-AI-Reshaping-Our-World.pptxx
parthbhanushali307
 
Can You Build Dashboards Using Open Source Visualization Tool.docx
Varsha Nayak
 
49784907924775488180_LRN2959_Data_Pump_23ai.pdf
Abilash868456
 
49785682629390197565_LRN3014_Migrating_the_Beast.pdf
Abilash868456
 
Summary Of Odoo 18.1 to 18.4 : The Way For Odoo 19
CandidRoot Solutions Private Limited
 
Salesforce Implementation Services Provider.pdf
VALiNTRY360
 
classification of computer and basic part of digital computer
ravisinghrajpurohit3
 
Maximizing Revenue with Marketo Measure: A Deep Dive into Multi-Touch Attribu...
bbedford2
 
Protecting the Digital World Cyber Securit
dnthakkar16
 
Why Reliable Server Maintenance Service in New York is Crucial for Your Business
Sam Vohra
 
Bandai Playdia The Book - David Glotz
BluePanther6
 
New Download FL Studio Crack Full Version [Latest 2025]
imang66g
 

SPIN and Shapes

  • 1. SPIN and Shapes RDF Data Shapes WG F2F, Nov 2014 Holger Knublauch TopQuadrant, Inc.
  • 2. SPIN History and Status • Created at TopQuadrant 2008 • Addresses requirements from customer projects • Supported by TopBraid tools (incl. TBC Free) • Open source: http://topbraid.org/spin/api/ • Partial support by 3rd party database vendors • W3C Member Submission 2011 • Many SPIN-based systems are in production
  • 3. Constraints in SPARQL (ASK) ss:Square spin:constraint [ a sp:Ask ; sp:text """ # Width and height must be equal ASK WHERE { ?this ss:width ?width . ?this ss:height ?height . FILTER (?width != ?height) . } """ ]
  • 4. Constraints in SPARQL (CONSTRUCT) ss:Square spin:constraint [ rdf:type sp:Construct ; sp:text """ # Width and height must be equal CONSTRUCT { _:cv a spin:ConstraintViolation ; spin:violationRoot ?this ; spin:violationPath ss:height ; rdfs:label "Width and height must be equal" } WHERE { ?this ss:width ?width . ?this ss:height ?height . FILTER (?width != ?height) . } """ ]
  • 5. Possible Syntactic Sugar Idea from Simister, Brickley: http://www.w3.org/2001/sw/wiki/images/0/00/SimpleApplication- SpecificConstraintsforRDFModels.pdf ss:Square spin:constraint [ a spin:Ask ; spin:context ss:height ; spin:message "Width and height must be equal" ; spin:sparql """ ASK WHERE { ?this ss:width ?width . ?this ss:height ?height . FILTER (?width != ?height) . } """ ] (The current SPIN is just a starting point, it’s an open RDF vocabulary)
  • 6. Alternative to source code editing Syntax checking Auto-complete Keyword highlighting Results preview …
  • 7. Positive values constraint in SPARQL ss:Rectangle spin:constraint [ a sp:Construct ; sp:text """ # The value of ss:width must be > 0 CONSTRUCT { _:cv a spin:ConstraintViolation ; spin:violationRoot ?this ; spin:violationPath ss:width ; rdfs:label "The width of a rectangle must be > 0" } WHERE { ?this ss:width ?width . FILTER (?width <= 0) . } """ ] … the same would have to be repeated for ss:height
  • 8. Generalizing the constraint ss:Rectangle spin:constraint [ a sp:Construct ; sp:text """ # The value of ss:width must be > 0 CONSTRUCT { _:cv a spin:ConstraintViolation ; spin:violationRoot ?this ; spin:violationPath ss:width ; rdfs:label "The width of a rectangle must be > 0" } WHERE { ?this ss:width ?width . FILTER (?width <= 0) . } """ ] ss:width could be replaced with any property, e.g. ss:height
  • 9. Introducing a SPIN Template ss:PositivePropertyValueConstraint a spin:ConstructTemplate ; spin:constraint [ a spl:Argument spl:predicate arg:property ; spl:valueType rdf:Property ; rdfs:comment "The property to constrain (e.g. ss:width)" ] ; spin:body [ a sp:Construct ; sp:text """ CONSTRUCT { _:cv a spin:ConstraintViolation ; spin:violationRoot ?this ; spin:violationPath ?property ; rdfs:label "Positive value expected" } WHERE { ?this ?property ?value . FILTER (?value <= 0) . } """ ] ;
  • 10. Using a SPIN Template ss:Rectangle spin:constraint [ a ss:PositivePropertyValueConstraint ; arg:property ss:height ; ] ; spin:constraint [ a ss:PositivePropertyValueConstraint ; arg:property ss:width ; ] . Such templates can be published in libraries, for example for Shapes.
  • 14. SPIN Templates • Can define new modeling languages • Template definitions are linked data (URI etc) • Encapsulate/hide SPARQL queries • Yet executable on standard RDF databases • But processors do not have to use SPARQL only • Combine maximum flexibility & expressivity with a structural user-friendly syntax.
  • 16. SPIN Libraries • SPIN templates, functions and constraints can be published on the semantic web – Example: http://semwebquality.org • Libraries define “Profiles” • Web provides a natural evolution mechanism • This WG would define a standard library
  • 18. OSLC Bug Example oslc_cm:ChangeRequest a rdfs:Class ; rdfs:label "Change request" ; oslc:property [ ChangeRequest title : string [1..1] status : status-values [0..1] a oslc:Property ; oslc:propertyDefinition dcterms:title ; oslc:occurs oslc:Exactly-one ] ; oslc:property [ a oslc:Property ; oslc:propertyDefinition oslc_cm:status ; oslc:allowedValues oslc_cm:status-values ; oslc:occurs oslc:Zero-or-one ] . This is a valid SPIN document