SlideShare a Scribd company logo
RDF + SPARQL
querying the web
of (lex)data
Diego Valerio Camarda
regesta.exe
www.regesta.com
diego.camarda@regesta.com
dvcama @ github&twitter
DiegoValerioCamarda @ slideshare
a (really) short
introduction to
linked open data
what about IRIs and RDF
a new way to publish data on the web
ids are ambiguous and suck!
Use URIs
as names for things
Use HTTP URIs
so that people can look up those names
Use the standards (RDF, SPARQL)
providing useful information
Include links to other URIs
so that they can discover more things
linked data principles
Tim Berners-Lee
July 27, 2006
The Children and Families Act 2014
http://www.legislation.gov.uk/id/uksi/2014/2270
what about IRIs and RDF
turning documents into data
ids are ambiguous and suck!
A new way to design
databases
RDF
(aka ’define knowledge’)
Go Triples, go!
the standard (old) approach
ID_P COGNOME NOME REF_ID_SOCIETA GENERE
1 Camarda Diego 1 maschio
2 … … … …
ID_SOCIETA DENOMINAZIONE SITO
1 Regesta.exe srl www.regesta.com
Go Triples, go!
the new (cool) approach
<http://www.regesta.com/diego>Subject
Go Triples, go!
the new (cool) approach
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName>
Subject
Predicate
Go Triples, go!
the new (cool) approach
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName>
‘Camarda’.
Subject
Predicate
Object
Go Triples, go!
the new (cool) approach
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’.
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’.
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/gender> ‘male’.
Go Triples, go!
the new (cool) approach
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ .
Go Triples, go!
ok, but what a “diego” is?
Go Triples, go!
it’s a person!
<http://www.regesta.com/diego> a <http://xmlns.com/foaf/0.1/Person>
Go Triples, go!
adding a Class
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ .
<http://www.regesta.com/diego>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://xmlns.com/foaf/0.1/Person> .
Go Triples, go!
building a graph
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ ;
<http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> .
<http://www.regesta.com/diego>
<http://www.w3.org/ns/org#memberOf>
<http://www.regesta.com/about> .
Go Triples, go!
building a graph
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ ;
<http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ;
<http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> .
<http://www.regesta.com/about>
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
<http://www.w3.org/ns/org#Organization> .
Go Triples, go!
building a graph
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ ;
<http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ;
<http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> .
<http://www.regesta.com/about>
<http://www.w3.org/1999/...#type> <http://www.w3.org/ns/org#Organization> .
Go Triples, go!
building a graph
<http://www.regesta.com/diego>
<http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ;
<http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ;
<http://xmlns.com/foaf/0.1/gender> ‘male’ ;
<http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ;
<http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> .
<http://www.regesta.com/about>
<http://www.w3.org/1999/...#type> <http://www.w3.org/ns/org#Organization> ;
<http://www.w3.org/2004/02/skos/core#prefLabel> ‘Regesta.exe srl’ ;
<http://xmlns.com/foaf/0.1/homepage> <http://www.regesta.com> .
Go Triples, go!
Objects could be Subjects
diego
Go Triples, go!
considering diego and regesta
diego
regesta
Go Triples, go!
<diego> <memberOf> <regesta>
diego
regesta
Go Triples, go!
but, <regesta> <locatedIn> <rome>
diego
regesta
rome
Go Triples, go!
<diego> <placeOfBirth> <rome>
diego
regesta
rome
Go Triples, go!
<rome> <parentADM> <italy>
diego
regesta
rome
italy
Go Triples, go!
<silvia> <placeOfBirth> <italy>
diego
regesta
silvia
rome
italy
Go Triples, go!
<silvia> <…> <…>
diego
regesta
silvia
rome
italy
Go Triples, go!
<…> <…> <…> = a knowledge graph!
diego
regesta
silvia
rome
italy
A lot of sentence
to achieve (descriptive) freedom
<http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ .
<http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ .
<http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/gender> ‘male’ .
<http://www.regesta.com/diego> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://www.regesta.com/diego> <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com> .
<http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/familyName> ‘Mazzini’ .
<http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/firstName> ‘Silvia’ .
<http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/gender> ‘female’ .
<http://www.regesta.com/silvia> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
<http://www.regesta.com/silvia> <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com> .
<http://www.regesta.com> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/org#Organization> .
<http://www.regesta.com> <http://www.w3.org/2004/02/skos/core#prefLabel> ‘Regesta.exe srl’ .
<http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/knows> <http://www.regesta.com/diego> .
<…> <…> <…>.
<noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>.<noBeer> <makeGoCreazy> <homer>. <noTv>
<makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer>
<makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy>
<homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>.
<noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer>
<makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy>
<homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>.
<noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer>
<makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy>
<homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>.
<noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> …
Standards for
semantic web
RDF
http://www.w3.org/standards/techs/rdf
SPARQL
http://www.w3.org/standards/techs/sparql
ONTOLOGIES
http://www.w3.org/standards/semanticweb/ontology
Did you studied HTML? Good!
it's time for a new standard
The Resource Description Framework
is a general-purpose language for representing
information in the Web.
It's time for a new standard
RDF
The SPARQL Protocol and RDF Query Language
is a query language and protocol for RDF.
It's time for a new standard
SPARQL
On the Semantic Web, vocabularies define
the concepts and relationships
(also referred to as “terms”)
used to describe and represent
an area of concern.
It's time for a new standard
Ontologies
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
foaf:firstName
dc:title
rdfs:label
Pre:fixes (ontologies)
just a few words
Browsing the
web of data
Resource Description
Framework
› SPARQL endpoint
› dereferenceable URIs
› content negotiation
› standard ports, like 80 (HTTP)
› JSONP support
MUST!
Resource Description
Framework
› SPARQL endpoint
› dereferenceable URIs
› content negotiation
› standards port, like 80 (HTTP)
› JSONP support
› up-to-date
› the endpoint URL is easy to deduce from resources
› the resources are described by dc:title or rdfs:label
› the endpoint hosts a page for humans
› the resources and the endpoint are on the same domain
SHOULD!
(please do it, for me)
SELECT * {?minnesota ?banana ?sun}
SPARQL
a must know query language
SPARQL
group graph pattern
diego
regesta
silvia
rome
italy
diego
regesta
silvia
rome
italy
SPARQL
group graph pattern
diego
regesta
rome
silvia
italy
silvia
italy
SELECT ?person {
?person <placeOfBirth> ?place.
?person <memberOf> ?company .
?company <locatedIn> ?place .
}
SPARQL
group graph pattern
<diego>
SELECT ?person ?prop ?obj {
?person <placeOfBirth> ?place.
?person <memberOf> ?company.
?person ?prop ?obj .
?company <locatedIn> ?place .
}
SPARQL
group graph pattern
(turn the page)
person prop obj
<diego> rdf:type foaf:Person
<diego> foaf:firstName ‘Diego’
<diego> foaf:familyName ‘Camarda’
<diego> foaf:gender ‘male’
<diego> org:memberOf <regesta>
SPARQL
group graph pattern
DESCRIBE <diego>
SPARQL
describe
(turn the page)
<diego> rdf:type foaf:Person .
<diego> foaf:firstName ‘Diego’ .
<diego> foaf:familyName ‘Camarda’ .
<diego> foaf:gender ‘male’ .
<diego> org:memberOf <regesta> .
<silvia> foaf:knows <diego> .
SPARQL
describe
DISTINCT, COUNT
GRAPH, PREFIX
isBlank, isIRI, isLiteral, isNumeric
FILTER, REGEX, STR
FILTER NOT EXISTS, MINUS
ORDER BY, OFFSET, LIMIT
for other stuff
http://www.w3.org/TR/sparql11-query/
SPARQL
minimum requirements
Please start negotiating content
right now!
Hi dude, I accept:
text/html,application/xhtml+xml
Html
pageGreat! I’ll serve you a web page
Hi dude, I accept:
application/rdf+xml
RDF
dataGreat… 302, redirect!
Hi dude, I accept:
pizza/margherita
406
errormmm… sorry
Please start negotiating content
right now!
application/rdf+xml
application/xml
text/plain
text/turtle
application/x-turtle
application/trix
application/x-trig
text/n3
text/rdf+n3
application/trix
application/x-trig
application/x-binary-rdf
text/x-nquads
application/ld+json
application/rdf+json
application/xhtml+xml
text/xml
application/json
application/rdf+xml
application/rdf+n3
application/sparql-results+xml
application/sparql-results+json
curl -L -H "Accept: application/rdf+xml"
http://dati.camera.it/ocd/governo.rdf/g102
curl -L -H "Accept: text/n3"
http://dati.camera.it/ocd/governo.rdf/g102
Please start negotiating content
using CURL…
Java : Sesame / Jena
Python : RDFLib
Ruby : RDF.rb
nodeJs : sparql-client
or, as I do,
simple HTTP GET +
parsing results as json or xml
Please start negotiating content
…or a framework!
RDF data
storing and deploying
It’s slow
so keep calm
1 record 15 triples
2.949.771 votes 64.948.856 triples
usually
eg. Chamber of deputies
data big data
RDF probably will transform
Virtuoso
Sesame
Fuseki (Jena)
Owlim / Bigdata (Sesame)
AllegroGraph
D2R server
ARC2
…
Triplestores
I just need a SPARQL endpoint
I just really need http://yourdomain/sparql
Case studies
select distinct ?o where {?s a ?o}
select ?o count(distinct ?s) where {?s a ?o}
select count(?s) where {?s ?p ?o}
select count(?s) ?class where {?s ?p ?o; a ?class}
select distinct ?p where {?s a <http://classe>; ?p ?o}
select ?p count(?p) where {?s a <http://classe>; ?p ?o}
select ?s where {?s a <http://classe>}
?p ?o where {<http://URI> ?p ?o}
select distinct ?s ?title where {?s a <http://classe>;
dc:title ?title. FILTER(REGEX(? title,’parola’,’i’))} LIMIT 100
SPARQL magic
a query for all seasons
Case studies
Chamber of deputies
Senate of Republic
http://dati.camera.it/sparql
http://dati.senato.it/sparql
Useful links
All Bills filtered by year
SELECT DISTINCT * {?bill a ocd:atto; dc:title ?title; dc:date ?date .
FILTER(regex(?date,'^2014'))} ORDER BY ?date
Last voted Bills
SELECT distinct * WHERE {
?bill a ocd:atto; dc:title ?title.
?votazione a ocd:votazione; ocd:rif_attoCamera ?bill; dc:date ?data; dc:title ?denominazione;
dc:description ?descrizione; ocd:votanti ?votanti; ocd:votazioneFinale 1; ocd:favorevoli
?favorevoli; ocd:contrari ?contrari; ocd:astenuti ?astenuti;
ocd:rif_leg <http://dati.camera.it/ocd/legislatura.rdf/repubblica_17>}
ORDER BY DESC(?data)
Example queries
Chamber of deputies
All Bills filtered by year
PREFIX osr: <http://dati.senato.it/osr/>
SELECT DISTINCT * {?bill a osr:Ddl; osr:titolo ?title; osr:dataPresentazione ?date .
FILTER(regex(STR(?date),'^2014'))} ORDER BY ASC(?date)
Last approved Bills
PREFIX osr: <http://dati.senato.it/osr/>
SELECT DISTINCT ?ddl ?titolo ?titoloBreve ?natura ?stato ?dataApprovato
WHERE { ?ddl a osr:Ddl. ?ddl osr:statoDdl ?stato.
?ddl osr:ramo "S"^^<http://www.w3.org/2001/XMLSchema#string>.
?ddl osr:dataPresentazione ?dataPresentazione. ?ddl osr:titolo ?titolo.
OPTIONAL { ?ddl osr:titoloBreve ?titoloBreve }. ?ddl osr:natura ?natura.
?ddl osr:dataStatoDdl ?dataApprovato. ?ddl osr:testoApprovato ?testoApprovato
FILTER(xsd:date(str(?dataApprovato)) <= xsd:date(str("2014-12-31")))
FILTER(xsd:date(str(?dataApprovato)) >= xsd:date(str("2014-01-01")))
} ORDER BY ?dataApprovato
Example queries
Senate of Republic
Case studies
UK Legislation
http://gov.tso.co.uk/legislation/sparql
http://openuplabs.tso.co.uk/sparql/gov-legislation
http://www.opsi.gov.uk/legislation-api/developer/formats/rdf
Useful links
All ‘Works’ filtered by year
SELECT ?work ?date ?title {?work a frbr:Work . ?work dct:title ?title . ?work dct:created ?date .
FILTER (REGEX(STR(?date),'^2014')) } ORDER BY desc(?date)
Top subjects by year
SELECT (count(?sub) as ?tot) ?sub { ?work a frbr:Work . ?work dct:subject ?sub . ?work
dct:created ?date . FILTER (REGEX(STR(?date),'^2014')) } GROUP BY ?sub ORDER BY desc(?tot)
LIMIT 100
Example queries
Even more
Useful links
W3C standards
http://www.w3.org/standards/semanticweb/
OKFN endpoints status (and list)
http://sparqles.okfn.org
LodLive (a SPRQL navigator)
http://en.lodlive.it
a very good intro to RDF
https://github.com/JoshData/rdfabout/blob/gh-pages/intro-to-rdf.md
Tim Berners-Lee’s “Linked Data – 5 stars ranking”
http://www.w3.org/DesignIssues/LinkedData.html
My github page
http://github.com/dvcama
My email
mailto:diego.camarda@regesta.com

More Related Content

PDF
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
Diego Valerio Camarda
 
PDF
18 ° Nexa Lunch Seminar - Lo stato dell'arte dei Linked Open Data italiani
Diego Valerio Camarda
 
PDF
Keynote session - LOD2014 W3C event
Diego Valerio Camarda
 
PDF
Bigdive 2014 - RDF, principles and case studies
Diego Valerio Camarda
 
PDF
(Enterprise) Linked Data Platform a new standard to manage LOD
Diego Valerio Camarda
 
PDF
30° Nexa Lunch Seminar - Linked Data Platform vs real world
Diego Valerio Camarda
 
PDF
DHWI Linked Open Data - Show and Tell
Georgina Goodlander
 
PPT
Radically Open Cultural Heritage Data on the Web
Julie Allinson
 
#sod14 - ok, è un endpoint SPARQL non facciamoci prendere dal panico
Diego Valerio Camarda
 
18 ° Nexa Lunch Seminar - Lo stato dell'arte dei Linked Open Data italiani
Diego Valerio Camarda
 
Keynote session - LOD2014 W3C event
Diego Valerio Camarda
 
Bigdive 2014 - RDF, principles and case studies
Diego Valerio Camarda
 
(Enterprise) Linked Data Platform a new standard to manage LOD
Diego Valerio Camarda
 
30° Nexa Lunch Seminar - Linked Data Platform vs real world
Diego Valerio Camarda
 
DHWI Linked Open Data - Show and Tell
Georgina Goodlander
 
Radically Open Cultural Heritage Data on the Web
Julie Allinson
 

What's hot (20)

PPTX
RDF data model
Jose Emilio Labra Gayo
 
PPTX
A Little SPARQL in your Analytics
Dr. Neil Brittliff
 
ODP
Web of data
Yves Raimond
 
PDF
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
Josef PetrĂĄk
 
PPT
Introduction To RDF and RDFS
Nilesh Wagmare
 
PDF
Linked Data - Radical Change?
Richard Wallis
 
PPT
Getting Started With The Talis Platform
Leigh Dodds
 
PPTX
Epiphany: Adaptable RDFa Generation Linking the Web of Documents to the Web o...
Benjamin Adrian
 
PDF
Linked Data - Exposing what we have
Richard Wallis
 
KEY
Creating web applications with LODSPeaKr
Alvaro Graves
 
PPT
Data in RDF
Emanuele Della Valle
 
PDF
Linked Data, Ontologies and Inference
Barry Norton
 
PDF
The Lonesome LOD Cloud
Ruben Verborgh
 
PPTX
RDF, linked data and semantic web
Jose Emilio Labra Gayo
 
PPTX
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Victor de Boer
 
PPT
SPARQL Query Forms
Leigh Dodds
 
ZIP
Open Source: Liberating your systems
Richard Wallis
 
PDF
RDFa: introduction, comparison with microdata and microformats and how to use it
Jose Luis Lopez Pino
 
PPT
Semantic Web - Linked Data - RDF
Visual Resources Association
 
PPT
Introduction to RDF
Narni Rajesh
 
RDF data model
Jose Emilio Labra Gayo
 
A Little SPARQL in your Analytics
Dr. Neil Brittliff
 
Web of data
Yves Raimond
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
Josef PetrĂĄk
 
Introduction To RDF and RDFS
Nilesh Wagmare
 
Linked Data - Radical Change?
Richard Wallis
 
Getting Started With The Talis Platform
Leigh Dodds
 
Epiphany: Adaptable RDFa Generation Linking the Web of Documents to the Web o...
Benjamin Adrian
 
Linked Data - Exposing what we have
Richard Wallis
 
Creating web applications with LODSPeaKr
Alvaro Graves
 
Data in RDF
Emanuele Della Valle
 
Linked Data, Ontologies and Inference
Barry Norton
 
The Lonesome LOD Cloud
Ruben Verborgh
 
RDF, linked data and semantic web
Jose Emilio Labra Gayo
 
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Victor de Boer
 
SPARQL Query Forms
Leigh Dodds
 
Open Source: Liberating your systems
Richard Wallis
 
RDFa: introduction, comparison with microdata and microformats and how to use it
Jose Luis Lopez Pino
 
Semantic Web - Linked Data - RDF
Visual Resources Association
 
Introduction to RDF
Narni Rajesh
 
Ad

Similar to SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data (20)

KEY
How RDFa works
JISC Netskills
 
KEY
RDFa Introductory Course Session 2/4 How RDFa
Platypus
 
PPTX
Hacia la Internet del Futuro: Web SemĂĄntica y Open Linked Data, Parte 2
Diego LĂłpez-de-IpiĂąa GonzĂĄlez-de-Artaza
 
PPTX
Hack U Barcelona 2011
Peter Mika
 
PDF
Danbri Drupalcon Export
Drupalcon Paris
 
PPT
SemanticWeb Nuts 'n Bolts
Rinke Hoekstra
 
PPTX
Linked data HHS 2015
Cason Snow
 
ODP
Quick Introduction to the Semantic Web, RDFa & Microformats
University of California, San Diego
 
ODP
State of the Semantic Web
Ivan Herman
 
ZIP
SemWeb Fundamentals - Info Linking & Layering in Practice
Dan Brickley
 
PPT
Semantic Web
hardchiu
 
PPT
Publishing data on the Semantic Web
Peter Mika
 
PPT
20080917 Rev
charper
 
ODP
Building a semantic website
CJ Jenkins
 
KEY
Linking Open, Big Data Using Semantic Web Technologies - An Introduction
Ronald Ashri
 
PDF
Deploying PHP applications using Virtuoso as Application Server
webhostingguy
 
PPTX
Geography in Linked Ancient World Data
paregorios
 
PPTX
Linked data for librarians
trevorthornton
 
PDF
when the link makes sense
Fabien Gandon
 
PPTX
CSHALS 2010 W3C Semanic Web Tutorial
LeeFeigenbaum
 
How RDFa works
JISC Netskills
 
RDFa Introductory Course Session 2/4 How RDFa
Platypus
 
Hacia la Internet del Futuro: Web SemĂĄntica y Open Linked Data, Parte 2
Diego LĂłpez-de-IpiĂąa GonzĂĄlez-de-Artaza
 
Hack U Barcelona 2011
Peter Mika
 
Danbri Drupalcon Export
Drupalcon Paris
 
SemanticWeb Nuts 'n Bolts
Rinke Hoekstra
 
Linked data HHS 2015
Cason Snow
 
Quick Introduction to the Semantic Web, RDFa & Microformats
University of California, San Diego
 
State of the Semantic Web
Ivan Herman
 
SemWeb Fundamentals - Info Linking & Layering in Practice
Dan Brickley
 
Semantic Web
hardchiu
 
Publishing data on the Semantic Web
Peter Mika
 
20080917 Rev
charper
 
Building a semantic website
CJ Jenkins
 
Linking Open, Big Data Using Semantic Web Technologies - An Introduction
Ronald Ashri
 
Deploying PHP applications using Virtuoso as Application Server
webhostingguy
 
Geography in Linked Ancient World Data
paregorios
 
Linked data for librarians
trevorthornton
 
when the link makes sense
Fabien Gandon
 
CSHALS 2010 W3C Semanic Web Tutorial
LeeFeigenbaum
 
Ad

Recently uploaded (20)

PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Doc9.....................................
SofiaCollazos
 
PDF
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
PDF
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Software Development Methodologies in 2025
KodekX
 
PPTX
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Doc9.....................................
SofiaCollazos
 
How Open Source Changed My Career by abdelrahman ismail
a0m0rajab1
 
Security features in Dell, HP, and Lenovo PC systems: A research-based compar...
Principled Technologies
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Software Development Methodologies in 2025
KodekX
 
Agile Chennai 18-19 July 2025 Ideathon | AI Powered Microfinance Literacy Gui...
AgileNetwork
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Unlocking the Future- AI Agents Meet Oracle Database 23ai - AIOUG Yatra 2025.pdf
Sandesh Rao
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 

SUMMER SCHOOL LEX 2014 - RDF + SPARQL querying the web of (lex)data

  • 1. RDF + SPARQL querying the web of (lex)data Diego Valerio Camarda regesta.exe www.regesta.com [email protected] dvcama @ github&twitter DiegoValerioCamarda @ slideshare
  • 2. a (really) short introduction to linked open data
  • 3. what about IRIs and RDF a new way to publish data on the web ids are ambiguous and suck! Use URIs as names for things Use HTTP URIs so that people can look up those names Use the standards (RDF, SPARQL) providing useful information Include links to other URIs so that they can discover more things linked data principles Tim Berners-Lee July 27, 2006
  • 4. The Children and Families Act 2014 http://www.legislation.gov.uk/id/uksi/2014/2270 what about IRIs and RDF turning documents into data ids are ambiguous and suck!
  • 5. A new way to design databases RDF (aka ’define knowledge’)
  • 6. Go Triples, go! the standard (old) approach ID_P COGNOME NOME REF_ID_SOCIETA GENERE 1 Camarda Diego 1 maschio 2 … … … … ID_SOCIETA DENOMINAZIONE SITO 1 Regesta.exe srl www.regesta.com
  • 7. Go Triples, go! the new (cool) approach <http://www.regesta.com/diego>Subject
  • 8. Go Triples, go! the new (cool) approach <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> Subject Predicate
  • 9. Go Triples, go! the new (cool) approach <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’. Subject Predicate Object
  • 10. Go Triples, go! the new (cool) approach <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’. <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/firstName> ‘Diego’. <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/gender> ‘male’.
  • 11. Go Triples, go! the new (cool) approach <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ .
  • 12. Go Triples, go! ok, but what a “diego” is?
  • 13. Go Triples, go! it’s a person! <http://www.regesta.com/diego> a <http://xmlns.com/foaf/0.1/Person>
  • 14. Go Triples, go! adding a Class <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ . <http://www.regesta.com/diego> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> .
  • 15. Go Triples, go! building a graph <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ ; <http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> . <http://www.regesta.com/diego> <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> .
  • 16. Go Triples, go! building a graph <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ ; <http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ; <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> . <http://www.regesta.com/about> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/org#Organization> .
  • 17. Go Triples, go! building a graph <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ ; <http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ; <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> . <http://www.regesta.com/about> <http://www.w3.org/1999/...#type> <http://www.w3.org/ns/org#Organization> .
  • 18. Go Triples, go! building a graph <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ ; <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ ; <http://xmlns.com/foaf/0.1/gender> ‘male’ ; <http://www.w3.org/1999/...#type> <http://xmlns.com/foaf/0.1/Person> ; <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com/about> . <http://www.regesta.com/about> <http://www.w3.org/1999/...#type> <http://www.w3.org/ns/org#Organization> ; <http://www.w3.org/2004/02/skos/core#prefLabel> ‘Regesta.exe srl’ ; <http://xmlns.com/foaf/0.1/homepage> <http://www.regesta.com> .
  • 19. Go Triples, go! Objects could be Subjects diego
  • 20. Go Triples, go! considering diego and regesta diego regesta
  • 21. Go Triples, go! <diego> <memberOf> <regesta> diego regesta
  • 22. Go Triples, go! but, <regesta> <locatedIn> <rome> diego regesta rome
  • 23. Go Triples, go! <diego> <placeOfBirth> <rome> diego regesta rome
  • 24. Go Triples, go! <rome> <parentADM> <italy> diego regesta rome italy
  • 25. Go Triples, go! <silvia> <placeOfBirth> <italy> diego regesta silvia rome italy
  • 26. Go Triples, go! <silvia> <…> <…> diego regesta silvia rome italy
  • 27. Go Triples, go! <…> <…> <…> = a knowledge graph! diego regesta silvia rome italy
  • 28. A lot of sentence to achieve (descriptive) freedom <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/familyName> ‘Camarda’ . <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/firstName> ‘Diego’ . <http://www.regesta.com/diego> <http://xmlns.com/foaf/0.1/gender> ‘male’ . <http://www.regesta.com/diego> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . <http://www.regesta.com/diego> <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com> . <http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/familyName> ‘Mazzini’ . <http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/firstName> ‘Silvia’ . <http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/gender> ‘female’ . <http://www.regesta.com/silvia> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person> . <http://www.regesta.com/silvia> <http://www.w3.org/ns/org#memberOf> <http://www.regesta.com> . <http://www.regesta.com> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/org#Organization> . <http://www.regesta.com> <http://www.w3.org/2004/02/skos/core#prefLabel> ‘Regesta.exe srl’ . <http://www.regesta.com/silvia> <http://xmlns.com/foaf/0.1/knows> <http://www.regesta.com/diego> . <…> <…> <…>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>.<noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> <makeGoCreazy> <homer>. <noTv> <makeGoCreazy> <homer>. <noBeer> …
  • 31. The Resource Description Framework is a general-purpose language for representing information in the Web. It's time for a new standard RDF
  • 32. The SPARQL Protocol and RDF Query Language is a query language and protocol for RDF. It's time for a new standard SPARQL
  • 33. On the Semantic Web, vocabularies define the concepts and relationships (also referred to as “terms”) used to describe and represent an area of concern. It's time for a new standard Ontologies
  • 34. PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> foaf:firstName dc:title rdfs:label Pre:fixes (ontologies) just a few words
  • 36. Resource Description Framework › SPARQL endpoint › dereferenceable URIs › content negotiation › standard ports, like 80 (HTTP) › JSONP support MUST!
  • 37. Resource Description Framework › SPARQL endpoint › dereferenceable URIs › content negotiation › standards port, like 80 (HTTP) › JSONP support › up-to-date › the endpoint URL is easy to deduce from resources › the resources are described by dc:title or rdfs:label › the endpoint hosts a page for humans › the resources and the endpoint are on the same domain SHOULD! (please do it, for me)
  • 38. SELECT * {?minnesota ?banana ?sun} SPARQL a must know query language
  • 41. SELECT ?person { ?person <placeOfBirth> ?place. ?person <memberOf> ?company . ?company <locatedIn> ?place . } SPARQL group graph pattern <diego>
  • 42. SELECT ?person ?prop ?obj { ?person <placeOfBirth> ?place. ?person <memberOf> ?company. ?person ?prop ?obj . ?company <locatedIn> ?place . } SPARQL group graph pattern (turn the page)
  • 43. person prop obj <diego> rdf:type foaf:Person <diego> foaf:firstName ‘Diego’ <diego> foaf:familyName ‘Camarda’ <diego> foaf:gender ‘male’ <diego> org:memberOf <regesta> SPARQL group graph pattern
  • 45. <diego> rdf:type foaf:Person . <diego> foaf:firstName ‘Diego’ . <diego> foaf:familyName ‘Camarda’ . <diego> foaf:gender ‘male’ . <diego> org:memberOf <regesta> . <silvia> foaf:knows <diego> . SPARQL describe
  • 46. DISTINCT, COUNT GRAPH, PREFIX isBlank, isIRI, isLiteral, isNumeric FILTER, REGEX, STR FILTER NOT EXISTS, MINUS ORDER BY, OFFSET, LIMIT for other stuff http://www.w3.org/TR/sparql11-query/ SPARQL minimum requirements
  • 47. Please start negotiating content right now! Hi dude, I accept: text/html,application/xhtml+xml Html pageGreat! I’ll serve you a web page Hi dude, I accept: application/rdf+xml RDF dataGreat… 302, redirect! Hi dude, I accept: pizza/margherita 406 errormmm… sorry
  • 48. Please start negotiating content right now! application/rdf+xml application/xml text/plain text/turtle application/x-turtle application/trix application/x-trig text/n3 text/rdf+n3 application/trix application/x-trig application/x-binary-rdf text/x-nquads application/ld+json application/rdf+json application/xhtml+xml text/xml application/json application/rdf+xml application/rdf+n3 application/sparql-results+xml application/sparql-results+json
  • 49. curl -L -H "Accept: application/rdf+xml" http://dati.camera.it/ocd/governo.rdf/g102 curl -L -H "Accept: text/n3" http://dati.camera.it/ocd/governo.rdf/g102 Please start negotiating content using CURL…
  • 50. Java : Sesame / Jena Python : RDFLib Ruby : RDF.rb nodeJs : sparql-client or, as I do, simple HTTP GET + parsing results as json or xml Please start negotiating content …or a framework!
  • 51. RDF data storing and deploying
  • 52. It’s slow so keep calm 1 record 15 triples 2.949.771 votes 64.948.856 triples usually eg. Chamber of deputies data big data RDF probably will transform
  • 53. Virtuoso Sesame Fuseki (Jena) Owlim / Bigdata (Sesame) AllegroGraph D2R server ARC2 … Triplestores I just need a SPARQL endpoint I just really need http://yourdomain/sparql
  • 55. select distinct ?o where {?s a ?o} select ?o count(distinct ?s) where {?s a ?o} select count(?s) where {?s ?p ?o} select count(?s) ?class where {?s ?p ?o; a ?class} select distinct ?p where {?s a <http://classe>; ?p ?o} select ?p count(?p) where {?s a <http://classe>; ?p ?o} select ?s where {?s a <http://classe>} ?p ?o where {<http://URI> ?p ?o} select distinct ?s ?title where {?s a <http://classe>; dc:title ?title. FILTER(REGEX(? title,’parola’,’i’))} LIMIT 100 SPARQL magic a query for all seasons
  • 56. Case studies Chamber of deputies Senate of Republic
  • 58. All Bills filtered by year SELECT DISTINCT * {?bill a ocd:atto; dc:title ?title; dc:date ?date . FILTER(regex(?date,'^2014'))} ORDER BY ?date Last voted Bills SELECT distinct * WHERE { ?bill a ocd:atto; dc:title ?title. ?votazione a ocd:votazione; ocd:rif_attoCamera ?bill; dc:date ?data; dc:title ?denominazione; dc:description ?descrizione; ocd:votanti ?votanti; ocd:votazioneFinale 1; ocd:favorevoli ?favorevoli; ocd:contrari ?contrari; ocd:astenuti ?astenuti; ocd:rif_leg <http://dati.camera.it/ocd/legislatura.rdf/repubblica_17>} ORDER BY DESC(?data) Example queries Chamber of deputies
  • 59. All Bills filtered by year PREFIX osr: <http://dati.senato.it/osr/> SELECT DISTINCT * {?bill a osr:Ddl; osr:titolo ?title; osr:dataPresentazione ?date . FILTER(regex(STR(?date),'^2014'))} ORDER BY ASC(?date) Last approved Bills PREFIX osr: <http://dati.senato.it/osr/> SELECT DISTINCT ?ddl ?titolo ?titoloBreve ?natura ?stato ?dataApprovato WHERE { ?ddl a osr:Ddl. ?ddl osr:statoDdl ?stato. ?ddl osr:ramo "S"^^<http://www.w3.org/2001/XMLSchema#string>. ?ddl osr:dataPresentazione ?dataPresentazione. ?ddl osr:titolo ?titolo. OPTIONAL { ?ddl osr:titoloBreve ?titoloBreve }. ?ddl osr:natura ?natura. ?ddl osr:dataStatoDdl ?dataApprovato. ?ddl osr:testoApprovato ?testoApprovato FILTER(xsd:date(str(?dataApprovato)) <= xsd:date(str("2014-12-31"))) FILTER(xsd:date(str(?dataApprovato)) >= xsd:date(str("2014-01-01"))) } ORDER BY ?dataApprovato Example queries Senate of Republic
  • 62. All ‘Works’ filtered by year SELECT ?work ?date ?title {?work a frbr:Work . ?work dct:title ?title . ?work dct:created ?date . FILTER (REGEX(STR(?date),'^2014')) } ORDER BY desc(?date) Top subjects by year SELECT (count(?sub) as ?tot) ?sub { ?work a frbr:Work . ?work dct:subject ?sub . ?work dct:created ?date . FILTER (REGEX(STR(?date),'^2014')) } GROUP BY ?sub ORDER BY desc(?tot) LIMIT 100 Example queries
  • 64. W3C standards http://www.w3.org/standards/semanticweb/ OKFN endpoints status (and list) http://sparqles.okfn.org LodLive (a SPRQL navigator) http://en.lodlive.it a very good intro to RDF https://github.com/JoshData/rdfabout/blob/gh-pages/intro-to-rdf.md Tim Berners-Lee’s “Linked Data – 5 stars ranking” http://www.w3.org/DesignIssues/LinkedData.html My github page http://github.com/dvcama My email mailto:[email protected]