SlideShare ist ein Scribd-Unternehmen logo
1 von 49
Data Extraction & Exploration with SPARQL & the Talis Platform
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Tutorial Schema ,[object Object],[object Object],[object Object]
 
Triple and Graph Patterns ,[object Object]
#An RDF triple in Turtle syntax <http://purl.org/net/schemas/space/spacecraft/1957-001B>   foaf:name “Sputnik 1”.
#An SPARQL triple pattern, with a single variable <http://purl.org/net/schemas/space/spacecraft/1957-001B>   foaf:name ?name.
#All parts of a triple pattern can be variables ?spacecraft   foaf:name ?name.
 
#Matching labels of resources ?subject rdfs:label ?label.
 
#Combine triples patterns to create a graph pattern ?subject rdfs:label ?label. ?subject rdf:type space:Discipline.
#SPARQL is based on Turtle, which allows abbreviations #e.g. predicate-object lists: ?subject rdfs:label ?label; rdf:type space:Discipline.
 
#Graph patterns allow us to traverse a graph ?spacecraft foaf:name “Sputnik 1”. ?launch space:spacecraft ?launch. ?launch space:launched ?launchdate.
#Graph patterns allow us to traverse a graph ?spacecraft foaf:name “Sputnik 1” . ?launch space:spacecraft ?launch . ?launch space:launched ?launchdate .
 
Structure of a Query ,[object Object]
#Ex. 1 #Associate URIs with prefixes PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> #Example of a SELECT query, retrieving 2 variables #Variables selected MUST be bound in graph pattern SELECT ?subject ?label WHERE { #This is our graph pattern ?subject rdfs:label ?label; rdf:type space:Discipline. }
#Ex. 2 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> #Example of a SELECT query, retrieving all variables SELECT * WHERE { ?subject rdfs:label ?label; rdf:type space:Discipline. }
OPTIONAL bindings ,[object Object]
#Ex. 3 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?image WHERE { #This pattern must be bound ?spacecraft foaf:name ?name. #Anything in this block doesn't have to be bound OPTIONAL {   ?spacecraft foaf:depiction ?image. } }
UNION queries ,[object Object]
#Ex. 4 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?subject ?displayLabel WHERE { { ?subject foaf:name ?displayLabel. } UNION { ?subject rdfs:label ?displayLabel. } }
Sorting & Restrictions ,[object Object],[object Object]
#Ex.5  #Select the uri and the mass of all the spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. }
#Ex. 6 #Select the uri and the mass of all the spacecraft #with highest first PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } #Use an ORDER BY clause to apply a sort. Can be ASC or DESC ORDER BY DESC(?mass)‏
#Ex. 7 #Select the uri and the mass of the 10 heaviest spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } #Order by weight descending ORDER BY DESC(?mass)‏ #Limit to first ten results LIMIT 10
#Ex. 8 #Select the uri and the mass of the 11-20 th  most  #heaviest spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } ORDER BY DESC(?mass)‏ #Limit to ten results LIMIT 10 #Apply an offset to get next “page” OFFSET 10
Filtering ,[object Object]
#Sample data for Sputnik launch <http://purl.org/net/schemas/space/launch/1957-001> rdf:type space:Launch; #Assign a datatype to the literal, to indicate it is #a date space:launched &quot;1957-10-04&quot;^^xsd:date; space:spacecraft <http://purl.org/net/schemas/space/spacecraft/1957-001B> .
#Ex. 9 #Select name of spacecraft launched between  #1 st  Jan 1969 and 1 st  Jan 1970 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?launch space:launched ?date; space:spacecraft ?spacecraft. ?spacecraft foaf:name ?name. FILTER (?date > &quot;1969-01-01&quot;^^xsd:date &&  ?date < &quot;1970-01-01&quot;^^xsd:date)‏ }
#Ex. 10 #Select spacecraft with a mass of less than 90kg PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?spacecraft ?name WHERE { ?spacecraft foaf:name ?name; space:mass ?mass. #Note that we have to cast the data to the right type #As it is not declared in the data FILTER( xsd:double(?mass) < 90.0 )‏ }
#Ex. 11 #Select spacecraft with a name like “ollo” PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?spacecraft foaf:name ?name. FILTER( regex(?name, “ollo”, “i” ) )‏ }
Built-In Filters ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
DISTINCT ,[object Object]
#Ex. 12 #Select list of agencies associated with spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?agency WHERE { ?spacecraft space:agency ?agency. }
SPARQL Query Forms ,[object Object]
ASK ,[object Object]
#Ex. 13 #Was there a launch on 16 th  July 1969? PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> ASK WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. }
DESCRIBE Generate an RDF description of a resource(s)‏
#Ex. 14 #Describe launch(es) that occurred on 16 th  July 1969 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?launch WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. }
#Ex. 15 #Describe spacecraft launched on 16 th  July 1969 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?spacecraft WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch. }
CONSTRUCT Create a custom RDF graph based on query criteria Can be used to transform RDF data
#Ex. 16 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { ?spacecraft foaf:name ?name; space:agency ?agency; space:mass ?mass.  } WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch; foaf:name ?name; space:agency ?agency; space:mass ?mass.  }
SELECT SQL style result set retrieval
#Ex. 17 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?agency ?mass WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch; foaf:name ?name; space:agency ?agency; space:mass ?mass.  }
Useful Links ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
shared innovation

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

SPARQL-DL - Theory & Practice
SPARQL-DL - Theory & PracticeSPARQL-DL - Theory & Practice
SPARQL-DL - Theory & Practice
 
RDF validation tutorial
RDF validation tutorialRDF validation tutorial
RDF validation tutorial
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 
SPARQL queries on CIDOC-CRM data of BritishMuseum
SPARQL queries on CIDOC-CRM data of BritishMuseumSPARQL queries on CIDOC-CRM data of BritishMuseum
SPARQL queries on CIDOC-CRM data of BritishMuseum
 
RDFS In A Nutshell V1
RDFS In A Nutshell V1RDFS In A Nutshell V1
RDFS In A Nutshell V1
 
Taxonomy Management based on SKOS-XL
Taxonomy Management based on SKOS-XLTaxonomy Management based on SKOS-XL
Taxonomy Management based on SKOS-XL
 
SPARQL 사용법
SPARQL 사용법SPARQL 사용법
SPARQL 사용법
 
Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1
 
SHACL Overview
SHACL OverviewSHACL Overview
SHACL Overview
 
Understanding RDF: the Resource Description Framework in Context (1999)
Understanding RDF: the Resource Description Framework in Context  (1999)Understanding RDF: the Resource Description Framework in Context  (1999)
Understanding RDF: the Resource Description Framework in Context (1999)
 
Debunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative FactsDebunking some “RDF vs. Property Graph” Alternative Facts
Debunking some “RDF vs. Property Graph” Alternative Facts
 
Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)Ontology In A Nutshell (version 2)
Ontology In A Nutshell (version 2)
 
Resource description framework
Resource description frameworkResource description framework
Resource description framework
 
Introduction to RDF
Introduction to RDFIntroduction to RDF
Introduction to RDF
 
ShEx vs SHACL
ShEx vs SHACLShEx vs SHACL
ShEx vs SHACL
 
Querying Linked Data with SPARQL
Querying Linked Data with SPARQLQuerying Linked Data with SPARQL
Querying Linked Data with SPARQL
 
Introduction To RDF and RDFS
Introduction To RDF and RDFSIntroduction To RDF and RDFS
Introduction To RDF and RDFS
 
CIDOC CRM Tutorial
CIDOC CRM TutorialCIDOC CRM Tutorial
CIDOC CRM Tutorial
 
Building an Enterprise Knowledge Graph @Uber: Lessons from Reality
Building an Enterprise Knowledge Graph @Uber: Lessons from RealityBuilding an Enterprise Knowledge Graph @Uber: Lessons from Reality
Building an Enterprise Knowledge Graph @Uber: Lessons from Reality
 

Ähnlich wie SPARQL Tutorial

Ks2007 Semanticweb In Action
Ks2007 Semanticweb In ActionKs2007 Semanticweb In Action
Ks2007 Semanticweb In Action
Rinke Hoekstra
 
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
Jean-Paul Calbimonte
 
Yokohama Art Spot meets SPARQL
Yokohama Art Spot meets SPARQLYokohama Art Spot meets SPARQL
Yokohama Art Spot meets SPARQL
Fuyuko Matsumura
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
Josef Petrák
 
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
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In Action
Rinke Hoekstra
 
OpenSearch 2010-09
OpenSearch 2010-09OpenSearch 2010-09
OpenSearch 2010-09
Oscar Fonts
 

Ähnlich wie SPARQL Tutorial (20)

Ontologias - RDF
Ontologias - RDFOntologias - RDF
Ontologias - RDF
 
From SQL to SPARQL
From SQL to SPARQLFrom SQL to SPARQL
From SQL to SPARQL
 
Ks2007 Semanticweb In Action
Ks2007 Semanticweb In ActionKs2007 Semanticweb In Action
Ks2007 Semanticweb In Action
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
Tutorial ESWC2011 Building Semantic Sensor Web - 04 - Querying_semantic_strea...
 
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson Intro to Linked, Dutch Ships and Sailors and SPARQL handson
Intro to Linked, Dutch Ships and Sailors and SPARQL handson
 
Linked Data on Rails
Linked Data on RailsLinked Data on Rails
Linked Data on Rails
 
Getting Started With The Talis Platform
Getting Started With The Talis PlatformGetting Started With The Talis Platform
Getting Started With The Talis Platform
 
SPARQLing Services
SPARQLing ServicesSPARQLing Services
SPARQLing Services
 
Yokohama Art Spot meets SPARQL
Yokohama Art Spot meets SPARQLYokohama Art Spot meets SPARQL
Yokohama Art Spot meets SPARQL
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
2011 4IZ440 Semantic Web – RDF, SPARQL, and software APIs
 
Mashup OpenStreetMap and Wikidata to Create Useful Vector Data
Mashup OpenStreetMap and Wikidata to Create Useful Vector DataMashup OpenStreetMap and Wikidata to Create Useful Vector Data
Mashup OpenStreetMap and Wikidata to Create Useful Vector Data
 
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
(An Overview on) Linked Data Management and SPARQL Querying (ISSLOD2011)
 
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)
 
Geography in Linked Ancient World Data
Geography in Linked Ancient World DataGeography in Linked Ancient World Data
Geography in Linked Ancient World Data
 
The Semantics of SPARQL
The Semantics of SPARQLThe Semantics of SPARQL
The Semantics of SPARQL
 
Ks2008 Semanticweb In Action
Ks2008 Semanticweb In ActionKs2008 Semanticweb In Action
Ks2008 Semanticweb In Action
 
OpenSearch 2010-09
OpenSearch 2010-09OpenSearch 2010-09
OpenSearch 2010-09
 
Introduction to SPARQL
Introduction to SPARQLIntroduction to SPARQL
Introduction to SPARQL
 

Mehr von Leigh Dodds

Mehr von Leigh Dodds (20)

Being a data magpie
Being a data magpieBeing a data magpie
Being a data magpie
 
How you (yes, you!) can contribute to open data
How you (yes, you!) can contribute to open dataHow you (yes, you!) can contribute to open data
How you (yes, you!) can contribute to open data
 
Accessible Bath Training
Accessible Bath TrainingAccessible Bath Training
Accessible Bath Training
 
Accessible Bath
Accessible BathAccessible Bath
Accessible Bath
 
Cheap bots done quick lightning talk
Cheap bots done quick lightning talkCheap bots done quick lightning talk
Cheap bots done quick lightning talk
 
Open data in bath
Open data in bathOpen data in bath
Open data in bath
 
Bath: Hacked Learning Night: Introduction to CartoDB
Bath: Hacked Learning Night: Introduction to CartoDBBath: Hacked Learning Night: Introduction to CartoDB
Bath: Hacked Learning Night: Introduction to CartoDB
 
Dungeons and Dragons and Data
Dungeons and Dragons and DataDungeons and Dragons and Data
Dungeons and Dragons and Data
 
Love the Environment Pre-Meetup
Love the Environment Pre-MeetupLove the Environment Pre-Meetup
Love the Environment Pre-Meetup
 
Why I love open data and you should too
Why I love open data and you should tooWhy I love open data and you should too
Why I love open data and you should too
 
Introduction to Open Data & Bath: Hacked
Introduction to Open Data & Bath: HackedIntroduction to Open Data & Bath: Hacked
Introduction to Open Data & Bath: Hacked
 
Bath: Hacked: open data, the arts and cultural heritage
Bath: Hacked: open data, the arts and cultural heritageBath: Hacked: open data, the arts and cultural heritage
Bath: Hacked: open data, the arts and cultural heritage
 
Introduction to Open Data & Linked Data
Introduction to Open Data & Linked DataIntroduction to Open Data & Linked Data
Introduction to Open Data & Linked Data
 
Time Travelling with Open Data
Time Travelling with Open DataTime Travelling with Open Data
Time Travelling with Open Data
 
Ignite for Good: Why I Love Open Data and You Should Too
Ignite for Good: Why I Love Open Data and You Should TooIgnite for Good: Why I Love Open Data and You Should Too
Ignite for Good: Why I Love Open Data and You Should Too
 
Oil and Water: When Data Licences Don't Mix
Oil and Water: When Data Licences Don't MixOil and Water: When Data Licences Don't Mix
Oil and Water: When Data Licences Don't Mix
 
Linked Data Patterns
Linked Data PatternsLinked Data Patterns
Linked Data Patterns
 
Digital Grafitti for Digital Cities
Digital Grafitti for Digital CitiesDigital Grafitti for Digital Cities
Digital Grafitti for Digital Cities
 
Layered Data: An Example
Layered Data: An ExampleLayered Data: An Example
Layered Data: An Example
 
Data Foundations for Digital Cities
Data Foundations for Digital CitiesData Foundations for Digital Cities
Data Foundations for Digital Cities
 

Kürzlich hochgeladen

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Kürzlich hochgeladen (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 

SPARQL Tutorial

  • 1. Data Extraction & Exploration with SPARQL & the Talis Platform
  • 2.
  • 3.
  • 4.  
  • 5.
  • 6. #An RDF triple in Turtle syntax <http://purl.org/net/schemas/space/spacecraft/1957-001B> foaf:name “Sputnik 1”.
  • 7. #An SPARQL triple pattern, with a single variable <http://purl.org/net/schemas/space/spacecraft/1957-001B> foaf:name ?name.
  • 8. #All parts of a triple pattern can be variables ?spacecraft foaf:name ?name.
  • 9.  
  • 10. #Matching labels of resources ?subject rdfs:label ?label.
  • 11.  
  • 12. #Combine triples patterns to create a graph pattern ?subject rdfs:label ?label. ?subject rdf:type space:Discipline.
  • 13. #SPARQL is based on Turtle, which allows abbreviations #e.g. predicate-object lists: ?subject rdfs:label ?label; rdf:type space:Discipline.
  • 14.  
  • 15. #Graph patterns allow us to traverse a graph ?spacecraft foaf:name “Sputnik 1”. ?launch space:spacecraft ?launch. ?launch space:launched ?launchdate.
  • 16. #Graph patterns allow us to traverse a graph ?spacecraft foaf:name “Sputnik 1” . ?launch space:spacecraft ?launch . ?launch space:launched ?launchdate .
  • 17.  
  • 18.
  • 19. #Ex. 1 #Associate URIs with prefixes PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> #Example of a SELECT query, retrieving 2 variables #Variables selected MUST be bound in graph pattern SELECT ?subject ?label WHERE { #This is our graph pattern ?subject rdfs:label ?label; rdf:type space:Discipline. }
  • 20. #Ex. 2 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> #Example of a SELECT query, retrieving all variables SELECT * WHERE { ?subject rdfs:label ?label; rdf:type space:Discipline. }
  • 21.
  • 22. #Ex. 3 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?image WHERE { #This pattern must be bound ?spacecraft foaf:name ?name. #Anything in this block doesn't have to be bound OPTIONAL { ?spacecraft foaf:depiction ?image. } }
  • 23.
  • 24. #Ex. 4 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?subject ?displayLabel WHERE { { ?subject foaf:name ?displayLabel. } UNION { ?subject rdfs:label ?displayLabel. } }
  • 25.
  • 26. #Ex.5 #Select the uri and the mass of all the spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. }
  • 27. #Ex. 6 #Select the uri and the mass of all the spacecraft #with highest first PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } #Use an ORDER BY clause to apply a sort. Can be ASC or DESC ORDER BY DESC(?mass)‏
  • 28. #Ex. 7 #Select the uri and the mass of the 10 heaviest spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } #Order by weight descending ORDER BY DESC(?mass)‏ #Limit to first ten results LIMIT 10
  • 29. #Ex. 8 #Select the uri and the mass of the 11-20 th most #heaviest spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: < http://xmlns.com/foaf/0.1/ > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?spacecraft ?mass WHERE { ?spacecraft space:mass ?mass. } ORDER BY DESC(?mass)‏ #Limit to ten results LIMIT 10 #Apply an offset to get next “page” OFFSET 10
  • 30.
  • 31. #Sample data for Sputnik launch <http://purl.org/net/schemas/space/launch/1957-001> rdf:type space:Launch; #Assign a datatype to the literal, to indicate it is #a date space:launched &quot;1957-10-04&quot;^^xsd:date; space:spacecraft <http://purl.org/net/schemas/space/spacecraft/1957-001B> .
  • 32. #Ex. 9 #Select name of spacecraft launched between #1 st Jan 1969 and 1 st Jan 1970 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?launch space:launched ?date; space:spacecraft ?spacecraft. ?spacecraft foaf:name ?name. FILTER (?date > &quot;1969-01-01&quot;^^xsd:date && ?date < &quot;1970-01-01&quot;^^xsd:date)‏ }
  • 33. #Ex. 10 #Select spacecraft with a mass of less than 90kg PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?spacecraft ?name WHERE { ?spacecraft foaf:name ?name; space:mass ?mass. #Note that we have to cast the data to the right type #As it is not declared in the data FILTER( xsd:double(?mass) < 90.0 )‏ }
  • 34. #Ex. 11 #Select spacecraft with a name like “ollo” PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT ?name WHERE { ?spacecraft foaf:name ?name. FILTER( regex(?name, “ollo”, “i” ) )‏ }
  • 35.
  • 36.
  • 37. #Ex. 12 #Select list of agencies associated with spacecraft PREFIX space: <http://purl.org/net/schemas/space/> PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?agency WHERE { ?spacecraft space:agency ?agency. }
  • 38.
  • 39.
  • 40. #Ex. 13 #Was there a launch on 16 th July 1969? PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> ASK WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. }
  • 41. DESCRIBE Generate an RDF description of a resource(s)‏
  • 42. #Ex. 14 #Describe launch(es) that occurred on 16 th July 1969 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?launch WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. }
  • 43. #Ex. 15 #Describe spacecraft launched on 16 th July 1969 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> DESCRIBE ?spacecraft WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch. }
  • 44. CONSTRUCT Create a custom RDF graph based on query criteria Can be used to transform RDF data
  • 45. #Ex. 16 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> CONSTRUCT { ?spacecraft foaf:name ?name; space:agency ?agency; space:mass ?mass. } WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch; foaf:name ?name; space:agency ?agency; space:mass ?mass. }
  • 46. SELECT SQL style result set retrieval
  • 47. #Ex. 17 PREFIX space: <http://purl.org/net/schemas/space/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?agency ?mass WHERE { ?launch space:launched &quot;1969-07-16&quot;^^xsd:date. ?spacecraft space:launch ?launch; foaf:name ?name; space:agency ?agency; space:mass ?mass. }
  • 48.