maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
227 stars 24 forks source link

query for object and query #166

Closed maxlit closed 2 years ago

maxlit commented 2 years ago

In your documentation I found the command

wd query --property P921 --object Q44559 --labels

which I could run successfully. However, when I tried to look up the education (property P69 "educated at") of the current US President (Q6279), it gives me no results with the command

wb query -p P69 -o Q6279 --labels

At the same time I can find this information directly at the site: https://www.wikidata.org/wiki/Q6279 What am I doing wrong?

p.s. my "wb config --json" { "instance": "https://www.wikidata.org", "sparql-endpoint": "https://query.wikidata.org/sparql" }

tmtmtmtm commented 2 years ago

hi @maxlit

Your second command is essentially back-to-front: you're asking for anyone was educated at Joe Biden, rather than the places Joe Biden was educated at.

For the latter you'll want --subject rather than --object:

wd query -p P69 -s Q6279 --labels
maxlit commented 2 years ago

@tmtmtmtm I see, thanks!