SlideShare a Scribd company logo
1 of 13
Download to read offline
SPARQL 1.1
Query Language

SPARQL 1.1 Query
Overview
•
•
•
•
•
•
•
•

SPARQL 1.1 Overview
Aggregates
Subqueries
Negation
Expressions in SELECT
Property Paths
New Built-ins
Short form CONSTRUCT

SPARQL 1.1 Query

#2
What is SPARQL?
• SPARQL was a query language for RDF data
– http://www.w3.org/TR/rdf-sparql-query/

• And a protocol
– http://www.w3.org/TR/rdf-sparql-protocol/

• Designed around graph patterns
– Graph patterns use Turtle syntax

• SPARQL 1.1 introduces:
–
–
–
–

Query extensions (covered here)
Protocol extensions and a (RESTful) graph store protocol
Updates (covered next)
Service descriptions and federation

SPARQL 1.1 Query

#3
SPARQL 1.1 Query Extensions
• SPARQL 1.1 adds the following new features
(http://www.w3.org/TR/sparql11-query)
–
Aggregates

–
–
–
–
–
–
–

Subqueries
Negation
Expressions in the SELECT clause
Property Paths
Assignment
A short form for CONSTRUCT
An expanded set of functions and operators

SPARQL 1.1 Query

#4
Aggregates
• Aggregates allow computation of values using:
– COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT and SAMPLE

• Built around the GROUP BY operator
• For example computing popularity in a social graph:
SELECT ?person (COUNT(?someone) AS ?popularity)
WHERE {?someone foaf:knows ?person}
GROUP BY ?person

• Prune at group level (cf. FILTER) using HAVING, e.g.:
GROUP BY ?person HAVING (COUNT(?someone) > 300)
SPARQL 1.1 Query

#5
Subqueries
• Subqueries allow bindings from one (inner) query to be
used in another (outer) query
• For example, to compute whom the most popular
person in a social graph knows:
SELECT ?friend
WHERE {?popular foaf:knows ?friend.
{SELECT ?popular (COUNT(?someone) AS ?popularity)
WHERE {?someone foaf:knows ?popular}
GROUP BY ?popular
ORDER BY DESC (?popularity)
LIMIT 1}}
SPARQL 1.1 Query

#6
Negation 1/2
• SPARQL 1.0 negation was limited, applying only to
simple FILTER expressions
• SPARQL 1.1 introduces EXISTS, allowing graph
matching (without binding)
• For example, to compute email addresses of people
who know no Barrys (!):
SELECT ?email
WHERE {?sad foaf:mbox ?email .
FILTER NOT EXISTS {?sad foaf:knows ?barry.
{?barry foaf:givenName "Barry"}
UNION {?barry foaf:firstName "Barry"}}
SPARQL 1.1 Query

#7
Negation 2/2
• SPARQL 1.0 negation was limited, applying only to
simple FILTER expressions
• SPARQL 1.1 also introduces MINUS, allowing explicit
removal of triples (according to another match)
• For example, to compute people who know Barrys
other than Barry Norton:
SELECT DISTINCT ?person WHERE
{?person foaf:knows ?barry.
?barry foaf:givenName "Barry".
MINUS {?person foaf:knows
[foaf:mbox <mailto:barry.norton@ontotext.com>]}}
SPARQL 1.1 Query

#8
Expressions in SELECT (Projection) Clauses
• SPARQL 1.0 allows built-in functions, etc., to be used in
FILTER
• SPARQL 1.1 allows their use in (the projection onto)
variables in the head of the query
• For example, to glue together names:
SELECT (CONCAT(?forename, " ", ?surname) AS ?name)
WHERE {{{?person foaf:givenName ?forename}
UNION {?person foaf:firstName ?forename}}.
{{?person foaf:familyName ?surname}
UNION {?person foaf:lastName ?surname}}}

SPARQL 1.1 Query

#9
Property Paths 1/2
• SPARQL 1.0 builds graph patterns from triple patterns,
where resources are separated in the graph by one arc
• SPARQL 1.1 generalises on triple patterns to model
resources separated by paths of arbitrary length
• Paths are specified using the following grammar that
follows
• Example: any member of an RDF List:
?list rdf:rest*/rdf:first ?element

SPARQL 1.1 Query

#10
Property Paths 2/2

• Example: anyone in social graph of ?p knows a Barry:
?p {foaf:knows | ^foaf:knows}* /
(foaf:givenName | foaf:firstName) "Barry"
SPARQL 1.1 Query

#11
New Built-ins
• SPARQL 1.1 supports a wider set of built-ins than
SPARQL 1.0, introducing:
– Maths: ABS (absolute value), ROUND/CEIL /FLOOR(rounding),
RAND (random), isNUMERIC
– Strings: CONCAT, CONTAINS, SUBSTR, STRLEN, UCASE, LCASE
– Dates: YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS,
TIMEZONE/TZ (timezone as XML or literal), NOW
– Hashes: MD5 , SHA1, SHA224, SHA256, SHA384, SHA512
– Enumeration: IN, NOT IN
– Control: IF, COALESCE
– Identifiers: ENCODE_FOR_URI, IRI/URI, BNODE (create a new
blank node, can be with parameter)

SPARQL 1.1 Query

#12
Short Form CONSTRUCT
• In order to query for a subgraph, without change, it is
no longer necessary to repeat the graph pattern
• Example:
CONSTRUCT WHERE
{?barry foaf:givenName "Barry";
?p ?o}

SPARQL 1.1 Query

#13

More Related Content

Similar to Learn SPARQL 1.1 Query Extensions in SPARQL

SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)andyseaborne
 
What;s Coming In SPARQL2?
What;s Coming In SPARQL2?What;s Coming In SPARQL2?
What;s Coming In SPARQL2?LeeFeigenbaum
 
SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)Thomas Francart
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeAdriel Café
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLMyungjin Lee
 
SPARQL and SQL: technical aspects and synergy
SPARQL and SQL: technical aspects and synergySPARQL and SQL: technical aspects and synergy
SPARQL and SQL: technical aspects and synergyYannis Kalfoglou
 
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Kai Chan
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLEmanuele Della Valle
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic WebJan Beeck
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKrAlvaro Graves
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011sesam4able
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011Robert Engels
 
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.
 
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQL
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQLESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQL
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQLeswcsummerschool
 

Similar to Learn SPARQL 1.1 Query Extensions in SPARQL (20)

SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)SPARQL 1.1 Update (2013-03-05)
SPARQL 1.1 Update (2013-03-05)
 
SPARQL 1.1 Status
SPARQL 1.1 StatusSPARQL 1.1 Status
SPARQL 1.1 Status
 
What;s Coming In SPARQL2?
What;s Coming In SPARQL2?What;s Coming In SPARQL2?
What;s Coming In SPARQL2?
 
SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)SPARQL introduction and training (130+ slides with exercices)
SPARQL introduction and training (130+ slides with exercices)
 
SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 
Querying Linked Data
Querying Linked DataQuerying Linked Data
Querying Linked Data
 
SPARQL and SQL: technical aspects and synergy
SPARQL and SQL: technical aspects and synergySPARQL and SQL: technical aspects and synergy
SPARQL and SQL: technical aspects and synergy
 
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
Search Engine Building with Lucene and Solr (So Code Camp San Diego 2014)
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
Sparql
SparqlSparql
Sparql
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic Web
 
SWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQLSWT Lecture Session 3 - SPARQL
SWT Lecture Session 3 - SPARQL
 
Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013Table functions - Planboard Symposium 2013
Table functions - Planboard Symposium 2013
 
Creating web applications with LODSPeaKr
Creating web applications with LODSPeaKrCreating web applications with LODSPeaKr
Creating web applications with LODSPeaKr
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
Sesam4 project presentation sparql - april 2011
Sesam4   project presentation sparql - april 2011Sesam4   project presentation sparql - april 2011
Sesam4 project presentation sparql - april 2011
 
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
 
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQL
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQLESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQL
ESWC SS 2012 - Monday Tutorial 2 Barry Norton: Introduction to SPARQL
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 

More from eswcsummerschool

Semantic Aquarium - ESWC SSchool 14 - Student project
Semantic Aquarium - ESWC SSchool 14 - Student projectSemantic Aquarium - ESWC SSchool 14 - Student project
Semantic Aquarium - ESWC SSchool 14 - Student projecteswcsummerschool
 
Syrtaki - ESWC SSchool 14 - Student project
Syrtaki  - ESWC SSchool 14 - Student projectSyrtaki  - ESWC SSchool 14 - Student project
Syrtaki - ESWC SSchool 14 - Student projecteswcsummerschool
 
Keep fit (a bit) - ESWC SSchool 14 - Student project
Keep fit (a bit)  - ESWC SSchool 14 - Student projectKeep fit (a bit)  - ESWC SSchool 14 - Student project
Keep fit (a bit) - ESWC SSchool 14 - Student projecteswcsummerschool
 
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student project
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student projectArabic Sentiment Lexicon - ESWC SSchool 14 - Student project
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student projecteswcsummerschool
 
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student project
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student projectFIT-8BIT An activity music assistant - ESWC SSchool 14 - Student project
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student projecteswcsummerschool
 
Personal Tours at the British Museum - ESWC SSchool 14 - Student project
Personal Tours at the British Museum  - ESWC SSchool 14 - Student projectPersonal Tours at the British Museum  - ESWC SSchool 14 - Student project
Personal Tours at the British Museum - ESWC SSchool 14 - Student projecteswcsummerschool
 
Exhibition recommendation using British Museum data and Event Registry - ESWC...
Exhibition recommendation using British Museum data and Event Registry - ESWC...Exhibition recommendation using British Museum data and Event Registry - ESWC...
Exhibition recommendation using British Museum data and Event Registry - ESWC...eswcsummerschool
 
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...eswcsummerschool
 
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014 Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014 eswcsummerschool
 
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014eswcsummerschool
 
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014 Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014 eswcsummerschool
 
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...eswcsummerschool
 
Mon norton tut_publishing01
Mon norton tut_publishing01Mon norton tut_publishing01
Mon norton tut_publishing01eswcsummerschool
 
Mon domingue introduction to the school
Mon domingue introduction to the schoolMon domingue introduction to the school
Mon domingue introduction to the schooleswcsummerschool
 
Mon norton tut_querying cultural heritage data
Mon norton tut_querying cultural heritage dataMon norton tut_querying cultural heritage data
Mon norton tut_querying cultural heritage dataeswcsummerschool
 
Tue acosta hands_on_providinglinkeddata
Tue acosta hands_on_providinglinkeddataTue acosta hands_on_providinglinkeddata
Tue acosta hands_on_providinglinkeddataeswcsummerschool
 
Thu bernstein key_warp_speed
Thu bernstein key_warp_speedThu bernstein key_warp_speed
Thu bernstein key_warp_speedeswcsummerschool
 
Fri schreiber key_knowledge engineering
Fri schreiber key_knowledge engineeringFri schreiber key_knowledge engineering
Fri schreiber key_knowledge engineeringeswcsummerschool
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02eswcsummerschool
 
Mon fundulaki tut_querying linked data
Mon fundulaki tut_querying linked dataMon fundulaki tut_querying linked data
Mon fundulaki tut_querying linked dataeswcsummerschool
 

More from eswcsummerschool (20)

Semantic Aquarium - ESWC SSchool 14 - Student project
Semantic Aquarium - ESWC SSchool 14 - Student projectSemantic Aquarium - ESWC SSchool 14 - Student project
Semantic Aquarium - ESWC SSchool 14 - Student project
 
Syrtaki - ESWC SSchool 14 - Student project
Syrtaki  - ESWC SSchool 14 - Student projectSyrtaki  - ESWC SSchool 14 - Student project
Syrtaki - ESWC SSchool 14 - Student project
 
Keep fit (a bit) - ESWC SSchool 14 - Student project
Keep fit (a bit)  - ESWC SSchool 14 - Student projectKeep fit (a bit)  - ESWC SSchool 14 - Student project
Keep fit (a bit) - ESWC SSchool 14 - Student project
 
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student project
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student projectArabic Sentiment Lexicon - ESWC SSchool 14 - Student project
Arabic Sentiment Lexicon - ESWC SSchool 14 - Student project
 
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student project
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student projectFIT-8BIT An activity music assistant - ESWC SSchool 14 - Student project
FIT-8BIT An activity music assistant - ESWC SSchool 14 - Student project
 
Personal Tours at the British Museum - ESWC SSchool 14 - Student project
Personal Tours at the British Museum  - ESWC SSchool 14 - Student projectPersonal Tours at the British Museum  - ESWC SSchool 14 - Student project
Personal Tours at the British Museum - ESWC SSchool 14 - Student project
 
Exhibition recommendation using British Museum data and Event Registry - ESWC...
Exhibition recommendation using British Museum data and Event Registry - ESWC...Exhibition recommendation using British Museum data and Event Registry - ESWC...
Exhibition recommendation using British Museum data and Event Registry - ESWC...
 
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...
Empowering fishing business using Linked Data - ESWC SSchool 14 - Student pro...
 
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014 Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014
Tutorial: Social Semantic Web and Crowdsourcing - E. Simperl - ESWC SS 2014
 
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014
Keynote: Global Media Monitoring - M. Grobelnik - ESWC SS 2014
 
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014 Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014
Hands On: Amazon Mechanical Turk - M. Acosta - ESWC SS 2014
 
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...
Tutorial: Querying a Marine Data Warehouse Using SPARQL - I. Fundulaki - ESWC...
 
Mon norton tut_publishing01
Mon norton tut_publishing01Mon norton tut_publishing01
Mon norton tut_publishing01
 
Mon domingue introduction to the school
Mon domingue introduction to the schoolMon domingue introduction to the school
Mon domingue introduction to the school
 
Mon norton tut_querying cultural heritage data
Mon norton tut_querying cultural heritage dataMon norton tut_querying cultural heritage data
Mon norton tut_querying cultural heritage data
 
Tue acosta hands_on_providinglinkeddata
Tue acosta hands_on_providinglinkeddataTue acosta hands_on_providinglinkeddata
Tue acosta hands_on_providinglinkeddata
 
Thu bernstein key_warp_speed
Thu bernstein key_warp_speedThu bernstein key_warp_speed
Thu bernstein key_warp_speed
 
Fri schreiber key_knowledge engineering
Fri schreiber key_knowledge engineeringFri schreiber key_knowledge engineering
Fri schreiber key_knowledge engineering
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02
 
Mon fundulaki tut_querying linked data
Mon fundulaki tut_querying linked dataMon fundulaki tut_querying linked data
Mon fundulaki tut_querying linked data
 

Recently uploaded

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvRicaMaeCastro1
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...MerlizValdezGeronimo
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4MiaBumagat1
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 

Recently uploaded (20)

BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnvESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
ESP 4-EDITED.pdfmmcncncncmcmmnmnmncnmncmnnjvnnv
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"Mattingly "AI & Prompt Design: Large Language Models"
Mattingly "AI & Prompt Design: Large Language Models"
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...
IPCRF/RPMS 2024 Classroom Observation tool is your access to the new performa...
 
ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4ANG SEKTOR NG agrikultura.pptx QUARTER 4
ANG SEKTOR NG agrikultura.pptx QUARTER 4
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 

Learn SPARQL 1.1 Query Extensions in SPARQL

  • 2. Overview • • • • • • • • SPARQL 1.1 Overview Aggregates Subqueries Negation Expressions in SELECT Property Paths New Built-ins Short form CONSTRUCT SPARQL 1.1 Query #2
  • 3. What is SPARQL? • SPARQL was a query language for RDF data – http://www.w3.org/TR/rdf-sparql-query/ • And a protocol – http://www.w3.org/TR/rdf-sparql-protocol/ • Designed around graph patterns – Graph patterns use Turtle syntax • SPARQL 1.1 introduces: – – – – Query extensions (covered here) Protocol extensions and a (RESTful) graph store protocol Updates (covered next) Service descriptions and federation SPARQL 1.1 Query #3
  • 4. SPARQL 1.1 Query Extensions • SPARQL 1.1 adds the following new features (http://www.w3.org/TR/sparql11-query) – Aggregates – – – – – – – Subqueries Negation Expressions in the SELECT clause Property Paths Assignment A short form for CONSTRUCT An expanded set of functions and operators SPARQL 1.1 Query #4
  • 5. Aggregates • Aggregates allow computation of values using: – COUNT, SUM, MIN, MAX, AVG, GROUP_CONCAT and SAMPLE • Built around the GROUP BY operator • For example computing popularity in a social graph: SELECT ?person (COUNT(?someone) AS ?popularity) WHERE {?someone foaf:knows ?person} GROUP BY ?person • Prune at group level (cf. FILTER) using HAVING, e.g.: GROUP BY ?person HAVING (COUNT(?someone) > 300) SPARQL 1.1 Query #5
  • 6. Subqueries • Subqueries allow bindings from one (inner) query to be used in another (outer) query • For example, to compute whom the most popular person in a social graph knows: SELECT ?friend WHERE {?popular foaf:knows ?friend. {SELECT ?popular (COUNT(?someone) AS ?popularity) WHERE {?someone foaf:knows ?popular} GROUP BY ?popular ORDER BY DESC (?popularity) LIMIT 1}} SPARQL 1.1 Query #6
  • 7. Negation 1/2 • SPARQL 1.0 negation was limited, applying only to simple FILTER expressions • SPARQL 1.1 introduces EXISTS, allowing graph matching (without binding) • For example, to compute email addresses of people who know no Barrys (!): SELECT ?email WHERE {?sad foaf:mbox ?email . FILTER NOT EXISTS {?sad foaf:knows ?barry. {?barry foaf:givenName "Barry"} UNION {?barry foaf:firstName "Barry"}} SPARQL 1.1 Query #7
  • 8. Negation 2/2 • SPARQL 1.0 negation was limited, applying only to simple FILTER expressions • SPARQL 1.1 also introduces MINUS, allowing explicit removal of triples (according to another match) • For example, to compute people who know Barrys other than Barry Norton: SELECT DISTINCT ?person WHERE {?person foaf:knows ?barry. ?barry foaf:givenName "Barry". MINUS {?person foaf:knows [foaf:mbox <mailto:barry.norton@ontotext.com>]}} SPARQL 1.1 Query #8
  • 9. Expressions in SELECT (Projection) Clauses • SPARQL 1.0 allows built-in functions, etc., to be used in FILTER • SPARQL 1.1 allows their use in (the projection onto) variables in the head of the query • For example, to glue together names: SELECT (CONCAT(?forename, " ", ?surname) AS ?name) WHERE {{{?person foaf:givenName ?forename} UNION {?person foaf:firstName ?forename}}. {{?person foaf:familyName ?surname} UNION {?person foaf:lastName ?surname}}} SPARQL 1.1 Query #9
  • 10. Property Paths 1/2 • SPARQL 1.0 builds graph patterns from triple patterns, where resources are separated in the graph by one arc • SPARQL 1.1 generalises on triple patterns to model resources separated by paths of arbitrary length • Paths are specified using the following grammar that follows • Example: any member of an RDF List: ?list rdf:rest*/rdf:first ?element SPARQL 1.1 Query #10
  • 11. Property Paths 2/2 • Example: anyone in social graph of ?p knows a Barry: ?p {foaf:knows | ^foaf:knows}* / (foaf:givenName | foaf:firstName) "Barry" SPARQL 1.1 Query #11
  • 12. New Built-ins • SPARQL 1.1 supports a wider set of built-ins than SPARQL 1.0, introducing: – Maths: ABS (absolute value), ROUND/CEIL /FLOOR(rounding), RAND (random), isNUMERIC – Strings: CONCAT, CONTAINS, SUBSTR, STRLEN, UCASE, LCASE – Dates: YEAR, MONTH, DAY, HOURS, MINUTES, SECONDS, TIMEZONE/TZ (timezone as XML or literal), NOW – Hashes: MD5 , SHA1, SHA224, SHA256, SHA384, SHA512 – Enumeration: IN, NOT IN – Control: IF, COALESCE – Identifiers: ENCODE_FOR_URI, IRI/URI, BNODE (create a new blank node, can be with parameter) SPARQL 1.1 Query #12
  • 13. Short Form CONSTRUCT • In order to query for a subgraph, without change, it is no longer necessary to repeat the graph pattern • Example: CONSTRUCT WHERE {?barry foaf:givenName "Barry"; ?p ?o} SPARQL 1.1 Query #13