1 SPARQL A. Emrah Sanön. 2 RDF RDF is quite committed to Semantic Web. Data model Serialization by...
-
Upload
sheila-lucas -
Category
Documents
-
view
228 -
download
3
Transcript of 1 SPARQL A. Emrah Sanön. 2 RDF RDF is quite committed to Semantic Web. Data model Serialization by...
![Page 1: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/1.jpg)
1
SPARQL
A. Emrah Sanön
![Page 2: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/2.jpg)
2
RDF
RDF is quite committed to Semantic Web. Data model Serialization by means of XML Formal semantics
Still something is missing! A standard query language. A way for the queries and their respective results
to be transported between applications / services.
![Page 3: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/3.jpg)
3
…result
SPARQL
![Page 4: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/4.jpg)
4
What is SPARQL
Simple Protocol and RDF Query Language Sparkle /'spär-k&l/ A Protocol A standard RDF Query Language (QL)
![Page 5: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/5.jpg)
5
SPARQL as a Protocol
GET /sparql/?query=EncodedQuery&default-graph-uri=http://my.example/publishers&named-graph-uri=http://my.example/bob&named-graph-uri=http://my.example/aliceHTTP/1.1Host: my.exampleUser-agent: sparql-client/0.1
![Page 6: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/6.jpg)
6
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 for that goal.
![Page 7: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/7.jpg)
7
SPARQL Protocol (1)
WSDL description file: 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)
![Page 8: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/8.jpg)
8
WSDL Description file
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>
![Page 9: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/9.jpg)
9
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.
![Page 10: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/10.jpg)
10
SPARQL Protocol Examples
Examples after we cover SPARQL Query Language for RDF.
![Page 11: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/11.jpg)
11
SPARQL Query Language
A standard query language in the form of expressive query against the RDF data model…
Data access language Graph patterns Powerful than XML queries in some aspects
![Page 12: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/12.jpg)
12
SPARQL Query Language (1)
SQL: Internals of DB (tables, fields, data, meaning) Impossible to query databases on the
WILD WILD WEB. So, what does SPARQL propose?
URIs. Querying databases globally. Combining data globally. Value of data grows exponentially with the ways
you combine it.
![Page 13: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/13.jpg)
13
The Wild Wild Web
SQL SPARQL
XML
![Page 14: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/14.jpg)
14
SPARQL Query Language (2)
Data structure definitions are being developed worldwide in a distributed manner.
Common ontologies (Dublin Core, Foaf, DOAP, etc.)
A database publishes the ontologies it exports to
An application queries it using those ontologies.
![Page 15: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/15.jpg)
15
Power of SPARQL Illustrated
Ask fotograf.com if it has a picture which matches some constraints such as title, date, size, and some other tag…
Then ask google for URLs in relation to the tag we specified.
And turn the results of these two uncoordinated data as an RSS feed on your site.
All this in just two-three SPARQL queries.
![Page 16: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/16.jpg)
16
Power of SPARQL (2)
Ask music cds of price less than 10 You can run this query against
hepsiburada.com, amazon, e-bay, gittigidiyor.com or any other seller on earth who has a website and a database.
No seller needs to change their databases. Seller needs: Conversion layer between
ontologies and database. Client needs: connectivity framework (like
JDBC) for java.
![Page 17: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/17.jpg)
17
Power of SPARQL (2) Imp.
PREFIX dc: <http://purl.org/dc/elements/1.1/> PREFIX ns: <http://example.org/ns#>
SELECT ?title ?price WHERE {
?x ns:price ?price . FILTER (?price < 10) . ?x dc:title ?title . }
![Page 18: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/18.jpg)
18
SPARQL Syntax -brief-1
URIs <URI> in < > or @PREFIX prefix: <http://....> prefix:name for full URI
Literals “Literal“ or “Literal”@language
Blank Node _:name or [ ] for a Blank Node used just once
![Page 19: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/19.jpg)
19
SPARQL Syntax -brief-2
Triples and . :x :y :z . :t :q :s .
Common predicate and subject: :x :y :z, :t .which is the same as :x :y :z . :x :y :t .
Common subject: RDF Collections
:x :y ( :z :t :q :s )which is short for many triples (as lists in LISP)
![Page 20: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/20.jpg)
20
A walkthrough example illustrating the power of SPARQL
XML/SQL SPARQL
![Page 21: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/21.jpg)
21
Walkthrough example (1xml)
<Person> <name>Henry Story</name> <mbox>[email protected]</mbox> <knows>
<Person><name>Tim Bray</name>
<mbox>[email protected]</mbox> </Person><Person>
<name>Jonathan Story</name> <mbox>[email protected]</mbox>
</Person> </knows>
</Person>
![Page 22: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/22.jpg)
22
Walkthrough example (1sparql)
[ a :Person;
:name "Henry Story";
:mbox <mailto:[email protected]>; :knows [ a :Person;
:name "Tim Bray"; :mbox <mailto:[email protected] ];
:knows [ a :Person; :name "Jonathan Story"; :mbox <mailto:[email protected]> ];
] .
![Page 23: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/23.jpg)
23
Graph representation
![Page 24: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/24.jpg)
24
Walkthrough example (2)<AddressBook>
<Person> <name>Jonathan Story</name>
<mbox>[email protected]</mbox><address>
<Country>France</Country></address>
</Person> <Person>
<name>Tim Bray</name> <mbox>[email protected]</mbox>
<address><Country>Canada</Country>
</address> </Person>
</AddressBook>
![Page 25: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/25.jpg)
25
[ a :Person; :name "Tim Bray"; :mbox <mailto:[email protected]> :address [ a :Address; :country "Canada"@en ] ].
[ a :Person; :name "Jonathan Story"; :mbox <mailto:[email protected]>
:address [ a :Address; :country "France"@en ]
].
Walkthrough example (2sparql)
![Page 26: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/26.jpg)
26
Graph representation
![Page 27: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/27.jpg)
27
Walkthrough example (2)These graphs can be merged into the
following graph especially if the mbox relation is stated as being inverse functional
![Page 28: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/28.jpg)
28
Graph representation(merged)
![Page 29: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/29.jpg)
29
Walkthrough example (2)"Who does Henry know who lives in Canada,
and what is their e-mail address?"
Can only be answered by aggregating data from both documents.
Can not be done using the XML query languages, which can only work on the surface of the document.
![Page 30: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/30.jpg)
30
Walkthrough example (2sparql)SELECT ?name ?mail WHERE {
[a :Person; :name "Henry Story"; :knows [ :name ?name;
:mbox ?mail; :address [ a :Address;
:country "Canada"@en;
] ] ]. }
![Page 31: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/31.jpg)
31
Walkthrough example (3sparql)Names and websites of contributors to
PlanetRDF
PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ?name ?website
FROM <http://planetrdf.com/bloggers.rdf> WHERE {
?person foaf:weblog ?website ;
foaf:name ?name .
?website a foaf:Document }
![Page 32: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/32.jpg)
32
Protocol Example (1)PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?who ?g ?mbox
FROM <http://my.example/publishers>
FROM NAMED <http://my.example/alice>
FROM NAMED <http://my.example/bob>
WHERE {
?g dc:publisher ?who .
GRAPH ?g { ?x foaf:mbox ?mbox } }
![Page 33: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/33.jpg)
33
Protocol Example (1)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>
![Page 34: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/34.jpg)
34
References
http://www.w3.org/2004/Talks/17Dec-sparql/intro/all.html
http://jena.sourceforge.net/ARQ/Tutorial/ http://blogs.sun.com/roller/page/bblfish http://xmlarmyknife.org/api/rdf/sparql http://xml.com/lpt/a/2005/11/16/introducing-
sparql-querying-semantic-web-tutorial.html http://www.w3.org/2005/Talks/12May-
SPARQL/all.html
![Page 35: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/35.jpg)
35
References (2)
http://www-128.ibm.com/developerworks/xml/library/j-sparql/
http://www.w3.org/TR/rdf-sparql-protocol/ http://www.w3.org/2004/Talks/17Dec-sparql/
intro/ex1.rq http://www.oreillynet.com/pub/wlg/7823
![Page 36: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/36.jpg)
36
Thank you…
For your attendance
and patience
![Page 37: 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!](https://reader036.fdocuments.us/reader036/viewer/2022081519/56649f285503460f94c40255/html5/thumbnails/37.jpg)
37
Any Questions?