 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. www.deri.org SPARQL Query Language for RDF presented by Cristina Feier.

Slides:



Advertisements
Similar presentations
SPARQL Query Language for RDF
Advertisements

XPointer and HTTP Range A possible design for a scalable and extensible RDF Data Access protocol. Bryan Thompson Presented to the RDF Data Access.
XPointer and HTTP Range A possible design for a scalable and extensible RDF Data Access protocol. Bryan Thompson draft Presented to the RDF.
1 SPARQL: A query language for RDF Matthew Yau
Alexandra Cristea & Matthew Yau 1.
CH-4 Ontologies, Querying and Data Integration. Introduction to RDF(S) RDF stands for Resource Description Framework. RDF is a standard for describing.
RDF Schemata (with apologies to the W3C, the plural is not ‘schemas’) CSCI 7818 – Web Technologies 14 November 2001 Van Lepthien.
The Semantic Web – WEEK 4: RDF
SPARQL- A QUERY LANGUAGE FOR RDF( S ) Fred Freitas - CIn/UFPE - Brazil.
Introduction to RDF Based on tutorial at
RDFa: Embedding RDF Knowledge in HTML Some content from a presentation by Ivan Herman of the W3c, Introduction to RDFa, given at the 2011 Semantic Technologies.
ESDSWG2011 – Semantic Web session Semantic Web Sub-group Session ESDSWG 2011 Meeting – Semantic Web sub-group session Wednesday, November 2, 2011 Norfolk,
RDF Tutorial.
Semantic Web Introduction
JENA –A SEMANTIC WEB TOOL by Ranjani Sankaran & krishna Priyanka Chebrolu.
A Visual Approach to Semantic Query Design Using a Web-Based Graphical Query Designer Paul R. Smart, Alistair Russell, Dave Braines, Yannis Kalfoglou,,
© Copyright IBM Corporation 2014 Getting started with Rational Engineering Lifecycle Manager queries Andy Lapping – Technical sales and solutions Joanne.
Jena Sparql 4/11/2017.
Information Systems & Semantic Web University of Koblenz ▪ Landau, Germany Semantic Web - Query Languages – Steffen Staab
SPARQL RDF Query.
SPARQL Nikhil Rajguru. W3C Standards SPARQL Query Language for RDF SPARQL 1.1 Update SPARQL 1.1 Protocol SPARQL 1.1 Graph Store HTTP Protocol SPARQL.
Speaker: Daniel Vila-Suero The SPARQL Query Language Raúl García-Castro, Óscar Corcho, Daniel Vila-Suero Ontology Engineering Group Universidad.
Chapter 3 Querying RDF stores with SPARQL. TL;DR We will want to query large RDF datasets, e.g. LOD SPARQL is the SQL of RDF SPARQL is a language to query.
SPARQL for Querying PML Data Jitin Arora. Overview SPARQL: Query Language for RDF Graphs W3C Recommendation since 15 January 2008 Outline: Basic Concepts.
A division of Publishing Technology Facet Building Web Pages With SPARQL SWIG-UK Event, HP Labs November 23 rd 2007 Leigh Dodds Chief Technology Officer,
Semantic Web Presented by: Edward Cheng Wayne Choi Tony Deng Peter Kuc-Pittet Anita Yong.
Semantic Web Andrejs Lesovskis. Publishing on the Web Making information available without knowing the eventual use; reuse, collaboration; reproduction.
Chapter 3A Semantic Web Primer 1 Chapter 3 Querying the Semantic Web Grigoris Antoniou Paul Groth Frank van Harmelen Rinke Hoekstra.
Logics for Data and Knowledge Representation SPARQL Protocol and RDF Query Language (SPARQL) Feroz Farazi.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Publishing data on the Web (with.
RDF: Concepts and Abstract Syntax W3C Recommendation 10 February Michael Felderer Digital Enterprise.
1 Ontology Query and Reasoning Payam Barnaghi Institute for Communication Systems (ICS) Faculty of Engineering and Physical Sciences University of Surrey.
RDF (Resource Description Framework) Why?. XML XML is a metalanguage that allows users to define markup XML separates content and structure from formatting.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
Master Informatique 1 Semantic Technologies Part 5SPARQL Werner Nutt.
Introduction to SPARQL. Acknowledgements This presentation is based on the W3C Candidate Recommendation “SPARQL Query Language for RDF” from
SPARQL Semantic Web - Spring 2008 Computer Engineering Department Sharif University of Technology.
The Semantic Web Web Science Systems Development Spring 2015.
Chapter 3 Querying RDF stores with SPARQL. Why an RDF Query Language? Why not use an XML query language? XML at a lower level of abstraction than RDF.
Semantic web course – Computer Engineering Department – Sharif Univ. of Technology – Fall Querying on the Web: XQuery, RDQL, SparQL Semantic Web.
SPARQL W3C Simple Protocol And RDF Query Language
Ontology Query. What is an Ontology Ontologies resemble faceted taxonomies but use richer semantic relationships among terms and attributes, as well as.
SPARQL AN RDF Query Language. SPARQL SPARQL is a recursive acronym for SPARQL Protocol And Rdf Query Language SPARQL is the SQL for RDF Example: PREFIX.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
1 SPARQL A. Emrah Sanön. 2 RDF RDF is quite committed to Semantic Web. Data model Serialization by means of XML Formal semantics Still something is missing!
Practical RDF Chapter 10. Querying RDF: RDF as Data Shelley Powers, O’Reilly SNU IDB Lab. Hyewon Lim.
User Profiling using Semantic Web Group members: Ashwin Somaiah Asha Stephen Charlie Sudharshan Reddy.
1 Typing XQuery WANG Zhen (Selina) Something about the Internship Group Name: PROTHEO, Inria, France Research: Rewriting and strategies, Constraints,
Practical RDF Ch.10 Querying RDF: RDF as Data Taewhi Lee SNU OOPSLA Lab. Shelley Powers, O’Reilly August 27, 2004.
Ontology based e-Real Estate Agency Information System By Moein Mehrolhasani Bijan Zamanian cmpe 588.
05/01/2016 SPARQL SPARQL Protocol and RDF Query Language S. Garlatti.
Doc.: IEEE /0169r0 Submission Joe Kwak (InterDigital) Slide 1 November 2010 Slide 1 Overview of Resource Description Framework (RFD/XML) Date:
Chapter 3 Querying RDF stores with SPARQL
Oracle Data Integrator User Functions, Variables and Advanced Mappings
Raluca Paiu1 Semantic Web Search By Raluca PAIU
An Effective SPARQL Support over Relational Database Jing Lu, Feng Cao, Li Ma, Yong Yu, Yue Pan SWDB-ODBIS 2007 SNU IDB Lab. Hyewon Lim July 30 th, 2009.
CC L A W EB DE D ATOS P RIMAVERA 2015 Lecture 7: SPARQL (1.0) Aidan Hogan
Steven Perry Dave Vieglais. W a s a b i Web Applications for the Semantic Architecture of Biodiversity Informatics Overview WASABI is a framework for.
Lecture 8: RDF& SPARQL Dr. Taysir Hassan A. Soliman December 13, 2015 INF411 Information Engineering Information Systems Dept. Faculty of Computers & Information.
Semantic Web in Depth SPARQL Protocol and RDF Query Language Dr Nicholas Gibbins –
Vincenzo Maltese, Fausto Giunchiglia University of Trento
CC La Web de Datos Primavera 2017 Lecture 7: SPARQL [i]
Keyword Search over RDF Graphs
Introduction to SPARQL
SPARQL SPARQL Protocol and RDF Query Language
SPARQL: A query language for RDF
Jena Sparql (for Mac) 9/22/2018.
Logics for Data and Knowledge Representation
CC La Web de Datos Primavera 2016 Lecture 7: SPARQL (1.0)
Logics for Data and Knowledge Representation
Presentation transcript:

 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier

Agenda Introduction Graph Patterns Query Execution and Ordering Query Forms Testing Values SPARQL Support

Introduction RDF – flexible and extensible way to represent information about WWW resources SPARQL - query language for getting information from RDF graphs. It provides facilities to: –extract information in the form of URIs, blank nodes, plain and typed literals. –extract RDF subgraphs. –construct new RDF graphs based on information in the queried graphs matching graph patterns variables – global scope; indicated by ‘?‘ or ‘$‘ query terms – based on Turtle syntax terms delimited by "<>" are relative URI references data description format - Turtle

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Basic Graph Pattern Set of Triple Patterns –Triple Pattern – similar to an RDF Triple (subject, predicate, object), but any component can be a query variable; literal subjects are allowed –Matching a triple pattern to a graph: bindings between variables and RDF Terms Matching of Basic Graph Patterns –A Pattern Solution of Graph Pattern GP on graph G is any substitution S such that S(GP) is a subgraph of G. xv rdf:typerdf:Property rdf:type rdf:type rdf:Property SELECT ?x ?v WHERE { ?x ?x ?v } ?book dc:title ?title

Basic Graph Pattern - Multiple Matches PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name. ?x foaf:mbox ?mbox foaf:. _:a foaf:name "Johnny Lee Outlaw". _:a foaf:mbox. _:b foaf:name "Peter Goodguy". _:b foaf:mbox. namembox "Johnny Lee Outlaw" "Peter Goodguy" Group Graph Pattern (set of graph patterns) also! Data Query Query Result

Basic Graph Pattern - Blank Nodes PREFIX foaf: SELECT ?x ?name WHERE { ?x foaf:name ?name foaf:. _:a foaf:name "Alice". _:b foaf:name "Bob". xname _:c“Alice“ _:d“Bob” Data Query Query Result

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Group Pattern PREFIX foaf: SELECT ?name ?mbox WHERE { ?x foaf:name ?name. ?x foaf:mbox ?mbox } PREFIX foaf: SELECT ?name ?mbox WHERE { {?x foaf:name ?name; foaf:mbox ?mbox } }

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Value Constraints PREFIX dc: PREFIX ns: SELECT ?title ?price WHERE { ?x ns:price ?price. FILTER ?price < 30. ?x dc:title ?title. ns:. :book1 dc:title "SPARQL Tutorial". :book1 ns:price 42. :book2 dc:title "The Semantic Web". :book2 ns:price 23. titleprice "The Semantic Web"23 Data Query Query Result

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Optional graph patterns PREFIX dc: PREFIX ns: SELECT ?title ?price WHERE { ?x dc:title ?title. OPTIONAL { ?x ns:price ?price. FILTER ?price < 30 ns:. :book1 dc:title "SPARQL Tutorial". :book1 ns:price 42. :book2 dc:title "The Semantic Web". :book2 ns:price 23. titleprice “SPARQL Tutorial“ "The Semantic Web"23 Data Query Query Result

Multiple Optional Blocks PREFIX foaf: SELECT ?name ?mbox ?hpage WHERE { ?x foaf:name ?name. OPTIONAL { ?x foaf:mbox ?mbox }. OPTIONAL { ?x foaf:homepage ?hpage } rdfs:. _:a foaf:name "Alice". _:a foaf:homepage. _:b foaf:name "Bob". _:b foaf:mbox. Data Query Query Result nameMboxhpage “Alice“ “Bob“

Graph Patterns Basic Graph Patterns – set of Triple Patterns Group Patterns - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Patterns – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

Alternative Graph Patterns PREFIX dc10: PREFIX dc11: SELECT ?x ?y WHERE { { ?book dc10:title ?x } UNION { ?book dc11:title ?y } dc11:. _:a dc10:title "SPARQL Query Language Tutorial". _:b dc11:title "SPARQL Protocol Tutorial". _:c dc10:title "SPARQL". _:c dc11:title "SPARQL (updated)". Data Query Query Result xy "SPARQL (updated)" "SPARQL Protocol Tutorial" "SPARQL" "SPARQL Query Language Tutorial"

Graph Patterns Basic Graph Pattern – set of Triple Patterns Group Pattern - a set of graph patterns must all match Value Constraints - restrict RDF terms in a solution Optional Graph Patterns.- additional patterns may extend the solution Alternative Graph Pattern – two or more possible patterns are tried Patterns on Named Graphs - patterns are matched against named graphs

RDF Dataset RDF data stores may hold multiple RDF graphs: –record information about each graph –queries that involve information from more than one graph –RDF Dataset in SPARQL terminology –the background graph, which does not have a name, and zero or more named graphs, identified by URI reference the relationship between named and background graphs: –(i) to have information in the background graph that includes provenance information about the named graphs (the application is not directly trusting the information in the named graphs ) –(ii) to include the information in the named graphs in the background graph as well.

RDF Dataset- The Relationship between Named and Background Graphs (I) # Background dc:. dc:publisher "Bob". dc:publisher "Alice". # Graph: foaf:. _:a foaf:name "Bob". _:a foaf:mbox. # Graph: foaf:. _:a foaf:name "Alice". _:a foaf:mbox.

RDF Dataset- The Relationship between Named and Background Graphs (II) # Background foaf:. _:x foaf:name "Bob". _:x foaf:mbox. _:y foaf:name "Alice". _:y foaf:mbox. # Graph: foaf:. _:a foaf:name "Bob". _:a foaf:mbox. # Graph: foaf:. _:a foaf:name "Alice". _:a foaf:mbox.

Querying the Dataset # Graph: rdfs:. _:a foaf:name "Alice". _:a foaf:mbox. _:a foaf:knows _:b. _:b rdfs:seeAlso. rdf:type foaf:PersonalProfileDocument. _:b foaf:name "Bob". _:b foaf:mbox. _:b foaf:age 32. # Graph: rdfs:. _:1 foaf:mbox. _:1 rdfs:seeAlso. _:1 foaf:age 35. rdf:type foaf:PersonalProfileDocument.

Querying the Dataset - Accessing Graph Labels PREFIX foaf: SELECT ?src ?bobAge WHERE { GRAPH ?src { ?x foaf:mbox. ?x foaf:age ?bobAge } } srcbobAge 32 35

Querying the Dataset - Restricting by Graph Label PREFIX foaf: PREFIX data: SELECT ?age WHERE { GRAPH data:bobFoaf { ?x foaf:mbox. ?x foaf:age ?age } } age 35

Querying the Dataset - Restricting via Query Pattern PREFIX data: PREFIX foaf: PREFIX rdf: PREFIX rdfs: SELECT ?mbox ?age ?ppd WHERE { GRAPH data:aliceFoaf { ?alice foaf:mbox ; foaf:knows ?whom. ?whom foaf:mbox ?mbox ; rdfs:seeAlso ?ppd. ?ppd a foaf:PersonalProfileDocument. }. GRAPH ?ppd { ?w foaf:mbox ?mbox ; foaf:age ?age } } mboxageppd 35

Query Execution and Ordering Optional-1: an optional pattern that has a common variable with a(more) basic graph pattern(s) must be executed after the basic graph pattern(s) Optional-2: there can't be two optionals with a common variable, if that variable does not occur in a basic graph pattern as well Constraint: constraints are evaluated after variables are assigned values

Query forms: –SELECT returns all, or a subset of the variables bound in a query pattern match formats : XML or RDF/XML –CONSTRUCT returns an RDF graph constructed by substituting variables in a set of triple templates –DESCRIBE returns an RDF graph that describes the resources found. –ASK returns whether a query pattern matches or not.

CONSTRUCT foaf:. _:a foaf:name "Alice". _:a vcard:. vcard:FN "Alice". PREFIX foaf: PREFIX vcard: CONSTRUCT { vcard:FN ?name } WHERE { ?x foaf:name ?name } #extracting a whole graph from the target RDF dataset CONSTRUCT { ?s ?p ?o } WHERE { GRAPH { ?s ?p ?o }. }

CONSTRUCT Examples(II) PREFIX dc: PREFIX app: CONSTRUCT { ?s ?p ?o } WHERE { GRAPH ?g { ?s ?p ?o }. { ?g dc:publisher }. { ?g dc:date ?date }. FILTER app:myDate(?date) > " T00:00:00Z"^^xsd:dateTime. } accesing a graph conditional on other information contained in the metadata about named graphs in the dataset

DESCRIBE PREFIX ent: DESCRIBE ?x WHERE { ?x ent:employeeId "1234" myOrg:. _:a myOrg:employeeId "1234" ; foaf:mbox_sha1sum "ABCD1234" ; vcard:N [ vcard:Family "Smith" ; vcard:Given "John" ]. foaf:mbox_sha1sum rdf:type owl:InverseFunctionalProperty.

rdfs:. _:a foaf:name "Alice". _:a foaf:homepage. _:b foaf:name "Bob". _:b foaf:mbox. PREFIX foaf: ASK { ?x foaf:name "Alice" }.

Testing Values Named functions and syntactically constructed operations: –operands: subset of XML Schema DataTypes {xsd:string, xsd:decimal, xsd:double, xsd:dateTime} and types derived from xsd:decimal. Subset of XPath functions and operators –Operands: xs:string, xs:double, xs:float, xs:decimal, xs:integer, xs:dateTime –additional operators: sop:RDFterm-equal, sop:bound, sop:isURI, sop:isBlank, sop:isLiteral, sop:str, sop:lang, sop:datatype, sop:logical-or, sop:logical-and Type Promotion : xs:double, xs:float, xs:decimal –each of the numeric types is promoted to any type higher in the above list when used as an argument to function expecting that higher type.

Support for SPARQL SPARQL and Jena –module called ARQ that implements SPARQL; also parses queries expressed in RDQL or its own internal language. –not yet part of the standard Jena distribution; availbale from either Jena‘s CVS repository or as a self-contained download Twinkle –simple Java interface that wraps the ARQ SPARQL Processor library (the add-on to Jena). Redland –set of free software packages that provide support for RDF, including querying with RDQL and SPARQL using the Rasqal RDF Query Library..