Querying

From ottgaz.org
Revision as of 17:45, 30 September 2022 by Will (talk | contribs) (→‎Label)
Jump to navigation Jump to search

Run SPARQL queries via the Ottgaz Query Service.

Remember: SPARQL is currently case sensitive, as elastic search is disabled in wikibase.cloud.

Namespace

Declare these namespaces at the start of every query:

PREFIX wd: <https://ottgaz.org/entity/>
PREFIX wdt: <https://ottgaz.org/prop/direct/>

Sample queries

Label

All items that are vilayets, as well as their English language label:

SELECT ?vilayet ?vilayetLabel
WHERE 
{
  ?vilayet wdt:P6 wd:Q5 . 
  optional { 
     ?vilayet rdfs:label ?vilayetLabel
     filter langMatches(lang(?vilayetLabel), "en")
   }
}