Consuming Linked Data SemTech2010


Published on

This is a one hour talk introducing Linked Data and how Linked Data can be consumed by humans and by machines through SPARQL

Published in: Technology, Education

Consuming Linked Data SemTech2010

  1. 1. Consuming Linked Data<br />Juan F. Sequeda<br />Department of Computer Science<br />University of Texas at Austin<br />SemTech 2010<br />
  2. 2. How many people are familiar with<br />RDF<br />SPARQL<br />Linked Data<br />Web Architecture (HTTP, etc)<br />
  3. 3. History<br />Linked Data Design Issues by TimBL July 2006<br />Linked Open Data Project WWW2007<br />First LOD Cloud May 2007<br />1st Linked Data on the Web Workshop WWW2008<br />1stTriplification Challenge 2008<br />How to Publish Linked Data Tutorial ISWC2008<br />BBC publishes Linked Data 2008<br />2nd Linked Data on the Web Workshop WWW2009<br />NY Times announcement SemTech2009 - ISWC09<br />1st Linked Data-a-thon ISWC2009<br />1st How to Consume Linked Data Tutorial ISWC2009<br /> publishes Linked Data 2010<br />2st How to Consume Linked Data Tutorial WWW2010<br />1st International Workshop on Consuming Linked Data COLD2010<br />…<br />
  4. 4. May 2007<br />
  5. 5. Oct 2007<br />
  6. 6. Nov 2007 (1)<br />
  7. 7. Nov 2007 (2)<br />
  8. 8. Feb 2008<br />
  9. 9. Mar 2008<br />
  10. 10. Sept 2008<br />
  11. 11. Mar 2009 (1)<br />
  12. 12. Mar 2009 (2)<br />
  13. 13. July 2009<br />
  14. 14. June 2010<br />YOU GET THE PICTURE<br />ITS BIG and getting BIGGER and<br />BIGGER<br />
  15. 15. Now what can we do with this data?<br />
  16. 16. Let’s consume it!<br />
  17. 17. The Modigliani Test<br />Show me all the locations of all the original paintings of Modigliani<br />Daniel Koller (@dakoller) showed that you can find this with a SPARQL query on DBpedia<br />Thanks Richard MacManus - ReadWriteWeb<br />
  18. 18.
  19. 19. Results of the Modigliani Test<br />AtanasKiryakov from Ontotext<br />Used LDSR – Linked Data Semantic Repository<br />Dbpedia<br />Freebase<br />Geonames<br />UMBEL<br />Wordnet<br />Published April 26, 2010:<br /><br />
  20. 20. SPARQL Query<br />PREFIX fb:<br />PREFIX dbpedia:<br />PREFIX dbp-prop:<br />PREFIX dbp-ont:<br />PREFIX umbel-sc:<br />PREFIX rdf:<br />PREFIX ot:<br />SELECT DISTINCT ?painting_l ?owner_l ?city_fb_con ?city_db_loc ?city_db_cit<br />WHERE <br />{ ?pfb:visual_art.artwork.artistdbpedia:Amedeo_Modigliani ; fb:visual_art.artwork.owners [ fb:visual_art.artwork_owner_relationship.owner ?ow ] ; ot:preferredLabel ?painting_l. ?owot:preferredLabel ?owner_l . OPTIONAL { ?owfb:location.location.containedby [ ot:preferredLabel ?city_fb_con ] } . <br />OPTIONAL { ?owdbp-prop:location ?loc. ?loc rdf:type umbel-sc:City ; ot:preferredLabel ?city_db_loc } <br />OPTIONAL { ?owdbp-ont:city [ ot:preferredLabel ?city_db_cit ] }}<br />
  21. 21.
  22. 22. Let’s start by making sure that we understand what Linked Data is…<br />
  23. 23. Do you SEARCH or do you FIND?<br />
  24. 24. Search for<br />Football Players who went to the University of Texas at Austin, played for the Dallas Cowboys as Cornerback<br />
  25. 25.
  26. 26.
  27. 27.
  28. 28. Why can’t we just FIND it…<br />
  29. 29.
  30. 30.
  31. 31. Guess how I FOUND out?<br />
  32. 32. I’ll tell you how I did NOT find it<br />
  33. 33. Current Web = internet + links + docs<br />
  34. 34. So what is the problem?<br />We aren’t always interested in documents<br />We are interested in THINGS<br />These THINGS might be in documents<br />We can read a HTML document rendered in a browser and find what we are searching for<br />This is hard for computers. <br />Computers have to guess (even though they are pretty good at it)<br />
  35. 35. What do we need to do?<br />Make it easy for computers/software to find THINGS<br />
  36. 36. How can we do that?<br />Besides publishing documents on the web<br />which computers can’t understand easily<br />Let’s publish something that computers can understand<br />
  37. 37. RAW DATA!<br />
  38. 38. But wait… don’t we do that already?<br />
  39. 39. Current Data on the Web<br />Relational Databases<br />APIs<br />XML<br />CSV<br />XLS<br />…<br />Can’t computers and applications already consume that data on the web?<br />
  40. 40. True! But it is all in different formats and data models!<br />
  41. 41. This makes it hard to integrate data<br />
  42. 42. The data in different data sources aren’t linked<br />
  43. 43. For example, how do I know that the Juan Sequeda in Facebook is the same as Juan Sequeda in Twitter<br />
  44. 44. Or if I create a mashup from different services, I have to learn different APIs and I get different formats of data back<br />
  45. 45. Wouldn’t it be great if we had a standard way of publishing data on the Web?<br />
  46. 46. We have a standardized way of publishing documents on the web, right?<br />HTML<br />
  47. 47. Then why can’t we have a standard way of publishing data on the Web?<br />
  48. 48. Good question! And the answer is YES. There is!<br />
  49. 49. Resource Description Framework (RDF)<br />A data model <br />A way to model data<br />i.e. Relational databases use relational data model<br />RDF is a triple data model<br />Labeled Graph<br />Subject, Predicate, Object<br /><Juan> <was born in> <California><br /><California> <is part of> <the USA><br /><Juan> <likes> <the Semantic Web><br />
  50. 50. RDF can be serialized in different ways<br />RDF/XML<br />RDFa (RDF in HTML)<br />N3<br />Turtle<br />JSON<br />
  51. 51. So does that mean that I have to publish my data in RDF now?<br />
  52. 52. You don’t have to… but we would like you to <br />
  53. 53. An example<br />
  54. 54. Document on the Web<br />
  55. 55. Databases back up documents<br />THINGS have PROPERTIES:<br />A Book as a Title, an author, …<br />This is a THING:<br />A book title “Programming the Semantic Web” by Toby Segaran, …<br />
  56. 56. Lets represent the data in RDF<br />Programming the Semantic Web<br />title<br />author<br />book<br />Toby Segaran<br />isbn<br />978-0-596-15381-6<br />publisher<br />name<br />Publisher<br />O’Reilly<br />
  57. 57. Remember that we are on the web<br />Everything on the web is identified by a URI<br />
  58. 58. And now let’s link the data to other data<br />Programming the Semantic Web<br />title<br />author<br />http://…/isbn978<br />Toby Segaran<br />isbn<br />978-0-596-15381-6<br />publisher<br />name<br />http://…/publisher1<br />O’Reilly<br />
  59. 59. And now consider the data from<br />hasReview<br />http://…/review1<br />http://…/isbn978<br />description<br />reviewer<br />Awesome Book<br />http://…/reviewer<br />name<br />Juan Sequeda<br />
  60. 60. Let’s start to link data<br />hasReview<br />http://…/review1<br />http://…/isbn978<br />Programming the Semantic Web<br />title<br />description<br />sameAs<br />hasReviewer<br />Awesome Book<br />author<br />http://…/isbn978<br />Toby Segaran<br />http://…/reviewer<br />name<br />isbn<br />978-0-596-15381-6<br />Juan Sequeda<br />publisher<br />name<br />http://…/publisher1<br />O’Reilly<br />
  61. 61. Juan Sequeda publishes data too<br /><br /><br />livesIn<br />name<br />Juan Sequeda<br />
  62. 62. Let’s link more data<br />hasReview<br />http://…/review1<br />http://…/isbn978<br />description<br />hasReviewer<br />Awesome Book<br />http://…/reviewer<br />name<br />Juan Sequeda<br />sameAs<br /><br /><br />livesIn<br />name<br />Juan Sequeda<br />
  63. 63. And more<br />hasReview<br />http://…/review1<br />http://…/isbn978<br />Programming the Semantic Web<br />title<br />description<br />sameAs<br />hasReviewer<br />Awesome Book<br />author<br />http://…/isbn978<br />Toby Segaran<br />http://…/reviewer<br />name<br />isbn<br />978-0-596-15381-6<br />Juan Sequeda<br />publisher<br />sameAs<br />http://…/publisher1<br />name<br />O’Reilly<br /><br /><br />livesIn<br />name<br />Juan Sequeda<br />
  64. 64. Data on the Web that is in RDF and is linked to other RDF data is LINKED DATA<br />
  65. 65. Linked Data Principles<br />Use URIs as names for things<br />Use HTTP URIs so that people can look up (dereference) those names.<br />When someone looks up a URI, provide useful information.<br />Include links to other URIs so that they can discover more things.<br />
  66. 66. Linked Data makes the web appear as ONEGIANTHUGEGLOBALDATABASE!<br />
  67. 67. I can query a database with SQL. Is there a way to query Linked Data with a query language?<br />
  68. 68. Yes! There is actually a standardize language for that<br />SPARQL<br />
  69. 69. FIND all the reviews on the book “Programming the Semantic Web” by people who live in Austin<br />
  70. 70. hasReview<br />http://…/review1<br />http://…/isbn978<br />Programming the Semantic Web<br />title<br />description<br />sameAs<br />hasReviewer<br />Awesome Book<br />author<br />http://…/isbn978<br />Toby Segaran<br />http://…/reviewer<br />name<br />isbn<br />978-0-596-15381-6<br />Juan Sequeda<br />publisher<br />sameAs<br />name<br />http://…/publisher1<br />O’Reilly<br /><br /><br />livesIn<br />name<br />Juan Sequeda<br />
  71. 71. This looks cool, but let’s be realistic. What is the incentive to publish Linked Data?<br />
  72. 72. What was your incentive to publish an HTML page in 1990?<br />
  73. 73. 1) Share data in documents2) Because you neighbor was doing it<br />
  74. 74. So why should we publish Linked Data in 2010?<br />
  75. 75. 1) Share data as data2) Because you neighbor is doing it<br />
  76. 76. And guess who is starting to publish Linked Data now?<br />
  77. 77. Linked Data Publishers<br />UK Government<br />US Government<br />BBC<br />Open Calais – Thomson Reuters<br />Freebase<br />NY Times<br />Best Buy<br />CNET<br />Dbpedia<br />Are you?<br />
  78. 78. How can I publish Linked Data?<br />
  79. 79. Publishing Linked Data<br />Legacy Data in Relational Databases<br />D2R Server<br />Virtuoso<br />Triplify<br />Ultrawrap<br />CMS<br />Drupal 7<br />Native RDF Stores<br />Databases for RDF (Triple Stores)<br />AllegroGraph, Jena, Sesame, Virtuoso<br />Talis Platform (Linked Data in the Cloud)<br />In HTML with RDFa<br />
  80. 80. Consuming Linked Data by Humans<br />
  81. 81. HTML Browsers<br />
  82. 82. Links to other URIs<br />
  83. 83. <span rel="foaf:interest"><br /><a href="" property="dcterms:title">Database</a>,<br /><a href="" property="dcterms:title">Data Integration</a>,<br /><a href="" property="dcterms:title">Semantic Web</a>,<br /><a href="" property="dcterms:title">Linked Data</a>,<br />etc.</span><br />
  84. 84. HTML Browsers<br />RDF can be serialized in RDFa<br />Have you heard of<br />Yahoo’s Search Monkey<br />Google Rich Snippets?<br />They are consuming RDFa<br />But WHY?<br />
  85. 85. Because there is life beyond ten blue links<br />
  86. 86.
  87. 87. Google and Yahoo are starting to crawl RDFa!<br />The Semantic Web is a reality!<br />
  88. 88. The Reality<br />Yahoo is crawling data that is in RDFa and Microformats under a specific vocabularies <br />FOAF<br />GoodRelations<br />…<br />Google is crawling RDFa and Microformats that use the Google vocabulary<br />
  89. 89. Linked Data Browsers<br />
  90. 90. Linked Data Browsers<br />Not actually separate browsers. Run inside of HTML browsers<br />View the data that is returned after looking up a URI in tabular form<br />(IMO) UI lacks usability<br />
  91. 91.
  92. 92. Linked Data Browsers<br />Tabulator<br /><br />OpenLink<br /><br />ZitgistDataviewr<br /><br />Marbles<br /><br />Explorator<br /><br />
  93. 93. Faceted Browsers<br />
  94. 94.<br />
  95. 95.<br />
  96. 96. On-the-fly Mashups<br />
  97. 97.<br />
  98. 98. What’s next?<br />
  99. 99. Time to create new and innovative ways to interact with Linked Data<br />
  100. 100. This may be one of the Killer Apps that we have all been waiting for<br /><br />
  101. 101. It’s time to partner with HCI community<br />Semantic Web UIs don’t have to be ugly<br />
  102. 102. Consume Linked Data with SPARQL<br />
  103. 103. SPARQL Endpoints<br />Linked Data sources usually provide a SPARQL endpoint for their dataset(s)<br />SPARQL endpoint: SPARQL query processing service that supports the SPARQL protocol*<br />Send your SPARQL query, receive the result<br />*<br />
  104. 104. Where can I find SPARQL Endpoints?<br />Dbpedia:<br />Musicbrainz:<br />U.S. Census:<br />Semantic Crunchbase:<br /><br />
  105. 105. Accessing a SPARQL Endpoint<br />SPARQL endpoints: RESTful Web services<br />Issuing SPARQL queries to a remote SPARQL endpoint is basically an HTTP GET request to the SPARQL endpoint with parameter query<br />GET /sparql?query=PREFIX+rd... HTTP/1.1 Host: dbpedia.orgUser-agent: my-sparql-client/0.1<br />URL-encoded string with the SPARQL query<br />
  106. 106. Query Results Formats<br />SPARQL endpoints usually support different result formats:<br />XML, JSON, plain text (for ASK and SELECT queries)<br />RDF/XML, NTriples, Turtle, N3 (for DESCRIBE and CONSTRUCT queries)<br />
  107. 107. Query Results Formats<br />PREFIX dbp:<br />PREFIX dbpprop:<br />SELECT ?name ?bdayWHERE { <br /> ?pdbp:birthplace <> . <br /> ?pdbpprop:dateOfBirth ?bday . <br /> ?pdbpprop:name ?name .<br />}<br />
  108. 108.
  109. 109.
  110. 110. Query Result Formats<br />Use the ACCEPT header to request the preferred result format:<br />GET /sparql?query=PREFIX+rd... HTTP/1.1 <br />Host:<br />User-agent: my-sparql-client/0.1 <br />Accept: application/sparql-results+json<br />
  111. 111. Query Result Formats<br />As an alternative some SPARQL endpoint implementations (e.g. Joseki) provide an additional parameter out<br />GET /sparql?out=json&query=... HTTP/1.1 <br />Host:<br />User-agent: my-sparql-client/0.1<br />
  112. 112. Accessing a SPARQL Endpoint<br />More convenient: use a library<br />SPARQL JavaScript Library<br /> sparql_calendar_demo_a_sparql.html<br />ARC for PHP<br /><br />RAP – RDF API for PHP<br /><br />
  113. 113. Accessing a SPARQL Endpoint<br />Jena / ARQ (Java)<br /><br />Sesame (Java)<br /><br />SPARQL Wrapper (Python)<br /><br />PySPARQL (Python)<br /><br />
  114. 114. Accessing a SPARQL Endpoint<br />Example with Jena/ARQ<br />import com.hp.hpl.jena.query.*;<br />String service = "..."; // address of the SPARQL endpoint <br />String query = "SELECT ..."; // your SPARQL query <br />QueryExecutione = QueryExecutionFactory.sparqlService(service, query)<br />ResultSet results = e.execSelect(); <br />while ( results.hasNext() ) {<br />QuerySolutions = results.nextSolution(); <br /> // ...<br />} <br />e.close();<br />
  115. 115. Querying a single dataset is quite boring<br />compared to:<br />Issuing SPARQL queries over multiple datasets<br />How can you do this?<br />Issue follow-up queries to different endpoints<br />Querying a central collection of datasets<br />Build store with copies of relevant datasets<br />Use query federation system<br />
  116. 116. Follow-up Queries<br />Idea: issue follow-up queries over other datasets based on results from previous queries<br />Substituting placeholders in query templates<br />
  117. 117. String s1 = ""; <br />String s2 = "";<br />String qTmpl = "SELECT ?c WHERE{ <%s> rdfs:comment ?c }";<br />String q1 = "SELECT ?s WHERE { ..."; <br />QueryExecution e1 = QueryExecutionFactory.sparqlService(s1,q1); <br />ResultSet results1 = e1.execSelect(); <br />while ( results1.hasNext() ) {<br />QuerySolution s1 = results.nextSolution(); <br /> String q2 = String.format( qTmpl, s1.getResource("s"),getURI() );<br />QueryExecution e2= QueryExecutionFactory.sparqlService(s2,q2); <br />ResultSet results2 = e2.execSelect(); <br /> while ( results2.hasNext() ) {<br /> // ... <br /> }<br /> e2.close();<br />}<br />e1.close();<br />Find a list of companies <br />Filtered by some criteria and return DbpediaURIs from them<br />
  118. 118. Follow-up Queries<br />Advantage<br />Queried data is up-to-date<br />Drawbacks<br />Requires the existence of a SPARQL endpoint for each dataset<br />Requires program logic<br />Very inefficient<br />
  119. 119. Querying a Collection of Datasets<br />Idea: Use an existing SPARQL endpoint that provides access to a set of copies of relevant datasets<br />Example:<br />SPARQL endpoint over a majority of datasets from the LOD cloud at:<br /><br /><br />
  120. 120. Querying a Collection of Datasets<br />Advantage:<br />No need for specific program logic<br />Drawbacks:<br />Queried data might be out of date <br />Not all relevant datasets in the collection<br />
  121. 121. Own Store of Dataset Copies<br />Idea: Build your own store with copies of relevant datasets and query it<br />Possible stores:<br />Jena TDB<br />Sesame<br />OpenLink Virtuoso<br />4store<br />AllegroGraph<br />etc.<br />
  122. 122. Populating Your Store<br />Get RDF dumps provided for the datasets<br />(Focused) Crawling<br />ldspider<br />Multithreaded API for focussed crawling<br />Crawling strategies (breath-first, load-balancing)<br />Flexible configuration with callbacks and hooks<br />
  123. 123. Own Store of Dataset Copies<br />Advantages:<br />No need for specific program logic <br />Can include all datasets<br />Independent of the existence, availability, and efficiency of SPARQL endpoints<br />Drawbacks:<br />Requires effort to set up and to operate the store <br />Ideally, data sources provide RDF dumps; if not? <br />How to keep the copies in sync with the originals?<br />Queried data might be out of date<br />
  124. 124. Federated Query Processing<br />Idea: Querying a mediator which distributes sub-queries to relevant sources and integrates the results<br />
  125. 125. Federated Query Processing<br />Instance-based federation<br />Each thing described by only one data source <br />Untypical for the Web of Data<br />Triple-based federation<br />No restrictions <br />Requires more distributed joins<br />Statistics about datasets required (both cases)<br />
  126. 126. Federated Query Processing<br />DARQ (Distributed ARQ)<br /><br />Query engine for federated SPARQL queries<br />Extension of ARQ (query engine for Jena)<br />Last update: June 28, 2006<br />Semantic Web Integrator and Query Engine(SemWIQ)<br /><br />Actively maintained<br />
  127. 127. Federated Query Processing<br />Advantages:<br />No need for specific program logic <br />Queried data is up to date<br />Drawbacks:<br />Requires the existence of a SPARQL endpoint for each dataset<br />Requires effort to set up and configure the mediator<br />
  128. 128. In any case:<br />You have to know the relevant data sources<br />When developing the app using follow-up queries<br />When selecting an existing SPARQL endpoint over a collection of dataset copies<br />When setting up your own store with a collection of dataset copies<br />When configuring your query federation system <br />You restrict yourself to the selected sources<br />
  129. 129. In any case:<br />You have to know the relevant data sources<br />When developing the app using follow-up queries<br />When selecting an existing SPARQL endpoint over a collection of dataset copies<br />When setting up your own store with a collection of dataset copies<br />When configuring your query federation system <br />You restrict yourself to the selected sources<br />There is an alternative: <br />Remember, URIs link to data<br />
  130. 130. Automated Link Traversal<br />Idea: Discover further data by looking up relevant URIs in your application<br />Can be combined with the previous approaches<br />
  131. 131. Link Traversal Based Query Execution<br />Applies the idea of automated link traversal to the execution of SPARQL queries<br />Idea:<br />Intertwine query evaluation with traversal of RDF links<br />Discover data that might contribute to query results during query execution<br />Alternately:<br />Evaluate parts of the query <br />Look up URIs in intermediate solutions<br />
  132. 132. Link Traversal Based Query Execution<br />
  133. 133. Link Traversal Based Query Execution<br />
  134. 134. Link Traversal Based Query Execution<br />
  135. 135. Link Traversal Based Query Execution<br />
  136. 136. Link Traversal Based Query Execution<br />
  137. 137. Link Traversal Based Query Execution<br />
  138. 138. Link Traversal Based Query Execution<br />
  139. 139. Link Traversal Based Query Execution<br />
  140. 140. Link Traversal Based Query Execution<br />
  141. 141. Link Traversal Based Query Execution<br />
  142. 142. Link Traversal Based Query Execution<br />Advantages:<br />No need to know all data sources in advance<br />No need for specific programming logic<br />Queried data is up to date<br />Does not depend on the existence of SPARQL endpoints provided by the data sources<br />Drawbacks:<br />Not as fast as a centralized collection of copies<br />Unsuitable for some queries<br />Results might be incomplete (do we care?)<br />
  143. 143. Implementations<br />Semantic Web Client library (SWClLib) for Java<br /><br />SWIC for Prolog<br /><br />
  144. 144. Implementations<br />SQUIN<br />Provides SWClLib functionality as a Web service<br />Accessible like a SPARQL endpoint<br />Install package: unzip and start<br />Less than 5 mins!<br />Convenient access with SQUIN PHP tools:<br />$s = 'http:// ...'; // address of the SQUIN service <br />$q = new SparqlQuerySock( $s, '... SELECT ...' ); <br />$res = $q->getJsonResult();// or getXmlResult()<br />
  145. 145. Real World Example<br />
  146. 146. Getting Started <br />Finding URIs<br />Finding Additional Data<br />Finding SPARQL Endpoints<br />
  147. 147. What is a Linked Data application<br />Software system that makes use of data on the web from multiple datasets and that benefits from links between the datasets<br />
  148. 148. Characteristics of Linked Data Applications<br /><ul><li>Consume data that is published on the web following the Linked Data principles: an application should be able to request, retrieve and process the accessed data
  149. 149. Discover further information by following the links between different data sources: the fourth principle enables this.
  150. 150. Combine the consumed linked data with data from sources (not necessarily Linked Data)
  151. 151. Expose the combined data back to the web following the Linked Data principles
  152. 152. Offer value to end-users</li></li></ul><li>Examples<br /><br /><br /><br /><br /><br /><br />
  153. 153. Hot Research Topics<br />Interlinking Algorithms<br />Provenance and Trust<br />Dataset Dynamics<br />UI<br />Distributed Query<br />Evaluation<br />“You want a good thesis? IR is based on precision and recall. The minute you add semantics, it is a meaningless feature. Logic is based on soundness and completeness. We don’t want soundness and completeness. We want a few good answers quickly.” – Jim Hendler at WWW2009 during the LOD gathering<br />Thanks Michael Hausenblas<br />
  154. 154. THANKS<br />Juan Sequeda<br /><br />@juansequeda<br />#cold<br /><br />Acknowledgements: Olaf Hartig, Patrick Sinclair, Jamie Taylor<br />Slides for Consuming Linked Data with SPARQL by Olaf Hartig<br />