sparql n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
SPARQL PowerPoint Presentation
Download Presentation
SPARQL

Loading in 2 Seconds...

play fullscreen
1 / 37
eugenia

SPARQL - PowerPoint PPT Presentation

0 Views
Download Presentation
SPARQL
An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  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! • A standard query language. • A way for the queries and their respective results to be transported between applications / services.

  3. …result SPARQL

  4. What is SPARQL • Simple Protocol and RDF Query Language • Sparkle /'spär-k&l/ • A Protocol • A standard RDF Query Language (QL)

  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

  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.

  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)

  8. WSDL Descriptionfile • 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>

  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.

  10. SPARQL Protocol Examples • Examples after we cover SPARQL Query Language for RDF.

  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

  12. SPARQL Query Language (1) • SQL: • Internals of DB (tables, fields, data, meaning) • Impossible to query databases on the WILDWILDWEB. • So, what does SPARQL propose? • URIs. • Querying databases globally. • Combining data globally. • Value of data grows exponentially with the ways you combine it.

  13. The Wild Wild Web SQL SPARQL XML

  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.

  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.

  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.

  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 . }

  18. SPARQL Syntax -brief-1 • URIs • <URI> in < > • or@PREFIXprefix:<http://....> • prefix:name for full URI • Literals • “Literal“ or “Literal”@language • Blank Node • _:name or[] for a Blank Node used just once

  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)

  20. A walkthrough example illustrating the power of SPARQL XML/SQL SPARQL

  21. Walkthrough example (1xml) <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>

  22. Walkthrough example (1sparql) [ 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> ]; ] .

  23. Graph representation

  24. Walkthrough example (2) <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> </address> </Person> </AddressBook>

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

  26. Graph representation

  27. Walkthrough example (2) These graphs can be mergedinto the following graph especially if the mbox relation is stated as being inverse functional

  28. Graph representation(merged)

  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.

  30. Walkthrough example (2sparql) SELECT ?name ?mail WHERE { [a :Person; :name "Henry Story"; :knows [ :name ?name; :mbox ?mail; :address [ a :Address;:country "Canada"@en; ] ] ]. }

  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 }

  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 } }

  33. Protocol Example (1) HTTP/1.1 200 OK Date: Wed, 27Dec 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>

  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

  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

  36. Thank you… For your attendance and patience

  37. Any Questions?