SPARQL Query Language for RDF

Slides:



Advertisements
Similar presentations
Chungnam National University DataBase System Lab
Advertisements

Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 Created by Cheryl M. Hughes, Harvard University Extension School Cambridge, MA The Web Wizards Guide.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 9 Using Perl for CGI Programming.
Author: Julia Richards and R. Scott Hawley
1 Copyright © 2013 Elsevier Inc. All rights reserved. Appendix 01.
1 Search and Navigate Web Ontologies Li Ding Tetherless World Constellation Rensselaer Polytechnic Institute Aug 22, 2008.
UNITED NATIONS Shipment Details Report – January 2006.
1 Hyades Command Routing Message flow and data translation.
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.
18 Copyright © 2005, Oracle. All rights reserved. Distributing Modular Applications: Introduction to Web Services.
4 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: Servlets.
8 Copyright © 2005, Oracle. All rights reserved. Creating the Web Tier: JavaServer Pages.
1 RA I Sub-Regional Training Seminar on CLIMAT&CLIMAT TEMP Reporting Casablanca, Morocco, 20 – 22 December 2005 Status of observing programmes in RA I.
UKOLN, University of Bath
1 SPARQL: A query language for RDF Matthew Yau
Dr. Alexandra I. Cristea CS 253: Topics in Database Systems: C3.
Programming Language Concepts
1 NatQuery 3/05 An End-User Perspective On Using NatQuery To Extract Data From ADABAS Presented by Treehouse Software, Inc.
INTERNET PROTOCOLS Class 9 CSCI 6433 David C. Roberts Entire contents copyright 2011, David C. Roberts, all rights reserved.
Introduction to Web Services
Server Access The REST of the Story David Cleary
Web Service Testing RESTful Web Services Snejina Lazarova Dimo Mitev
Written by Liron Blecher
1 The phone in the cloud Utilizing resources hosted anywhere Claes Nilsson.
Service Description: WSDL COMP6017 Topics on Web Services Dr Nicholas Gibbins –
Campaign Overview Mailers Mailing Lists
Yunling Wang VoIP Security COMS 4995 Nov 24, 2008 XCAP The Extensible Markup Language (XML) Configuration Access Protocol (XCAP)
Copyright 2007, Information Builders. Slide 1 Introduction to Web Services Efrem Litwin Director, WebFOCUS Integration Products Information Builders.
Copyright © 2008 Model Driven Solutions EKB User Interface Jim Logan September 2008 Formerly Data Access Technologies.
Basel-ICU-Journal Challenge18/20/ Basel-ICU-Journal Challenge8/20/2014.
4 Oracle Data Integrator First Project – Simple Transformations: One source, one target 3-1.
Alexandra Cristea & Matthew Yau 1.
31242/32549 Advanced Internet Programming Advanced Java Programming
© 2012 National Heart Foundation of Australia. Slide 2.
© 2006 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice Use Case: Populating Business Objects.
Presentation 7 part 2: SOAP & WSDL.
1 An inference engine for the semantic web Naudts Guido Student at the Open University Netherlands.
©Brooks/Cole, 2001 Chapter 12 Derived Types-- Enumerated, Structure and Union.
Chapter 12 Working with Forms Principles of Web Design, 4 th Edition.
Intracellular Compartments and Transport
PSSA Preparation.
Essential Cell Biology
Presenter: James Huang Date: Sept. 29,  HTTP and WWW  Bottle Web Framework  Request Routing  Sending Static Files  Handling HTML  HTTP Errors.
Steffen Staab 1WeST Web Science & Technologies University of Koblenz ▪ Landau, Germany Structured Data on the Web Introduction to.
Introduction Peter Dolog dolog [at] cs [dot] aau [dot] dk Intelligent Web and Information Systems September 9, 2010.
The Semantic Web – WEEK 4: RDF
SPARQL- A QUERY LANGUAGE FOR RDF( S ) Fred Freitas - CIn/UFPE - Brazil.
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
© Copyright IBM Corporation 2014 Getting started with Rational Engineering Lifecycle Manager queries Andy Lapping – Technical sales and solutions Joanne.
Information Systems & Semantic Web University of Koblenz ▪ Landau, Germany Semantic Web - Query Languages – Steffen Staab
 Copyright 2004 Digital Enterprise Research Institute. All rights reserved. SPARQL Query Language for RDF presented by Cristina Feier.
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.
1 Introduction to XML. XML eXtensible implies that users define tag content Markup implies it is a coded document Language implies it is a metalanguage.
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.
SPARQL All slides are adapted from the W3C Recommendation SPARQL Query Language for RDF Web link:
Introduction to SPARQL. Acknowledgements This presentation is based on the W3C Candidate Recommendation “SPARQL Query Language for RDF” from
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.
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!
05/01/2016 SPARQL SPARQL Protocol and RDF Query Language S. Garlatti.
Semantic Web in Depth SPARQL Protocol and RDF Query Language Dr Nicholas Gibbins –
Logics for Data and Knowledge Representation
Presentation transcript:

SPARQL Query Language for RDF 임형준(hyungjun25@cnu.ac.kr) 충남대학교 컴퓨터공학과 데이터베이스 시스템 연구실 2017년 3월 25일 토요일

Contents SPARQL Status SPARQL Overview SPARQL Feature Summary References Appendix

SPARQL Status SPARQL Query Language for RDF SPARQL Protocol for RDF W3C, http://www.w3.org/TR/2007/WD-rdf-sparql-query-20070326/ Published W3C Working Draft 26 March 2007 SPARQL Protocol for RDF W3C, http://www.w3.org/TR/2006/CR-rdf-sparql-protocol-20060406/ Published W3C Candidate Recommendation 6 April 2006 SPARQL Query Results XML Format W3C, http://www.w3.org/TR/2006/CR-rdf-sparql-XMLres-20060406/

SPARQL Overview RDF SPARQL Resource Description Framework Flexible and extensible way to represent information about WWW resources SPARQL SPARQL Protocol And RDF Query Language Query Language + Protocol + XML Results Format Product of the RDF Data Access Working Group A query language for access and query RDF graphs A protocol for issuing queries via HTTP GET, HTTP POST, or SOAP Perfect for mashing up disparate data sources representable as RDF

SPARQL Overview It provides facilities to: Feature 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 Feature 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

Listing 1. SPARQL query to find the URL of a contributor's blog SPARQL Query Example Figure 1. Basic graph structure for a single contributor in bloggers.rdf Find the URL of the blog by the person named Jon Foobar Listing 1. SPARQL query to find the URL of a contributor's blog PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?url FROM <bloggers.rdf> WHERE { ?contributor foaf:name "Jon Foobar" . ?contributor foaf:weblog ?url . } Result “http://foobar.xx/blog”

SPARQL Features Graph Patterns RDF Dataset Result Forms Testing Values Inference Data Virtualization Access Multiple Sources SPARQL Protocol Walkthrough

Graph Patterns 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 ?book dc:title ?title SELECT ?x ?v WHERE { ?x ?x ?v } rdf:type rdf:type rdf:Property x v rdf:type rdf:Property

Graph Pattern - Multiple Matches @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Johnny Lee Outlaw" . _:a foaf:mbox <mailto:jlow@example.com> . _:b foaf:name "Peter Goodguy" . _:b foaf:mbox <mailto:peter@example.org> . Data PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?mbox WHERE { ?x foaf:name ?name . ?x foaf:mbox ?mbox } Query Group Graph Pattern (set of graph patterns) also! name mbox "Johnny Lee Outlaw" <mailto:jlow@example.com> "Peter Goodguy" <mailto:peter@example.org> Query Result

RDF Dataset The RDF data model expresses information as a graph Many RDF data stores hold a multiple RDF graphs There is one graph which does not have a name, called the background graph, and zero or more named graphs, identified by URI reference # Default graph @prefix dc: <http://purl.org/dc/elements/1.1/> . <http://example.org/bob> dc:publisher "Bob" . <http://example.org/alice> dc:publisher "Alice" . # Named graph: http://example.org/bob @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Bob" . _:a foaf:mbox <mailto:bob@oldcorp.example.org> .

Querying the Dataset # Graph: http://example.org/foaf/aliceFoaf @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:a foaf:name "Alice" . _:a foaf:mbox <mailto:alice@work.example> . _:a foaf:knows _:b . _:b foaf:name "Bob" . _:b foaf:mbox <mailto:bob@work.example> . _:b foaf:age 32 . _:b foaf:PersonalProfileDocument <http://example.org/foaf/bobFoaf> . # Graph: http://example.org/foaf/bobFoaf @prefix foaf: <http://xmlns.com/foaf/0.1/> . _:1 foaf:mbox <mailto:bob@work.example> . _:1 foaf:PersonalProfileDocument <http://example.org/foaf/bobFoaf>. _:1 foaf:age 35 .

Accessing Graph Labels PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX data: <http://example.org/foaf/> SELECT ?src ?age WHERE GRAPH ?src { ( ?x foaf:mbox <mailto:bob@work.example> ) ( ?x foaf:age ?age ) } src age <http://example.org/foaf/aliceFoaf> 32 <http://example.org/foaf/bobFoaf> 35 PREFIX foaf: <http://xmlns.com/foaf/0.1/> PREFIX data: <http://example.org/foaf/> SELECT ?age WHERE GRAPH data:bobFoaf { ( ?x foaf:mbox <mailto:bob@work.example> ) ( ?x foaf:age ?age ) } age 35

Result Forms SPARQL has a number of query forms for returning results 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

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 XQuery 1.0 and XPath 2.0 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

Inference An RDF graph may be backed by inference OWL, RDFS, application, rules PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT ?type WHERE { ?x rdf:type ?type . } :x rdf:type :C . :C rdfs:subClassOf :D . -------- | type | ===== | :C | | :D |

Data Virtualization SPARQL as integrator SPARQL to SQL Data remains where it is Existing applications untouched Data appears as RDF, query to native form SPARQL to SQL Direct mapping of tables Semi-automatic generation of mapping SquirrelRDF (also does LDAP) Modelled: D2RQ High-quality mapping, manually developed

Federated Query Single Point of Access Inputs: Service Description Information Directory Request Outputs: Unified results Query Broker SPARQL => SPARQL Doc DB Corp LDAP RDF SPARQL Query

Access Multiple Sources “Find the name and email addresses of authors of a paper” Query tech reports first, then go to LDAP for more information. SQL database; LDAP server PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ldap: <http://ldap.hp.com/people#> PREFIX foaf: SELECT ?name ?email { ?doc dc:title ?title . FILTER regex(?title, “SPARQL”) . ?doc dc:creator ?reseacher . ?researcher ldap:email ?email . ?researcher ldap:name ?name }

Access Multiple Sources “Find the reports written by the person with email address andy.seaborne@hp.com Go to LDAP first, then the reports database PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ldap: <http://ldap.hp.com/people#> PREFIX foaf: SELECT ?name { ?doc dc:title ?title . ?doc dc:creator ?reseacher . ?researcher ldap:email <mailto:andy.seaborne@hp.com> . }

SPARQL as a Protocol A way of communication between parties that run SPARQL queries Defining a way of invoking the service Bindings of a transport protocol

SPARQL Protocol(1) WSDL description file: HTTP binding: SOAP binding: Description of the protocol Not for human understanding HTTP binding: Specify how to encode SPARQL queries in URLs with GET and POST methods SOAP binding: Specify the SOAP message format (XML message exchange format for queries)

SPARQL Protocol(2) Interface SparqlQuery Only one operation: query For transferring string query Data types: via XML schema Bindings: HTTP / SOAP binding for invokable operations A service must support SparqlQuery interface Support the bindings as described in the WSDL

HTTP Binding Example HTTP Binding Get methods GET /sparql/?query=EncodedQuery &default-graph-uri= http://my.example/publishers &named-graph-uri=http://my.example/bob &named-graph-uri=http://my.example/alice HTTP/1.1Host: my.example User-agent: sparql-client/0.1

WSDL Description File Example WSDL description file: (HTTP binding part) <binding name="queryHttp" interface="tns:SparqlQuery“ … > <fault name="MalformedQuery" whttp:zode="400"/> <!-- the GET binding for query operation --> <operation ref="tns:query" whttp:method="GET" whttp:inputSerialization=“…" /> </binding>

SOAP Binding Example HTTP/1.1 200 OK Date: Wed, 27 Dec 2005 12:48:25 GMT Server: Apache/1.3.29 (Unix) PHP/4.3.4 DAV/1.0.3 Connection: closeContent-Type: application/sparql-results+xml; charset=utf-8 <?xml version="1.0"?> <sparql xmlns=“…"> … … </sparql>

Walkthrough Example(1) XML File <Person> <name>Henry Story</name> <mbox>hs@bblfish.net</mbox> <knows> <Person> <name>Tim Bray</name> <mbox>tb@eg.com</mbox> </Person> <Person> <name>Jonathan Story</name> <mbox>js@eg.edu</mbox> </Person> </knows> </Person>

Walkthrough Example(1) SPARQL [ a :Person; :name "Henry Story"; :mbox <mailto:hs@insead.edu>; :knows [ a :Person; :name "Tim Bray"; :mbox <mailto:tb@eg.com ]; :knows [ a :Person; :name "Jonathan Story"; :mbox <mailto:js@eg.edu> ]; ] .

Graph Representation

Walkthrough Example(2) XML File <AddressBook> <Person> <name>Jonathan Story</name> <mbox>Jonathan.Story@eg.edu</mbox> <address> <Country>France</Country> </address> </Person> <Person> <name>Tim Bray</name> <mbox>Tim.Bray@eg.Com</mbox> <address> <Country>Canada</Country> </AddressBook>

Walkthrough Example(2) SPARQL [ a :Person; :name "Tim Bray"; :mbox <mailto:Tim.Bray@eg.com> :address [ a :Address; :country "Canada"@en ] ]. :name "Jonathan Story"; :mbox <mailto:Jonathan.Story@eg.edu> :country "France"@en ]

Graph Representation

Merge Graph Representation

Summary SPARQL (SPARQL Protocol And RDF Query Language) is a query language for getting information from RDF graphs It provides facilities to: Extract information in the form of URIs, bNodes, Plain and typed literals Extract RDF subgraphs Construct new RDF graphs based on information in the queried graphs

References W3C, “SPARQL Query Language for RDF” http://www.w3.org/TR/2007/WD-rdf-sparql-query-20070326/, 26, March. 2007 IBM Developerworks, “Search RDF data with SPARQL” http://www-128.ibm.com/developerworks/java/library/j-sparql/, 10, May. 2005 Oreillynet, “SPARQL: Web 2.0 Meet the Semantic Web” http://www.oreillynet.com/xml/blog/2005/09/sparql_web_20_meet_the_semanti.html, 16, September. 2005

Appendix-01 SPARQL Update Future HP proposal to W3C INSERT { book:newBook dc:title “More about SPARQL” . book:newBook dc:creator [ foaf:mbox <mailto:alex@example> ; foaf:name “Alex Author” ] } DELETE { ?book dc:title ?title ; dc:creator ?c } WHERE { ?book dc:title ?title ; dc:creator ?c FILTER regex(?title, “first edition”) }

Appendix-02 SPARQL: Web 2.0 Meet the Semantic Web RDF is pretty foundational to the Semantic Web Most Web 2.0 applications and services involve a REST protocol or interface REST offers a standard set of operations GET, PUT, POST, DELETE No standard way to execute an arbitrary query A Web 2.0 app or service’s dataset Get back a representation of that resource

Appendix-02 SW and Web 2.0 need a data access protocol Using WSDL 2.0, SPARQL Protocol for RDF describes a very simple web service with one operation, query Available with both HTTP and SOAP bindings The way you send SPARQL queries to other sites The way you get back the results Imagine having one query language, and one client, which lets you arbitrarily slice the data of Web 2.0 sites, all FOAF files, all of the RSS 1.0 feeds A good SPARQL client implementation in Javascript, along with some conventions for building and moving queries around in an AJAX-friendly way SPARQL over AJAX just by itself is so cool it gives me a headache!