Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Intro to Linked, Dutch Ships and Sailors and SPARQL handson

798 views

Published on

Intro to Linked, Dutch Ships and Sailors and SPARQL handson

Published in: Education
  • Be the first to comment

  • Be the first to like this

Intro to Linked, Dutch Ships and Sailors and SPARQL handson

  1. 1. Victor de Boer Linked Data and Sparql and Dutch Ships and Sailors
  2. 2. The ‘problem’ (Maritime-historical) (archival) data is not integrated Data is “lost” or published without reusability In different physical locations In different file formats In different semantic structures We do not want to force one monolithic data model Flexible integration Re-use existing data sources
  3. 3. Linked Data Machine readable format Standardized Flexibility to connect heterogeneous data Link what can be linked re-use and re-usability OBJECT EVENT PLACE TIME PERSON CONCEPT PROVENANCE
  4. 4. Open Data is about licenses to allow reuse Linked Data is about technology for interoperability What is Linked Open Data?
  5. 5. Web of Documents (WWW) Linked Documents
  6. 6. Web of Data Linked Data
  7. 7. How does all this work? Data, not documents Structured data Graph (networked) data! W3C Web standards stack URIs, HTTP, RDF, RDFa, RDFS, OWL, SPARQL, etc.
  8. 8. Four rules of Linked Data 1. Use URIs as names for things 2. Use HTTP URIs so that people can look up those names. 3. When someone looks up a URI, provide useful information, using the standards (RDF) 4. Include links to other URIs. so that they can discover more things. http://www.w3.org/DesignIssues/LinkedData.html
  9. 9. Use HTTP URIs for Things Uniform Resource Identifier (URI) is a string of characters used to identify a name of a resource http://rijksmuseum.nl/data/schilderij1 I can go there (dereference) and then I get information about it HTML page for humans RDF data for machines
  10. 10. Semantic Web standard for writing down data, information (Subject, Relation, Object) <Painting001, has_location, Amsterdam> Resource Description Framework (RDF) Painting001 Amsterdam has_location
  11. 11. Resource Description Format (RDF) Triples form Graphs rijks:Painting001 geo:Haarlem rijks:Frans_Hals 147590 52.38084, 4.63683 geo:Noord-Holland geo:Netherlands rijks:Painting002
  12. 12. RDFS adds some reasoning (Classes and Properties)
  13. 13. http://lod-cloud.net/
  14. 14. Dutch Ships and Sailors KB NEWSPAPERS Dutch-Asiatic Shipping“VOC Opvarenden” Jur Leinenga Matthias van Rossum Elbing voyagesArchangel voyages
  15. 15. HETEROGENEOUS but LINKED DATAMODELS dss:Record gzmvoc:Telling gzmvoc:telling-1046-De_Berkel __bnode_1 gzmvoc:aziatischeBemanning dss:Ship gzmvoc:Schip gzmvoc: schip-1046-De_Berkel dss:has_ship gzmvoc:schip "1046" “Schip” “De Berkel” rdfs:label dss:scheepsnaam gzmvoc:scheepsnaam dss:ShipType gzmvoc:Scheepstype gzmvoc: type-Ship dss:has_shiptype gzmvoc:has_shiptype gzmvoc:scheepstype “21” “Moorse mattroosen” dss:azRegistratieKop gzmvoc:azAantalMatrozen gzmvoc:telling gzmvoc:heeft DAS heenreis dss:Record das:Voyage das:voyage-1918_61 Integrate datasets No monolithic datamodel needed No normalisation / dumbing down of data needed Retain original model and intent
  16. 16. Reuse: Links to other web resources Historical Newspapers http://delpher.nl isReferencedBy [HARLINGEN, 24 October.] …gestrand. Tevens is het berigt ontvan°e > dat het hier behoorende schoonerschip Transit, kapitein Schaap, in de Noordzee is gezonken, nadat het achterschip was weggeslagen ; een ligtmatroos verloor daarbij het leven. Mede zijn hier drie vreemde schepen met meer en minder zware averij binnengeloopen.
  17. 17. mdb:Schip1 mdb:Kof mdb:scheepsType das:ShipX das:Kofship das:typeOfShip Aat:Kof Aat:Platbodems skos: broader Reuse: background knowledge AAT = Art & Architecture Thesaurus http://www.getty.edu/research/tools/vocabularies/aat/ OWL = Web ontology language https://www.w3.org/OWL/
  18. 18. Linking to other initiatives
  19. 19. HTTP://SEMANTICWEB.CS.VU.NL/DSS
  20. 20. Data analysis and visualisation
  21. 21. SPARQL: The query language for RDF data SELECT * WHERE { ?record dss:hasOriginalScan ?scan. ?record dss:has_kb_link ?kblink. ?record mdb:schip ?schip. ?schip mdb:scheepstype ?shiptype. ?shiptype skos:exactMatch ?em. ?em skos:broader* aat:kustvaarders. }
  22. 22. QUERYING Linked Data
  23. 23. Three main ways of accessing remote Linked Data 1. Through HTTP request on the resource URI 2. Through SPARQL queries 3. Get a copy of a dataset
  24. 24. 1. Through HTTP request on the resource URI HTTP GET on resource, parse, follow links Simple HTTP requests and RDF parsing Requires dereferencable URIs One request per resource: may require many requests Local caching can be done Crawling GET /resource/Amsterdam HTTP/1.1 Host: dbpedia.org Accept: text/html;q=0.5, application/rdf+xml I’m ok with HTML… …but I really prefer RDF
  25. 25. With CURL curl -L -H "Accept: application/rdf+xml" http://dbpedia.org/resource/Madrid curl -L -H "Accept: text/turtle" http://dbpedia.org/resource/Madrid curl -L -H "Accept: text/turtle" http://purl.org/collections/nl/dss/das/voyage-5580_1 With Sindice inspector (or other tool) http://inspector.sindice.com/inspect?url= http://inspector.sindice.com/inspect?url=http://dbpedi a.org/resource/Madrid
  26. 26. 2. Get a local copy of a dataset through SPARQL CONSTRUCT, crawling or direct file download Save in triple store or convert to something else
  27. 27. RDF Libraries Redland: http://www.librdf.org/ Perl, Python, PHP, Ruby, C#, Objective-C Jena: http://jena.sourceforge.net/ Java RDFLib: http://www.rdflib.net/ Python ARC2: http://arc2.semsol.net/ PHP ActiveRDF: http://www.activerdf.org/ Ruby
  28. 28. 3. Through SPARQL queries Full-blown query language Needs SPARQL endpoint $query = "SELECT distinct ?title ?description WHERE { ?x <http://data.open.ac.uk/podcast/ontology/relatesToCourse> <http://data.open.ac.uk/course/t209>. ?x <http://purl.org/dc/terms/title> ?title. ?x <http://www.w3.org/TR/2010/WD-mediaont-10-20100608/description> ?description } LIMIT 10 "; $requestURL = 'http://data.open.ac.uk/query?query='.urlencode($query); $response = request($requestURL); SPARQL in PHP example http://www.greenhughes.com/content/approach-consuming-linked-data-php
  29. 29. Handson with SPARQL With slides from Knud Hinnerk Moeller
  30. 30. SPARQL A Query-language for the Web of Data
  31. 31. SPARQL – Querying the Web of Data query language for RDF graphs (i.e., linked data) extract specific information out of a dataset (or several datasets) "The SQL for the Web of Data"
  32. 32. SPARQL Endpoint Reasoning?
  33. 33. PREFIX mo: <http://purl.org/ontology/mo/> PREFIX dce: <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?album ?title ?release_date WHERE { ?album a mo:Record ; dce:date ?release_date ; dce:title ?title . FILTER (year(?release_date) = 2007 && month(?release_date) = 7) } ORDER BY ?release_date
  34. 34. SPARQL in a Nutshell
  35. 35. PREFIX mo: <http://purl.org/ontology/mo/> PREFIX dce: <http://purl.org/dc/elements/1.1/> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> SELECT DISTINCT ?album ?title ?release_date WHERE { ?album a mo:Record ; dce:date ?release_date ; dce:title ?title . FILTER (year(?release_date) = 2007 && month(?release_date) = 7) } ORDER BY ?release_date graph pattern
  36. 36. <artist/3908> a mo:MusicArtist . <artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3908> foaf:homepage <http://www.petithomme.org> . <artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> . <artist/3908> foaf:made <record/3604> . <artist/3908> foaf:made <record/4295> . <artist/3908> foaf:name "Petit Homme"^^xsd:string . <artist/3732> a mo:MusicArtist . <artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> . <artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> . <artist/3732> foaf:made <record/3738> . <artist/3732> foaf:made <record/4092> . <artist/3732> foaf:made <record/6361> . <artist/3732> foaf:made <record/8836> . <artist/3732> foaf:name "Whiteshoulders"^^xsd:string . <record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime . <record/8836> dce:title "W (EP)"^^xsd:string . <record/8836> mo:track <track/90496> . <record/8836> mo:track <track/90504> . <record/8836> mo:track <track/90508> . <record/8836> mo:track <track/90510> . <record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental . <record/8836> hg:taggedWithTag tags:noise . <record/8836> hg:taggedWithTag tags:noisy . <record/8836> a mo:Record . <record/8836> foaf:maker <artist/3732> .
  37. 37. Triple and Graph Patterns WHERE { ?album a mo:Record ; dce:date ?release_date ; dce:title ?title . FILTER (year(?release_date) = 2007 && month(?release_date) = 7) }
  38. 38. One Variable <artist/3732> foaf:made ?record .
  39. 39. <artist/3908> a mo:MusicArtist . <artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3908> foaf:homepage <http://www.petithomme.org> . <artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> . <artist/3908> foaf:made <record/3604> . <artist/3908> foaf:made <record/4295> . <artist/3908> foaf:name "Petit Homme"^^xsd:string . <artist/3732> a mo:MusicArtist . <artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> . <artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> . <artist/3732> foaf:made <record/3738> . <artist/3732> foaf:made <record/4092> . <artist/3732> foaf:made <record/6361> . <artist/3732> foaf:made <record/8836> . <artist/3732> foaf:name "Whiteshoulders"^^xsd:string . <record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime . <record/8836> dce:title "W (EP)"^^xsd:string . <record/8836> mo:track <track/90496> . <record/8836> mo:track <track/90504> . <record/8836> mo:track <track/90508> . <record/8836> mo:track <track/90510> . <record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental . <record/8836> hg:taggedWithTag tags:noise . <record/8836> hg:taggedWithTag tags:noisy . <record/8836> a mo:Record . <record/8836> foaf:maker <artist/3732> .
  40. 40. Two Variables ?artist foaf:made ?record .
  41. 41. <artist/3908> a mo:MusicArtist . <artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3908> foaf:homepage <http://www.petithomme.org> . <artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> . <artist/3908> foaf:made <record/3604> . <artist/3908> foaf:made <record/4295> . <artist/3908> foaf:name "Petit Homme"^^xsd:string . <artist/3732> a mo:MusicArtist . <artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> . <artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> . <artist/3732> foaf:made <record/3738> . <artist/3732> foaf:made <record/4092> . <artist/3732> foaf:made <record/6361> . <artist/3732> foaf:made <record/8836> . <artist/3732> foaf:name "Whiteshoulders"^^xsd:string . <record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime . <record/8836> dce:title "W (EP)"^^xsd:string . <record/8836> mo:track <track/90496> . <record/8836> mo:track <track/90504> . <record/8836> mo:track <track/90508> . <record/8836> mo:track <track/90510> . <record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental . <record/8836> hg:taggedWithTag tags:noise . <record/8836> hg:taggedWithTag tags:noisy . <record/8836> a mo:Record . <record/8836> foaf:maker <artist/3732> .
  42. 42. Three Variables ?subject ?predicate ?object .
  43. 43. <artist/3908> a mo:MusicArtist . <artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3908> foaf:homepage <http://www.petithomme.org> . <artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> . <artist/3908> foaf:made <record/3604> . <artist/3908> foaf:made <record/4295> . <artist/3908> foaf:name "Petit Homme"^^xsd:string . <artist/3732> a mo:MusicArtist . <artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> . <artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> . <artist/3732> foaf:made <record/3738> . <artist/3732> foaf:made <record/4092> . <artist/3732> foaf:made <record/6361> . <artist/3732> foaf:made <record/8836> . <artist/3732> foaf:name "Whiteshoulders"^^xsd:string . <record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime . <record/8836> dce:title "W (EP)"^^xsd:string . <record/8836> mo:track <track/90496> . <record/8836> mo:track <track/90504> . <record/8836> mo:track <track/90508> . <record/8836> mo:track <track/90510> . <record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental . <record/8836> hg:taggedWithTag tags:noise . <record/8836> hg:taggedWithTag tags:noisy . <record/8836> a mo:Record . <record/8836> foaf:maker <artist/3732> .
  44. 44. A full Graph Pattern ?artist a mo:MusicArtist ; foaf:name ?artist_name ; foaf:homepage ?homepage .
  45. 45. <artist/3908> a mo:MusicArtist . <artist/3908> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3908> foaf:homepage <http://www.petithomme.org> . <artist/3908> foaf:img <http://img.jamendo.com/artists/p/petit.homme.gif> . <artist/3908> foaf:made <record/3604> . <artist/3908> foaf:made <record/4295> . <artist/3908> foaf:name "Petit Homme"^^xsd:string . <artist/3732> a mo:MusicArtist . <artist/3732> foaf:based_near <http://sws.geonames.org/3019599/> . <artist/3732> foaf:homepage <http://blackshoulders.hautetfort.com/> . <artist/3732> foaf:img <http://img.jamendo.com/artists/w/white-shoulders.jpg> . <artist/3732> foaf:made <record/3738> . <artist/3732> foaf:made <record/4092> . <artist/3732> foaf:made <record/6361> . <artist/3732> foaf:made <record/8836> . <artist/3732> foaf:name "Whiteshoulders"^^xsd:string . <record/8836> dce:date "2007-10-09T15:58:17"^^xsd:dateTime . <record/8836> dce:title "W (EP)"^^xsd:string . <record/8836> mo:track <track/90496> . <record/8836> mo:track <track/90504> . <record/8836> mo:track <track/90508> . <record/8836> mo:track <track/90510> . <record/8836> hg:taggedWithTag tags:electro . <record/8836> hg:taggedWithTag tags:experimental . <record/8836> hg:taggedWithTag tags:noise . <record/8836> hg:taggedWithTag tags:noisy . <record/8836> a mo:Record . <record/8836> foaf:maker <artist/3732> .
  46. 46. Dutch Ships and Sailors
  47. 47. ACCESS IT AT HTTP://DUTCHSHIPSANDSAILORS.NL/DATA OR HTTP://SEMANTICWEB.CS.VU.NL/DSS SELECT * WHERE { ?record dss:hasOriginalScan ?scan. ?record dss:has_kb_link ?kblink. ?record mdb:schip ?schip. ?schip mdb:scheepstype ?shiptype. ?shiptype skos:exactMatch ?em. ?em skos:broader* aat:kustvaarders. }
  48. 48. http://www.victordeboer.com/dss_sparql_handson/

×