nichtich / wdq

Command line interface to Wikidata Query Service
https://metacpan.org/pod/distribution/App-wdq/script/wdq
Other
54 stars 4 forks source link

Support: how to extract other properties in addition to id and description #28

Closed aborruso closed 6 years ago

aborruso commented 6 years ago

Hi, with this query

wdq '?id wdt:P31 wd:Q747074' --text id --limit 5 -f csv

I extract the list of "third-level administrative divisions of the Italian Republic" (munipalities)

id,label,description
http://www.wikidata.org/entity/Q220,Rome,capital city of Italy
http://www.wikidata.org/entity/Q279,Modena,Italian city and comune
http://www.wikidata.org/entity/Q490,Milan,second-largest city in Italy
http://www.wikidata.org/entity/Q495,Turin,city and commune in Italy
http://www.wikidata.org/entity/Q541,Orvieto,Italian comune

Is it possible using this very simple way to write query, to add another property in the output (in example Property:P625, the coordinates)?

Thank you

With this

aborruso commented 6 years ago

I have used this one

wdq '?id wdt:P31 wd:Q747074 {?id wdt:P625 ?coordinates .}' --limit 5 --text id -f csv

And it works. Is it the right way to do it in wdq, or is there a more compact syntax?

Thank you