Querying: Difference between revisions

Line 99: Line 99:
== Federated query with Wikidata ==
== Federated query with Wikidata ==


For every sanjak in Ottgaz, this query fetches the vilayet or eyalet to which Wikidata says it belongs. Thanks to Lucas Werkmeister for help. [https://tinyurl.com/2ehssccv run]
For every sanjak in Ottgaz, this query fetches the vilayet or eyalet to which Wikidata says it belongs. Thanks to Lucas Werkmeister for help. [https://tinyurl.com/2eokop65 run]


  PREFIX og: <https://ottgaz.org/entity/>
  PREFIX og: <https://ottgaz.org/entity/>
Line 108: Line 108:
  SELECT ?sancak ?sancakLabel ?vilayet ?vilayetLabel
  SELECT ?sancak ?sancakLabel ?vilayet ?vilayetLabel
  WHERE {
  WHERE {
   ?sancak ogt:P6 og:Q4 . # item must be a sanjak
   ?sancak ogt:P15 og:Q4 . # item must be a sanjak
   ?sancak ogt:P4 ?c . # finds reference URL to wikidata
   ?sancak ogt:P4 ?c . # finds reference URL to wikidata
   BIND(IRI(REPLACE(REPLACE(REPLACE(STR(?c), "Property:", ""), "/wiki/", "/entity/"), "https://", "http://")) AS ?wd_c) # produces proper URL for query form
   BIND(IRI(REPLACE(REPLACE(REPLACE(STR(?c), "Property:", ""), "/wiki/", "/entity/"), "https://", "http://")) AS ?wd_c) # produces proper URL for query form