Querying: Difference between revisions

665 bytes removed ,  2 years ago
Line 13: Line 13:


=== Label ===
=== Label ===
All items that are vilayets, as well as their English language label. [https://ottgaz.org/query/#PREFIX%20wd%3A%20%3Chttps%3A%2F%2Fottgaz.org%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fottgaz.org%2Fprop%2Fdirect%2F%3E%0A%0ASELECT%20%3Fvilayet%20%3FvilayetLabel%0AWHERE%20%0A%7B%0A%20%20%3Fvilayet%20wdt%3AP6%20wd%3AQ5%20.%20%0A%20%20optional%20%7B%20%0A%20%20%20%20%20%3Fvilayet%20rdfs%3Alabel%20%3FvilayetLabel%0A%20%20%20%20%20filter%20langMatches%28lang%28%3FvilayetLabel%29%2C%20%22en%22%29%0A%20%20%20%7D%0A%7D run]
All items that are vilayets, as well as their English language label. [https://tinyurl.com/2n3vmss7 run]
 
SELECT ?vilayet ?vilayetLabel
WHERE
{
  ?vilayet wdt:P6 wd:Q5 .
  optional {
      ?vilayet rdfs:label ?vilayetLabel
      filter langMatches(lang(?vilayetLabel), "en")
    }
}
 
or better still: [https://tinyurl.com/2n3vmss7 run]


  SELECT ?vilayet ?vilayetLabel
  SELECT ?vilayet ?vilayetLabel