I'm new to Wikidata and I'm wanting to query it. The official page list several promising syntax / APIs :
WDQ "Wikidata Query" syntax : http://wdq.wmflabs.org/api_documentation.html
SPARQL syntax via WDQS "Wikidata Query Service" endpoint : https://www.mediawiki.org/wiki/Wikimedia_Discovery#Wikidata_Query_Service_.28WDQS.29
The WDQ syntax seems more concise, ex :
- WDQ :
CLAIM[31:6465] AND NOCLAIM[576]
vs. - SPARQL (same query) :
prefix wdt: <http://www.wikidata.org/prop/direct/> prefix wd: <http://www.wikidata.org/entity/> SELECT ?item WHERE { ?item wdt:P31 wd:Q6465 . OPTIONAL { ?item wdt:P576 ?dummy0 } FILTER(!bound(?dummy0)) }
However, reading https://www.mediawiki.org/wiki/Wikimedia_Discovery#Wikidata_Query_Service_.28WDQS.29 I'm under the impression that WDQ is an unofficial experiment and that SPARQL is the official query syntax.
So is there an official or preferred way of querying wikidata ? Is it safe to invest in WDQ or should I go SPARQL ?
FILTER NOT EXISTS {?item wdt:P576 []}
(instead ofOPTIONAL { ?item wdt:P576 ?dummy0 } FILTER(!bound(?dummy0))
), which is slightly shorter.