Consuming Linked Data 4/5 Semtech2011

3,039 views
2,885 views

Published on

Published in: Education, Technology

Consuming Linked Data 4/5 Semtech2011

  1. 1. Consuming Linked Data<br />Juan F. Sequeda<br />Semantic Technology Conference<br />June 2011<br />
  2. 2. Now what can we do with this data?<br />
  3. 3. Linked Data Applications<br />Software system that makes use of data on the web from multiple datasets and that benefits from links between the datasets<br />
  4. 4. 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
  5. 5. Discover further information by following the links between different data sources: the fourth principle enables this.
  6. 6. Combine the consumed linked data with data from sources (not necessarily Linked Data)
  7. 7. Expose the combined data back to the web following the Linked Data principles
  8. 8. Offer value to end-users</li></li></ul><li>Generic Applications<br />
  9. 9. Linked Data Browsers<br />
  10. 10. 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 />User can navigate between data sources by following RDF Links<br />(IMO) No usability<br />
  11. 11.
  12. 12. Linked Data Browsers<br />http://browse.semanticweb.org/<br />Tabulator<br />OpenLinkDataexplorer<br />Zitgist<br />Marbles<br />Explorator<br />Disco<br />LinkSailor<br />
  13. 13. Linked Data (Semantic Web) Search Engines<br />
  14. 14. Linked Data (Semantic Web) Search Engines<br />Just like conventional search engines (Google, Bing, Yahoo), crawl RDF documents and follow RDF links.<br />Current search engines don’t crawl data, unless it’s RDFa<br />Human focus Search<br />Falcons - Keyword<br />SWSE – Keyworkd<br />VisiNav – Complex Queries<br />Machine focus Search<br />Sindice – data instances<br />Swoogle - ontologies<br />Watson - ontologies<br />Uberblic – curated integrated data instances<br />
  15. 15. (Semantic) SEO ++<br />Markup your HTML with RDFa<br />Use standard vocabularies (ontologies)<br />Google Vocabulary<br />Good Relations<br />Dublin Core<br />Google and Yahoo will crawl this data and use it for better rendering<br />
  16. 16.
  17. 17. On-the-fly Mashups<br />
  18. 18. http://sig.ma<br />
  19. 19. Domain Specific Applications<br />
  20. 20. Domain Specific Applications<br />Government<br />Data.gov<br />Data.gov.uk<br />http://data-gov.tw.rpi.edu/wiki/Demos<br />Music<br />Seevl.net<br />Dbpedia Mobile<br />Life Science<br />LinkedLifeData<br />Sports<br />BBC World Cup<br />
  21. 21. Faceted Browsers<br />
  22. 22. http://dbpedia.neofonie.de/browse/<br />
  23. 23. http://dev.semsol.com/2010/semtech/<br />
  24. 24. Query your data<br />
  25. 25. Find all the locations of all the original paintings of Modigliani<br />
  26. 26. Select all proteins that are linked to a curated interaction from the literature and to inflammatory response<br />http://linkedlifedata.com/<br />
  27. 27. 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 />* http://www.w3.org/TR/rdf-sparql-protocol/<br />
  28. 28. Where can I find SPARQL Endpoints?<br />Dbpedia: http://dbpedia.org/sparql<br />Musicbrainz: http://dbtune.org/musicbrainz/sparql<br />U.S. Census: http://www.rdfabout.com/sparql<br />http://esw.w3.org/topic/SparqlEndpoints<br />
  29. 29. 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 />
  30. 30. 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 />
  31. 31. Query Results Formats<br />PREFIX dbp: http://dbpedia.org/ontology/<br />PREFIX dbpprop: http://dbpedia.org/property/<br />SELECT ?name ?bdayWHERE { <br /> ?pdbp:birthplace <http://dbpedia.org/resource/Berlin> . <br /> ?pdbpprop:dateOfBirth ?bday . <br /> ?pdbpprop:name ?name .<br />}<br />
  32. 32.
  33. 33.
  34. 34. 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: dbpedia.org<br />User-agent: my-sparql-client/0.1 <br />Accept: application/sparql-results+json<br />
  35. 35. 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: dbpedia.org<br />User-agent: my-sparql-client/0.1<br />
  36. 36. Accessing a SPARQL Endpoint<br />More convenient: use a library<br />SPARQL JavaScript Library<br />http://www.thefigtrees.net/lee/blog/2006/04 sparql_calendar_demo_a_sparql.html<br />ARC for PHP<br />http://arc.semsol.org/<br />RAP – RDF API for PHP<br />http://www4.wiwiss.fu-berlin.de/bizer/rdfapi/index.html<br />
  37. 37. Accessing a SPARQL Endpoint<br />Jena / ARQ (Java)<br />http://jena.sourceforge.net/<br />Sesame (Java)<br />http://www.openrdf.org/<br />SPARQL Wrapper (Python)<br />http://sparql-wrapper.sourceforge.net/<br />PySPARQL (Python)<br />http://code.google.com/p/pysparql/<br />
  38. 38. 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 />
  39. 39. Querying a single dataset is quite boring<br />compared to<br />Issuing queries over multiple datasets<br />
  40. 40. Creating a Linked Data Application<br />
  41. 41. Linked Data Architectures<br />Follow-up queries<br />Querying Local Cache<br />Crawling<br />Federated Query Processing<br />On-the-fly Dereferencing<br />
  42. 42. 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 />
  43. 43. String s1 = "http://cb.semsol.org/sparql"; <br />String s2 = "http://dbpedia.org/sparql";<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 />
  44. 44. 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 />
  45. 45. Querying Local Cache<br />Idea: Use an existing SPARQL endpoint that provides access to a set of copies of relevant datasets<br />Use RDF dumps of each dataset<br />SPARQL endpoint over a majority of datasets from the LOD cloud at:<br />http://uberblic.org<br />http://lod.openlinksw.com/sparql<br />
  46. 46. Querying a Collection of Datasets<br />Advantage:<br />No need for specific program logic<br />Includes the datasets that you want<br />Complex queries and high performance<br />Even reasoning<br />Drawbacks:<br />Depends on existence of RDF dump<br />Requires effort to set up and to operate the store <br />How to keep the copies in sync with the originals?<br />Queried data might be out of date<br />
  47. 47. Crawling<br />Crawl RDF in advance by following RDF links<br />Integrate, clean and store in your own triplestore<br />Same way we crawl HTML today<br />LDSpider<br />
  48. 48. Crawling<br />Advantages:<br />No need for specific program logic <br />Independent of the existence, availability, and efficiency of SPARQL endpoints<br />Complex queries with high performance<br />Can even reason about the data<br />Drawbacks:<br />Requires effort to set up and to operate the store <br />How to keep the copies in sync with the originals?<br />Queried data might be out of date<br />
  49. 49. Federated Query Processing<br />Idea: Querying a mediator which distributes sub-queries to relevant sources and integrates the results<br />
  50. 50. 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 />
  51. 51. Federated Query Processing<br />DARQ (Distributed ARQ)<br />http://darq.sourceforge.net/<br />Query engine for federated SPARQL queries<br />Extension of ARQ (query engine for Jena)<br />Last update: June 2006<br />Semantic Web Integrator and Query Engine(SemWIQ)<br />http://semwiq.sourceforge.net/<br />Last update: March 2010<br />Commercial<br />…<br />
  52. 52. 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 />
  53. 53. 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 />
  54. 54. 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 />
  55. 55. On-the-fly Dereferencing<br />Idea: Discover further data by looking up relevant URIs in your application on the fly<br />Can be combined with the previous approaches<br />Linked Data Browsers<br />
  56. 56. 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 />
  57. 57. Link Traversal Based Query Execution<br />
  58. 58. Link Traversal Based Query Execution<br />
  59. 59. Link Traversal Based Query Execution<br />
  60. 60. Link Traversal Based Query Execution<br />
  61. 61. Link Traversal Based Query Execution<br />
  62. 62. Link Traversal Based Query Execution<br />
  63. 63. Link Traversal Based Query Execution<br />
  64. 64. Link Traversal Based Query Execution<br />
  65. 65. Link Traversal Based Query Execution<br />
  66. 66. Link Traversal Based Query Execution<br />
  67. 67. 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 />
  68. 68. Implementations<br />Semantic Web Client library (SWClLib) for Java<br />http://www4.wiwiss.fu-berlin.de/bizer/ng4j/semwebclient/<br />SWIC for Prolog<br />http://moustaki.org/swic/<br />
  69. 69. Implementations<br />SQUIN http://squin.org<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 />
  70. 70. Real World Example<br />
  71. 71. What else?<br />Vocabulary Mapping<br />foaf:namevsfoo:name<br />Identity Resolution<br />ex:Juanowl:sameAsfoo:Juan<br />Provenance<br />Data Quality<br />License<br />
  72. 72. Getting Started <br />Finding URIs<br />Use search engines<br />Finding SPARQL Endpoints<br />

×