SPARQLの基礎

  • 7,427 views
Uploaded on

 

More in: Technology , Travel , Business
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
7,427
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
56
Comments
0
Likes
8

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. SPARQL
  • 2. http://oreilly.com/catalog/0636920020547/
  • 3. http://www.w3.org/DesignIssues/LinkedData.html
  • 4. http://wiki.dbpedia.org/OnlineAccess
  • 5. http://dbpedia.org/sparql
  • 6. http://id.ndl.go.jp/auth/ndla
  • 7. http://iss.ndl.go.jp/ndla/sparql/
  • 8. A C BD E F H G I K J L M
  • 9. A C BD E F H G I K J L M
  • 10. A C BD E F H G I K J L M
  • 11. A C BD E F H G I K J L M :A ?link1 ?node1 ?node1 ?link2 ?node2
  • 12. A like like C B like dislikeD dislike dislike E F dislike like H like dislike G like I dislike K dislike like J L dislike M
  • 13. A like like C B like dislikeD dislike dislike E F dislike like H like dislike G like I dislike K dislike like J L dislike M
  • 14. A like like C B like dislikeD dislike dislike E F dislike like H like dislike G like I dislike K dislike like J L dislike M :A :like ?node1 ?node1 :like ?node2
  • 15. rdfs:label dbpedia-owl:capital dbpedia:Japandbpedia-owl:City rdf:type dbpedia-owl:coutnry dbpedia- dbpedia:Tokyo dbpprop:birthPlace rdf:type owl:ComicCreator dbpprop:birthPlace rdf:type dbpedia- rdfs:label dbpedia:Kaoru_Mori owl:sameAs owl:Artist owl:sameAs dbpprop:birthdate rdf:type 1978-09-18 rdfs:label foaf:homepage foaf:Person rdfs:label freebase: Мори, Каору http:// morikaoru.blog62.fc2.com
  • 16. dbpedia-owl:Capitaldbpedia:Japan dbpedia:Tokyo
  • 17. PREFIX dbpedia: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> SELECT ?country WHERE { dbpedia:Tokyo dbpedia-owl:country ?country . } rdfs:label dbpedia-owl:capital dbpedia:Japandbpedia-owl:City rdf:type dbpedia-owl:coutnry dbpedia- dbpedia:Tokyo dbpprop:birthPlace rdf:type owl:ComicCreator dbpprop:birthPlace rdf:type dbpedia- rdfs:label dbpedia:Kaoru_Mori owl:sameAs owl:Artist owl:sameAs dbpprop:birthdate rdf:type 1978-09-18 rdfs:label foaf:homepage foaf:Person rdfs:label freebase: Мори, Каору http:// morikaoru.blog62.fc2.com
  • 18. PREFIX dbpedia: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?birthPlace ?label WHERE { dbpedia:Kaoru_Mori dbpedia-owl:birthPlace ?birthPlace . ?birthPlace rdfs:label ?label . } rdfs:label dbpedia-owl:capital dbpedia:Japandbpedia-owl:City rdf:type dbpedia-owl:coutnry dbpedia- dbpedia-owl:birthPlace rdf:type owl:ComicCreator dbpedia:Tokyo dbpedia-owl:birthPlace rdf:type dbpedia- rdfs:label dbpedia:Kaoru_Mori owl:sameAs owl:Artist owl:sameAs dbpprop:birthdate rdf:type 1978-09-18 rdfs:label foaf:homepage foaf:Person rdfs:label freebase: Мори, Каору http:// morikaoru.blog62.fc2.com
  • 19. PREFIX dbpedia: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?birthPlace ?label WHERE { dbpedia:Kaoru_Mori dbpedia-owl:birthPlace ?birthPlace . ?birthPlace rdf:type dbpedia-owl:City ; rdfs:label ?label . } rdfs:label dbpedia-owl:capital dbpedia:Japandbpedia-owl:City rdf:type dbpedia-owl:coutnry dbpedia- dbpedia-owl:birthPlace rdf:type owl:ComicCreator dbpedia:Tokyo dbpedia-owl:birthPlace rdf:type dbpedia- rdfs:label dbpedia:Kaoru_Mori owl:sameAs owl:Artist owl:sameAs dbpprop:birthdate rdf:type 1978-09-18 rdfs:label foaf:homepage foaf:Person rdfs:label freebase: Мори, Каору http:// morikaoru.blog62.fc2.com
  • 20. PREFIX dbpedia: <http://dbpedia.org/resource/> PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT ?birthPlace ?label WHERE { dbpedia:Kaoru_Mori dbpedia-owl:birthPlace ?birthPlace . ?birthPlace a dbpedia-owl:City ; rdfs:label ?label . FILTER (lang(?label) = “ja”) } rdfs:label dbpedia-owl:capital dbpedia:Japandbpedia-owl:City rdf:type dbpedia-owl:coutnry dbpedia- dbpedia-owl:birthPlace rdf:type owl:ComicCreator dbpedia:Tokyo dbpedia-owl:birthPlace rdf:type dbpedia- rdfs:label dbpedia:Kaoru_Mori owl:sameAs owl:Artist owl:sameAs dbpprop:birthdate rdf:type 1978-09-18 rdfs:label foaf:homepage foaf:Person rdfs:label freebase: Мори, Каору http:// morikaoru.blog62.fc2.com
  • 21. SELECT *WHERE { ?s ?p ?o .}LIMIT 100OFFSET 100
  • 22. : yes / noPREFIX dbpedia: <http://dbpedia.org/resource/>PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>ASK WHERE { dbpedia:Kaoru_Mori dbpedia-owl:birthPlace ?birthPlace .}
  • 23. PREFIX foaf: <http://xmlns.com/foaf/0.1/>CONSTRUCT { ?s foaf:name ?name .}WHERE { ?s foaf:name ?name .}
  • 24. ( )DESCRIBE <http://dbpedia.org/resource/Tokyo>
  • 25. dbpedia-owl:Artist freebase: a music.producer a freebase: owl:sameAs dbpedia: dbpedia: en.mike_oldfield Mike_Oldfield Virgin_Records freebase: dbpedia-owl: music.producer. recordLabel releases_produced dbpedia-owl: dbpedia-owl: freebase: owl:sameAs artist producer freebase: music.release. m.0328jl5 producer a freebase: dbpedia: dbpedia-owl:Albumtype.object.name owl:sameAs Tubular_Bells Tubular Bells owl:sameAs bbc_artists: mo:musicbrainz musicbrainz: a a1684a49-feaa-4150-b758- a1684a49-feaa-4150-b758- d9412fc59f12#artist d9412fc59f12.html mo:SoloArtist mo:imdb foaf:name imdb:nm0646131 Mike Oldfield (default-graph)
  • 26. http://www.freebase.com http://dbpedia.org dbpedia-owl:Artist freebase: a music.producer a freebase: owl:sameAs dbpedia: dbpedia: en.mike_oldfield Mike_Oldfield Virgin_Records freebase: dbpedia-owl: music.producer. recordLabel releases_produced dbpedia-owl: dbpedia-owl: freebase: owl:sameAs artist producer freebase: music.release. m.0328jl5 producer a freebase: dbpedia: dbpedia-owl:Albumtype.object.name owl:sameAs Tubular_Bells Tubular Bells owl:sameAs bbc_artists: mo:musicbrainz musicbrainz: a a1684a49-feaa-4150-b758- a1684a49-feaa-4150-b758- d9412fc59f12#artist d9412fc59f12.html mo:SoloArtist mo:imdb foaf:name imdb:nm0646131 Mike Oldfield http://www.bbc.co.uk (default-graph)
  • 27. http://www.freebase.com http://dbpedia.org dbpedia-owl:Artist freebase: a music.producer a freebase: owl:sameAs dbpedia: dbpedia: en.mike_oldfield Mike_Oldfield Virgin_Records freebase: dbpedia-owl: music.producer. recordLabel releases_produced dbpedia-owl: dbpedia-owl: freebase: owl:sameAs artist producer freebase: music.release. m.0328jl5 producer a freebase: dbpedia: dbpedia-owl:Albumtype.object.name owl:sameAs Tubular_Bells Tubular Bells owl:sameAs bbc_artists: mo:musicbrainz musicbrainz: a a1684a49-feaa-4150-b758- a1684a49-feaa-4150-b758- d9412fc59f12#artist d9412fc59f12.html mo:SoloArtist mo:imdb foaf:name imdb:nm0646131 Mike Oldfield http://www.bbc.co.uk (default-graph)
  • 28. SELECT *WHERE { GRAPH <http://dbpedia.org> { ?s ?p ?o . }}
  • 29. SELECT *WHERE { GRAPH ?g { ?s ?p ?o . }}
  • 30. { ex:A ex:like ?tmpNode . ?tmpNode ex:like ?node . }=> { ex:A ex:like/ex:like ?node }=> { ex:A ex:like{2} ?node }...=> { ex:A ex:like+ ?node }{ ex:A (ex:like|ex:love) ?node }
  • 31. COUNT, SUM, MIN, MAX, AVG,GROUP_CONCAT, SAMPLEPREFIX dbpedia: <http://dbpedia.org/resource/>PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>SELECT (COUNT(?label) AS ?count)WHERE { dbpedia:Tokyo rdfs:label ?label .}