SlideShare a Scribd company logo
Yet another SPARQL 1.1
brief introduction
Victor Saquicela Galarza, Almudena Gonzalez, and Boris Villazón-Terrazas
bvillazon@expertsystem.com
@boricles
Slides available at: http://www.slideshare.net/boricles/
SPARQL 1.1
• W3C Recommendation 21 March 2013
• New features in Query language:
- Aggregate functions: COUNT, SUM, MIN, MAX, AVG,
GROUP_CONCAT, and SAMPLE.
- Subqueries: Nest the results of a query within another query
- Negation: Check the absence of triples in a graph
- Expressions in SELECT: Introduce new variables in the SELECT clause
- Property paths: Search graphs through structures that involve
arbitrary-length paths
- Assignment: BIND keyword and expressions in SELECT and
GROUP_BY
- Short form for CONSTRUCT
- Expanded functions and operators: EXISTS, NOT EXISTS, SUBSTR,
etc.2
Other SPARQL 1.1 specifications
• Update
Language extension to express updates to an RDF graph/store
• Protocol
Changes related to the update operation
• Service description
Discover a SPARQL endpoint's capabilities and summary information of its data
• Graph Store HTTP Protocol
Update and fetch RDF graph content from a Graph Store over HTTP in the REST style
• Entailment Regimes
Define the semantics of SPARQL queries for some entailment frameworks: OWL
flavors, RDFS, RIF
• Federation Extensions
Take a query and provide solutions based on information from many different
sources
• Query Result JSON, CSV, TSV
3
ToC
• Update
• Federated queries
• Basic property paths
4
Some preliminary useful queries
SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } }
Query to get the current graphs of my triplestore:
5
SELECT *
FROM <http://mygraph/>
WHERE {
?s ?p ?o
}
Query to get everything from a particular graph
A simple SPARQL INSERT query
#graph http://linkeddata.ec/graph/tutorial/example1
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WITH <http://linkeddata.ec/graph/tutorial/example1>
INSERT { lde:myname foaf:name "boráclito" }
Data before:
Query:
6
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/myname> foaf:name "boráclito" .
Data after:
A simple SPARQL DELETE query
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/myname> foaf:name "boráclito" .
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WITH <http://linkeddata.ec/graph/tutorial/example1>
DELETE { lde:myname foaf:name "boráclito" }
Data before:
Query:
7
#graph http://linkeddata.ec/graph/tutorial/example1
Data after:
Another way to INSERT a triple
#graph http://linkeddata.ec/graph/tutorial/example1
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
INSERT DATA {
GRAPH <http://linkeddata.ec/graph/tutorial/example1>
{<http://linkeddata.ec/resource/myname> foaf:name "boráclito" . }
}
Data before:
Query:
8
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/myname> foaf:name "boráclito" .
Data after:
Another way to DELETE a triple
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/myname> foaf:name "boráclito" .
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DELETE DATA {
GRAPH <http://linkeddata.ec/graph/tutorial/example1>
{<http://linkeddata.ec/resource/myname> foaf:name "boráclito" . }
}
Data before:
Query:
9
#graph http://linkeddata.ec/graph/tutorial/example1
Data after:
Inserting triples
#graph http://linkeddata.ec/graph/tutorial/example1
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
INSERT DATA {
GRAPH <http://linkeddata.ec/graph/tutorial/example1>
{<http://linkeddata.ec/resource/team1> foaf:name "Ecuador" .
<http://linkeddata.ec/resource/team2> foaf:name "Bolivia" .
<http://linkeddata.ec/resource/team3> foaf:name "España" .
}
}
Data before:
Query:
10
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/team1> foaf:name "Ecuador" .
<http://linkeddata.ec/resource/team2> foaf:name "Bolivia" .
<http://linkeddata.ec/resource/team3> foaf:name "España" .
Data after:
DELETE with WHERE clause
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/team1> foaf:name "Ecuador" .
<http://linkeddata.ec/resource/team2> foaf:name "Bolivia" .
<http://linkeddata.ec/resource/team3> foaf:name "España" .
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WITH <http://linkeddata.ec/graph/tutorial/example1>
DELETE
{ ?s foaf:name ?name .
}
WHERE {
?s foaf:name ?name .
FILTER(REGEX(?name,"E"))
}
Data before:
Query:
11
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/team2> foaf:name "Bolivia" .
Data after:
Renaming a particular object
12
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/team2> foaf:name "Bolivia" .
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
WITH <http://linkeddata.ec/graph/tutorial/example1>
DELETE { ?s foaf:name "Bolivia" }
INSERT { ?s foaf:name "Ecuador" }
WHERE
{
?s foaf:name "Bolivia"
}
Data before:
Query:
#graph http://linkeddata.ec/graph/tutorial/example1
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<http://linkeddata.ec/resource/team2> foaf:name "Ecuador" .
Data after:
Inserting triples
#graph http://linkeddata.ec/graph/tutorial/people
PREFIX lde: <http://linkeddata.ec/resource/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
INSERT DATA {
GRAPH <http://linkeddata.ec/graph/tutorial/people>
{ lde:victor a foaf:Person .
lde:victor foaf:name "Victor Saquicela" .
lde:victor foaf:mbox <mailto:victor.saquicela@ucuenca.edu.ec> .
lde:mauri a foaf:Person .
lde:mauri foaf:name "Mauricio Espinoza" .}
}
Data before:
Query:
13
#graph http://linkeddata.ec/graph/tutorial/people
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lde: <http://linkeddata.ec/resource/> .
lde:victor a foaf:Person .
lde:victor foaf:name "Victor Saquicela" .
lde:victor foaf:mbox <mailto:victor.saquicela@ucuenca.edu.ec> .
lde:mauri a foaf:Person .
lde:mauri foaf:name "Mauricio Espinoza" .
Data after:
Copy triples of name and email from one named graph to another
#graph http://linkeddata.ec/graph/tutorial/addresses
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
INSERT
{ GRAPH <http://linkeddata.ec/graph/tutorial/addresses>
{
?person foaf:name ?name .
?person foaf:mbox ?email
} }
WHERE
{ GRAPH <http://linkeddata.ec/graph/tutorial/people>
{
?person foaf:name ?name .
OPTIONAL { ?person foaf:mbox ?email }
} }
Data before:
Query:
14
#graph http://linkeddata.ec/graph/tutorial/addresses
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix lde: <http://linkeddata.ec/resource/> .
lde:victor foaf:name "Victor Saquicela" .
lde:victor foaf:mbox <mailto:victor.saquicela@ucuenca.edu.ec> .
lde:mauri foaf:name "Mauricio Espinoza" .
Data after:
Some operations over graphs
LOAD
<http://terrazas.name/villazon/boris/data/TwitterAccounts.nt>
INTO GRAPH <http://linkeddata.ec/graph/data-test>
Load
15
CLEAR GRAPH <http://linkeddata.ec/graph/data-test>
Clear
ToC
• Update
• Federated queries
• Basic property paths
16
Federated Queries - Motivation
17
DBpedia
LinkedMDB
Query both datasets in an integrated way
What is exactly Federated SPARQL
Query?
18
Image taken from Flick https://www.flickr.com/photos/fadirra/5915787567/
Federated SQL queries within DBMS?
19
• Not so difficult if we are using the same
DBMS vendor
- MySQL to MySQL
- Oracle to Oracle
- PostgreSQL to PostgreSQL
• If we are dealing with different DBMS vendor
- Build wrappers
Federated SPARQL Query Syntax
20
SPARQL_ENDPOINT_URL_A
SELECT *
FROM <http://example.com/graph/mygraph>
WHERE {
?s ?q ?w .
SERVICE <SPARQL_ENDPOINT_URL_B> {
SELECT *
FROM <http://localhost:8890/isoco> {
?t ?q ?o .
}
}
}
SPARQL_ENDPOINT_URL_A
SERVICE <….> { SELECT * FROM …. WHERE { ….} }
SPARQL_ENDPOINT_URL_B
Results
Federated Queries examples
21
SPARQL endpoint 1
lab-1-1.ttl
SPARQL endpoint 2
lab-1-2.ttl
SPARQL endpoint 3
DBpedia
Federated query example 1
SELECT *
FROM <http://linkeddata.ec/graph/federado>
WHERE {
?s ?q ?w .
SERVICE <http://172.16.147.92:8890/sparql/> {
SELECT * FROM <http://localhost:8890/isoco2> {
?t ?q ?o .
}
}
}
Query:
22
Federated query example 2
SELECT *
FROM <http://linkeddata.ec/graph/federado>
WHERE {
?s ?q ?w .
SERVICE <http://192.168.1.100:8890/sparql/> {
SELECT * FROM <http://localhost:8890/isoco> {
?t ?q ?o .
}
}
}
Query:
23
Federated query example 3
SELECT *
FROM <http://linkeddata.ec/graph/federado>
WHERE {
?s ?q ?w .
SERVICE <http://192.168.1.101:8890/sparql/> {
SELECT * FROM <http://localhost:8890/isoco2> {
?t ?q ?o .
}
}
SERVICE <http://dbpedia.org/sparql/> {
SELECT * FROM <http://dbpedia.org>{
<http://dbpedia.org/resource/Cochabamba> ?h ?k .
}
}
}
Query:
24
Federated query example 4
SELECT *
FROM <http://linkeddata.ec/graph/federado>
WHERE {
<http://lab.isoco.net/resource/agonzalez>
<http://vocab.isoco.net/lab/birthPlace> ?c .
<http://lab.isoco.net/resource/agonzalez> foaf:currentProject ?p
SERVICE <http://172.16.147.144:8890/sparql> {
SELECT * FROM <http://localhost:8890/isoco2> {
<http://lab.isoco.net/resource/agonzalez> foaf:currentProject ?o .
}
}
SERVICE <http://dbpedia.org/sparql/> {
SELECT * FROM <http://dbpedia.org>{
?c ?h ?k .
}
}
}
Query:
25
Federated query example 5
SELECT *
FROM <http://linkeddata.ec/graph/federado>
WHERE {
?s <http://vocab.isoco.net/lab/birthPlace> ?c .
?s foaf:currentProject ?p
SERVICE <http://192.168.1.101:8890/sparql/> {
SELECT * FROM <http://localhost:8890/isoco2> {
?s foaf:currentProject ?o .
}
}
SERVICE <http://dbpedia.org/sparql/> {
SELECT * FROM <http://dbpedia.org>{
?c ?h ?k .
}
}
}
Query:
26
ToC
• Update
• Federated queries
• Basic property paths
27
Example 1
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX vocab: <http://vocab.isoco.net/>
INSERT DATA {
GRAPH <http://data.isoco.net/graph/test-subclassof> {
vocab:Person rdf:type rdfs:Class .
vocab:Professor rdf:type rdfs:Class .
vocab:AssistantProfessor rdf:type rdfs:Class .
vocab:Professor rdfs:subClassOf vocab:Person .
vocab:AssistantProfessor rdfs:subClassOf vocab:Professor .
<http://data.isoco.net/people/Penny> rdf:type vocab:Professor .
<http://data.isoco.net/people/Leonard> rdf:type vocab:AssistantProfessor .
}
}
Query:
28
INSERT
Example 1
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT *
FROM <http://data.isoco.net/graph/test-subclassof>
WHERE {
<http://vocab.isoco.net/AssistantProfessor> rdfs:subClassOf+ ?s }
Query:
29
SUPERCLASSES
s
http://vocab.isoco.net/Professor
http://vocab.isoco.net/Person
Results:
Example 1
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT *
FROM <http://data.isoco.net/graph/test-subclassof>
WHERE {
?a rdf:type ?type .
?type rdfs:subClassOf* <http://vocab.isoco.net/Person> }
Query:
30
INSTANCES
a type
http://data.isoco.net/people/Leonard http://vocab.isoco.net/AssistantProfessor
http://data.isoco.net/people/Penny http://vocab.isoco.net/Professor
Results:
Contacts
Thank you
Boris Villazon-Terrazas
bvillazon@expertsystem.com
www.expertsystem.com

More Related Content

PDF
Ecuadorian Geospatial Linked Data
Boris Villazón-Terrazas
 
PPTX
Querying Linked Data
EUCLID project
 
PDF
Statistical Linked Data
Boris Villazón-Terrazas
 
PPTX
Building Linked Data Applications
EUCLID project
 
PPTX
MOAR RDA For Systems Folks
Alison Hitchens
 
PDF
Data Management Systems for Government Agencies - with CKAN
Steven De Costa
 
PPTX
Scaling up Linked Data
EUCLID project
 
PPTX
Providing Linked Data
EUCLID project
 
Ecuadorian Geospatial Linked Data
Boris Villazón-Terrazas
 
Querying Linked Data
EUCLID project
 
Statistical Linked Data
Boris Villazón-Terrazas
 
Building Linked Data Applications
EUCLID project
 
MOAR RDA For Systems Folks
Alison Hitchens
 
Data Management Systems for Government Agencies - with CKAN
Steven De Costa
 
Scaling up Linked Data
EUCLID project
 
Providing Linked Data
EUCLID project
 

What's hot (18)

PPTX
Interaction with Linked Data
EUCLID project
 
PPTX
Data.dcs: Converting Legacy Data into Linked Data
Matthew Rowe
 
PDF
Drupal, CKAN and Public Data. DrupalGov 08 february 2016
Steven De Costa
 
PPTX
[Databeers] 06/05/2014 - Boris Villazon: “Data Integration - A Linked Data ap...
Data Beers
 
KEY
RDFa Introductory Course Session 4/4 When RDFa
Platypus
 
PPTX
Microtask Crowdsourcing Applications for Linked Data
EUCLID project
 
PDF
CKAN - the open source data portal platform
Maurizio Napolitano
 
PPTX
RDF-Gen: Generating RDF from streaming and archival data
Giorgos Santipantakis
 
PPTX
Linked data for Libraries
Michael Cummings
 
PPT
Site Interoperability Projects at DERI Galway's SW Cluster
John Breslin
 
PPTX
Usage of Linked Data: Introduction and Application Scenarios
EUCLID project
 
PDF
Querying Linked Data with SPARQL (2010)
Olaf Hartig
 
PDF
Documents, services, and data on the web
Chiara Del Vescovo
 
PPTX
20100614 ISWSA Keynote
Axel Polleres
 
PDF
Visualising statistical Linked Data with Plone
Eau de Web
 
PPTX
Linked data life cycles
Michael Hausenblas
 
PPTX
The Semantic Data Web, Sören Auer, University of Leipzig
LOD2 Creating Knowledge out of Interlinked Data
 
PPTX
Big Linked Data - Creating Training Curricula
EUCLID project
 
Interaction with Linked Data
EUCLID project
 
Data.dcs: Converting Legacy Data into Linked Data
Matthew Rowe
 
Drupal, CKAN and Public Data. DrupalGov 08 february 2016
Steven De Costa
 
[Databeers] 06/05/2014 - Boris Villazon: “Data Integration - A Linked Data ap...
Data Beers
 
RDFa Introductory Course Session 4/4 When RDFa
Platypus
 
Microtask Crowdsourcing Applications for Linked Data
EUCLID project
 
CKAN - the open source data portal platform
Maurizio Napolitano
 
RDF-Gen: Generating RDF from streaming and archival data
Giorgos Santipantakis
 
Linked data for Libraries
Michael Cummings
 
Site Interoperability Projects at DERI Galway's SW Cluster
John Breslin
 
Usage of Linked Data: Introduction and Application Scenarios
EUCLID project
 
Querying Linked Data with SPARQL (2010)
Olaf Hartig
 
Documents, services, and data on the web
Chiara Del Vescovo
 
20100614 ISWSA Keynote
Axel Polleres
 
Visualising statistical Linked Data with Plone
Eau de Web
 
Linked data life cycles
Michael Hausenblas
 
The Semantic Data Web, Sören Auer, University of Leipzig
LOD2 Creating Knowledge out of Interlinked Data
 
Big Linked Data - Creating Training Curricula
EUCLID project
 
Ad

Viewers also liked (10)

PDF
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
PDF
SEEMP - Semantic Aspects and Interoperability
Boris Villazón-Terrazas
 
PDF
Towards a Commons RDF Java library
Sergio Fernández
 
PDF
Geolinkeddata 07042011 1
Boris Villazón-Terrazas
 
PDF
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
PDF
A Method for Reusing and Re-engineering Non-ontological Resources for Buildin...
Boris Villazón-Terrazas
 
PDF
Linguistic resources enhanced with geospatial Information
Boris Villazón-Terrazas
 
PDF
Sitemap4rdf(v2 boris)
Boris Villazón-Terrazas
 
PDF
iSOCO - Research Lab Brief Introduction
Boris Villazón-Terrazas
 
PDF
Data Shapes and Data Transformations
Boris Villazón-Terrazas
 
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
SEEMP - Semantic Aspects and Interoperability
Boris Villazón-Terrazas
 
Towards a Commons RDF Java library
Sergio Fernández
 
Geolinkeddata 07042011 1
Boris Villazón-Terrazas
 
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
A Method for Reusing and Re-engineering Non-ontological Resources for Buildin...
Boris Villazón-Terrazas
 
Linguistic resources enhanced with geospatial Information
Boris Villazón-Terrazas
 
Sitemap4rdf(v2 boris)
Boris Villazón-Terrazas
 
iSOCO - Research Lab Brief Introduction
Boris Villazón-Terrazas
 
Data Shapes and Data Transformations
Boris Villazón-Terrazas
 
Ad

Similar to Yet another SPARQL 1.1 brief introduction (20)

PPTX
SPARQL Cheat Sheet
LeeFeigenbaum
 
ODP
SPARQL 1.1 Update (2013-03-05)
andyseaborne
 
PPTX
Sparql
Tamrat Amare
 
PPTX
What;s Coming In SPARQL2?
LeeFeigenbaum
 
PPTX
SPARQL 1.1 Status
LeeFeigenbaum
 
PPTX
A Little SPARQL in your Analytics
Dr. Neil Brittliff
 
PDF
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: SPARQL 1.1 Update Language
eswcsummerschool
 
PDF
Transforming Your Data with GraphDB: GraphDB Fundamentals, Jan 2018
Ontotext
 
PPTX
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
PPTX
Triplestore and SPARQL
Lino Valdivia
 
PPTX
SPARQL
Raji Ghawi
 
PPTX
Introduction to SPARQL
Jose Emilio Labra Gayo
 
PPTX
Introduction to SPARQL
Jose Emilio Labra Gayo
 
PDF
Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: Univer...
Allison Jai O'Dell
 
PPSX
Introduction to SPARQL
Pedro Szekely
 
PDF
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Olaf Hartig
 
PDF
Federation and Navigation in SPARQL 1.1
net2-project
 
PDF
SPARQL and Linked Data
Fulvio Corno
 
PPT
Sparql
Serge Garlatti
 
PPT
Semantic Web
amberkhan59
 
SPARQL Cheat Sheet
LeeFeigenbaum
 
SPARQL 1.1 Update (2013-03-05)
andyseaborne
 
Sparql
Tamrat Amare
 
What;s Coming In SPARQL2?
LeeFeigenbaum
 
SPARQL 1.1 Status
LeeFeigenbaum
 
A Little SPARQL in your Analytics
Dr. Neil Brittliff
 
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: SPARQL 1.1 Update Language
eswcsummerschool
 
Transforming Your Data with GraphDB: GraphDB Fundamentals, Jan 2018
Ontotext
 
SPARQL introduction and training (130+ slides with exercices)
Thomas Francart
 
Triplestore and SPARQL
Lino Valdivia
 
SPARQL
Raji Ghawi
 
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Introduction to SPARQL
Jose Emilio Labra Gayo
 
Notes from the Library Juice Academy courses on “SPARQL Fundamentals”: Univer...
Allison Jai O'Dell
 
Introduction to SPARQL
Pedro Szekely
 
Tutorial "An Introduction to SPARQL and Queries over Linked Data" Chapter 3 (...
Olaf Hartig
 
Federation and Navigation in SPARQL 1.1
net2-project
 
SPARQL and Linked Data
Fulvio Corno
 
Semantic Web
amberkhan59
 

More from Boris Villazón-Terrazas (12)

PDF
RDB2RDF, an overview of R2RML and Direct Mapping
Boris Villazón-Terrazas
 
PDF
Map4rdf - Faceted Browser for Geospatial Datasets
Boris Villazón-Terrazas
 
PDF
Publishing Linked Data from RDB
Boris Villazón-Terrazas
 
PDF
Linked Data Projects at OEG - Current Status
Boris Villazón-Terrazas
 
PDF
A Provenance-Aware Linked Data Application for Trip Management and Organization
Boris Villazón-Terrazas
 
PDF
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
PDF
Linked Data Research Projects at Ontology Engineering Group
Boris Villazón-Terrazas
 
PDF
Lightweight Semantic Annotation of Geospatial RESTful Services
Boris Villazón-Terrazas
 
PPTX
Geometry2rdf(v2 boris)
Boris Villazón-Terrazas
 
PDF
An Approach to Publish Spatial Data on the Web: The GeoLinked Data Use Case
Boris Villazón-Terrazas
 
PDF
Geo linked data lstd10(v2-boris)
Boris Villazón-Terrazas
 
PPTX
GeoLinkedData
Boris Villazón-Terrazas
 
RDB2RDF, an overview of R2RML and Direct Mapping
Boris Villazón-Terrazas
 
Map4rdf - Faceted Browser for Geospatial Datasets
Boris Villazón-Terrazas
 
Publishing Linked Data from RDB
Boris Villazón-Terrazas
 
Linked Data Projects at OEG - Current Status
Boris Villazón-Terrazas
 
A Provenance-Aware Linked Data Application for Trip Management and Organization
Boris Villazón-Terrazas
 
Methodological Guidelines for Publishing Linked Data
Boris Villazón-Terrazas
 
Linked Data Research Projects at Ontology Engineering Group
Boris Villazón-Terrazas
 
Lightweight Semantic Annotation of Geospatial RESTful Services
Boris Villazón-Terrazas
 
Geometry2rdf(v2 boris)
Boris Villazón-Terrazas
 
An Approach to Publish Spatial Data on the Web: The GeoLinked Data Use Case
Boris Villazón-Terrazas
 
Geo linked data lstd10(v2-boris)
Boris Villazón-Terrazas
 

Recently uploaded (20)

PDF
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PDF
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
PPTX
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
PPTX
How tech helps people in the modern era.
upadhyayaryan154
 
PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PPTX
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
PPT
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
PPTX
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
PPTX
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
PPTX
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
PPTX
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PDF
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PDF
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
PDF
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
PPTX
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
PPTX
Parallel & Concurrent ...
yashpavasiya892
 
DNSSEC Made Easy, presented at PHNOG 2025
APNIC
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
How tech helps people in the modern era.
upadhyayaryan154
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
Perkembangan Perangkat jaringan komputer dan telekomunikasi 3.pptx
Prayudha3
 
Introduction to dns domain name syst.ppt
MUHAMMADKAVISHSHABAN
 
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
Google SGE SEO: 5 Critical Changes That Could Wreck Your Rankings in 2025
Reversed Out Creative
 
The Internet of Things (IoT) refers to a vast network of interconnected devic...
chethana8182
 
Slides Powerpoint: Eco Economic Epochs.pptx
Steven McGee
 
Crypto Recovery California Services.pptx
lionsgate network
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
LB# 820-1889_051-7370_C000.schematic.pdf
matheusalbuquerqueco3
 
Different Generation Of Computers .pptx
divcoder9507
 
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
UI/UX Developer Guide: Tools, Trends, and Tips for 2025
Penguin peak
 
B2B_Ecommerce_Internship_Simranpreet.pptx
LipakshiJindal
 
Parallel & Concurrent ...
yashpavasiya892
 

Yet another SPARQL 1.1 brief introduction

  • 1. Yet another SPARQL 1.1 brief introduction Victor Saquicela Galarza, Almudena Gonzalez, and Boris Villazón-Terrazas [email protected] @boricles Slides available at: http://www.slideshare.net/boricles/
  • 2. SPARQL 1.1 • W3C Recommendation 21 March 2013 • New features in Query language: - Aggregate functions: COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT, and SAMPLE. - Subqueries: Nest the results of a query within another query - Negation: Check the absence of triples in a graph - Expressions in SELECT: Introduce new variables in the SELECT clause - Property paths: Search graphs through structures that involve arbitrary-length paths - Assignment: BIND keyword and expressions in SELECT and GROUP_BY - Short form for CONSTRUCT - Expanded functions and operators: EXISTS, NOT EXISTS, SUBSTR, etc.2
  • 3. Other SPARQL 1.1 specifications • Update Language extension to express updates to an RDF graph/store • Protocol Changes related to the update operation • Service description Discover a SPARQL endpoint's capabilities and summary information of its data • Graph Store HTTP Protocol Update and fetch RDF graph content from a Graph Store over HTTP in the REST style • Entailment Regimes Define the semantics of SPARQL queries for some entailment frameworks: OWL flavors, RDFS, RIF • Federation Extensions Take a query and provide solutions based on information from many different sources • Query Result JSON, CSV, TSV 3
  • 4. ToC • Update • Federated queries • Basic property paths 4
  • 5. Some preliminary useful queries SELECT DISTINCT ?g WHERE { GRAPH ?g { ?s ?p ?o } } Query to get the current graphs of my triplestore: 5 SELECT * FROM <http://mygraph/> WHERE { ?s ?p ?o } Query to get everything from a particular graph
  • 6. A simple SPARQL INSERT query #graph http://linkeddata.ec/graph/tutorial/example1 PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> WITH <http://linkeddata.ec/graph/tutorial/example1> INSERT { lde:myname foaf:name "boráclito" } Data before: Query: 6 #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/myname> foaf:name "boráclito" . Data after:
  • 7. A simple SPARQL DELETE query #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/myname> foaf:name "boráclito" . PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> WITH <http://linkeddata.ec/graph/tutorial/example1> DELETE { lde:myname foaf:name "boráclito" } Data before: Query: 7 #graph http://linkeddata.ec/graph/tutorial/example1 Data after:
  • 8. Another way to INSERT a triple #graph http://linkeddata.ec/graph/tutorial/example1 PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> INSERT DATA { GRAPH <http://linkeddata.ec/graph/tutorial/example1> {<http://linkeddata.ec/resource/myname> foaf:name "boráclito" . } } Data before: Query: 8 #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/myname> foaf:name "boráclito" . Data after:
  • 9. Another way to DELETE a triple #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/myname> foaf:name "boráclito" . PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> DELETE DATA { GRAPH <http://linkeddata.ec/graph/tutorial/example1> {<http://linkeddata.ec/resource/myname> foaf:name "boráclito" . } } Data before: Query: 9 #graph http://linkeddata.ec/graph/tutorial/example1 Data after:
  • 10. Inserting triples #graph http://linkeddata.ec/graph/tutorial/example1 PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> INSERT DATA { GRAPH <http://linkeddata.ec/graph/tutorial/example1> {<http://linkeddata.ec/resource/team1> foaf:name "Ecuador" . <http://linkeddata.ec/resource/team2> foaf:name "Bolivia" . <http://linkeddata.ec/resource/team3> foaf:name "España" . } } Data before: Query: 10 #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/team1> foaf:name "Ecuador" . <http://linkeddata.ec/resource/team2> foaf:name "Bolivia" . <http://linkeddata.ec/resource/team3> foaf:name "España" . Data after:
  • 11. DELETE with WHERE clause #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/team1> foaf:name "Ecuador" . <http://linkeddata.ec/resource/team2> foaf:name "Bolivia" . <http://linkeddata.ec/resource/team3> foaf:name "España" . PREFIX foaf: <http://xmlns.com/foaf/0.1/> WITH <http://linkeddata.ec/graph/tutorial/example1> DELETE { ?s foaf:name ?name . } WHERE { ?s foaf:name ?name . FILTER(REGEX(?name,"E")) } Data before: Query: 11 #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/team2> foaf:name "Bolivia" . Data after:
  • 12. Renaming a particular object 12 #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/team2> foaf:name "Bolivia" . PREFIX foaf: <http://xmlns.com/foaf/0.1/> WITH <http://linkeddata.ec/graph/tutorial/example1> DELETE { ?s foaf:name "Bolivia" } INSERT { ?s foaf:name "Ecuador" } WHERE { ?s foaf:name "Bolivia" } Data before: Query: #graph http://linkeddata.ec/graph/tutorial/example1 @prefix foaf: <http://xmlns.com/foaf/0.1/> . <http://linkeddata.ec/resource/team2> foaf:name "Ecuador" . Data after:
  • 13. Inserting triples #graph http://linkeddata.ec/graph/tutorial/people PREFIX lde: <http://linkeddata.ec/resource/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> INSERT DATA { GRAPH <http://linkeddata.ec/graph/tutorial/people> { lde:victor a foaf:Person . lde:victor foaf:name "Victor Saquicela" . lde:victor foaf:mbox <mailto:[email protected]> . lde:mauri a foaf:Person . lde:mauri foaf:name "Mauricio Espinoza" .} } Data before: Query: 13 #graph http://linkeddata.ec/graph/tutorial/people @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix lde: <http://linkeddata.ec/resource/> . lde:victor a foaf:Person . lde:victor foaf:name "Victor Saquicela" . lde:victor foaf:mbox <mailto:[email protected]> . lde:mauri a foaf:Person . lde:mauri foaf:name "Mauricio Espinoza" . Data after:
  • 14. Copy triples of name and email from one named graph to another #graph http://linkeddata.ec/graph/tutorial/addresses PREFIX foaf: <http://xmlns.com/foaf/0.1/> INSERT { GRAPH <http://linkeddata.ec/graph/tutorial/addresses> { ?person foaf:name ?name . ?person foaf:mbox ?email } } WHERE { GRAPH <http://linkeddata.ec/graph/tutorial/people> { ?person foaf:name ?name . OPTIONAL { ?person foaf:mbox ?email } } } Data before: Query: 14 #graph http://linkeddata.ec/graph/tutorial/addresses @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix lde: <http://linkeddata.ec/resource/> . lde:victor foaf:name "Victor Saquicela" . lde:victor foaf:mbox <mailto:[email protected]> . lde:mauri foaf:name "Mauricio Espinoza" . Data after:
  • 15. Some operations over graphs LOAD <http://terrazas.name/villazon/boris/data/TwitterAccounts.nt> INTO GRAPH <http://linkeddata.ec/graph/data-test> Load 15 CLEAR GRAPH <http://linkeddata.ec/graph/data-test> Clear
  • 16. ToC • Update • Federated queries • Basic property paths 16
  • 17. Federated Queries - Motivation 17 DBpedia LinkedMDB Query both datasets in an integrated way
  • 18. What is exactly Federated SPARQL Query? 18 Image taken from Flick https://www.flickr.com/photos/fadirra/5915787567/
  • 19. Federated SQL queries within DBMS? 19 • Not so difficult if we are using the same DBMS vendor - MySQL to MySQL - Oracle to Oracle - PostgreSQL to PostgreSQL • If we are dealing with different DBMS vendor - Build wrappers
  • 20. Federated SPARQL Query Syntax 20 SPARQL_ENDPOINT_URL_A SELECT * FROM <http://example.com/graph/mygraph> WHERE { ?s ?q ?w . SERVICE <SPARQL_ENDPOINT_URL_B> { SELECT * FROM <http://localhost:8890/isoco> { ?t ?q ?o . } } } SPARQL_ENDPOINT_URL_A SERVICE <….> { SELECT * FROM …. WHERE { ….} } SPARQL_ENDPOINT_URL_B Results
  • 21. Federated Queries examples 21 SPARQL endpoint 1 lab-1-1.ttl SPARQL endpoint 2 lab-1-2.ttl SPARQL endpoint 3 DBpedia
  • 22. Federated query example 1 SELECT * FROM <http://linkeddata.ec/graph/federado> WHERE { ?s ?q ?w . SERVICE <http://172.16.147.92:8890/sparql/> { SELECT * FROM <http://localhost:8890/isoco2> { ?t ?q ?o . } } } Query: 22
  • 23. Federated query example 2 SELECT * FROM <http://linkeddata.ec/graph/federado> WHERE { ?s ?q ?w . SERVICE <http://192.168.1.100:8890/sparql/> { SELECT * FROM <http://localhost:8890/isoco> { ?t ?q ?o . } } } Query: 23
  • 24. Federated query example 3 SELECT * FROM <http://linkeddata.ec/graph/federado> WHERE { ?s ?q ?w . SERVICE <http://192.168.1.101:8890/sparql/> { SELECT * FROM <http://localhost:8890/isoco2> { ?t ?q ?o . } } SERVICE <http://dbpedia.org/sparql/> { SELECT * FROM <http://dbpedia.org>{ <http://dbpedia.org/resource/Cochabamba> ?h ?k . } } } Query: 24
  • 25. Federated query example 4 SELECT * FROM <http://linkeddata.ec/graph/federado> WHERE { <http://lab.isoco.net/resource/agonzalez> <http://vocab.isoco.net/lab/birthPlace> ?c . <http://lab.isoco.net/resource/agonzalez> foaf:currentProject ?p SERVICE <http://172.16.147.144:8890/sparql> { SELECT * FROM <http://localhost:8890/isoco2> { <http://lab.isoco.net/resource/agonzalez> foaf:currentProject ?o . } } SERVICE <http://dbpedia.org/sparql/> { SELECT * FROM <http://dbpedia.org>{ ?c ?h ?k . } } } Query: 25
  • 26. Federated query example 5 SELECT * FROM <http://linkeddata.ec/graph/federado> WHERE { ?s <http://vocab.isoco.net/lab/birthPlace> ?c . ?s foaf:currentProject ?p SERVICE <http://192.168.1.101:8890/sparql/> { SELECT * FROM <http://localhost:8890/isoco2> { ?s foaf:currentProject ?o . } } SERVICE <http://dbpedia.org/sparql/> { SELECT * FROM <http://dbpedia.org>{ ?c ?h ?k . } } } Query: 26
  • 27. ToC • Update • Federated queries • Basic property paths 27
  • 28. Example 1 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX vocab: <http://vocab.isoco.net/> INSERT DATA { GRAPH <http://data.isoco.net/graph/test-subclassof> { vocab:Person rdf:type rdfs:Class . vocab:Professor rdf:type rdfs:Class . vocab:AssistantProfessor rdf:type rdfs:Class . vocab:Professor rdfs:subClassOf vocab:Person . vocab:AssistantProfessor rdfs:subClassOf vocab:Professor . <http://data.isoco.net/people/Penny> rdf:type vocab:Professor . <http://data.isoco.net/people/Leonard> rdf:type vocab:AssistantProfessor . } } Query: 28 INSERT
  • 29. Example 1 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT * FROM <http://data.isoco.net/graph/test-subclassof> WHERE { <http://vocab.isoco.net/AssistantProfessor> rdfs:subClassOf+ ?s } Query: 29 SUPERCLASSES s http://vocab.isoco.net/Professor http://vocab.isoco.net/Person Results:
  • 30. Example 1 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT * FROM <http://data.isoco.net/graph/test-subclassof> WHERE { ?a rdf:type ?type . ?type rdfs:subClassOf* <http://vocab.isoco.net/Person> } Query: 30 INSTANCES a type http://data.isoco.net/people/Leonard http://vocab.isoco.net/AssistantProfessor http://data.isoco.net/people/Penny http://vocab.isoco.net/Professor Results: