Advertisement
do06clar

Database

Apr 14th, 2014
2,969
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SPARQL 2.44 KB | None | 0 0
  1. http://dbpedia.org/snorql/
  2.  
  3. //Simple SELECT
  4. SELECT ?subject
  5. WHERE {
  6. ?subject rdf:type <http://dbpedia.org/ontology/City>.
  7. } LIMIT 20
  8.  
  9.  
  10.  
  11. //More attributes
  12. SELECT ?subject ?population
  13. WHERE {
  14. ?subject rdf:type <http://dbpedia.org/ontology/City>.
  15. ?subject <http://dbpedia.org/ontology/populationUrban> ?population.
  16. } LIMIT 20
  17.  
  18.  
  19.  
  20. //FILTER
  21. SELECT ?subject ?population
  22. WHERE {
  23. ?subject rdf:type <http://dbpedia.org/ontology/City>.
  24. ?subject <http://dbpedia.org/ontology/populationUrban> ?population.
  25. FILTER (xsd:integer(?population) > 2000000)
  26. } LIMIT 20
  27.  
  28.  
  29. //Another
  30. SELECT *
  31.   WHERE
  32.     {
  33.       ?e <http://dbpedia.org/ontology/series>         <http://dbpedia.org/resource/Game_of_Thrones>  .
  34.       ?e <http://dbpedia.org/ontology/releaseDate>    ?date .
  35.       ?e <http://dbpedia.org/ontology/episodeNumber>  ?number .
  36.       ?e <http://dbpedia.org/ontology/seasonNumber>   ?season .    }
  37.   ORDER BY DESC(?date)
  38.  
  39.  
  40. //And another
  41. SELECT *
  42.   WHERE
  43.     {
  44.       ?company  a      <http://dbpedia.org/ontology/Organisation>  .
  45.       ?company  <http://dbpedia.org/ontology/foundationPlace>  <http://dbpedia.org/resource/California>    .
  46.       ?product  <http://dbpedia.org/ontology/developer>        ?company  .
  47.       ?product  a  <http://dbpedia.org/ontology/Software>
  48.     }
  49.  
  50. //More!!
  51. SELECT ?subject ?label ?released ?abstract WHERE {
  52.     ?subject rdf:type <http://dbpedia.org/ontology/Film>.
  53.     ?subject dbpedia2:starring <http://dbpedia.org/resource/Tom_Cruise>.
  54.     ?subject rdfs:comment ?abstract.
  55.     ?subject rdfs:label ?label.
  56. FILTER(LANG(?abstract) = "en" && LANG(?label) = "en").
  57.     ?subject <http://dbpedia.org/ontology/releaseDate> ?released.
  58. FILTER(xsd:date(?released) < "2000-01-01"^^xsd:date).
  59. } ORDER BY ?released
  60.  
  61.  
  62. //Possible Uses?
  63. SELECT DISTINCT ?person {
  64.     { ?person a dbpedia-owl:Scientist }    UNION
  65.     { ?person a dbpedia-owl:Writer }    UNION
  66.     { ?person a dbpedia-owl:Philosopher }    UNION
  67.     { ?person a <http://dbpedia.org/class/yago/AmericanAnthropologists> }
  68.     UNION
  69.     { ?person dct:subject <http://dbpedia.org/resource/Category:German_poets>  }    
  70. ?person dct:subject <http://dbpedia.org/resource/Category:1943_deaths> .
  71. }
  72.  
  73.  
  74. //Other fun uses
  75. PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
  76. SELECT ?subject ?lat ?long WHERE {
  77. ?subject <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:Football_venues_in_Germany>.
  78. ?subject geo:lat ?lat.
  79. ?subject geo:long ?long.
  80. } LIMIT 20
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement