Closed nichtich closed 5 years ago
yes! I was thinking of something of this kind, but not knowing where to put it. I made an attempt to do that, which outputs something like this:
wd claims Q4115189 P31 --guid
returns
[
{
"guid": "Q4115189$DF92E189-4E3B-4397-AD41-B23998557E55",
"value": "Q2065736"
},
{
"guid": "Q4115189$02E70CCE-15FE-4FC5-A4C9-A38BF6D7E49B",
"value": "Q571"
}
]
What do you think?
In my opinion this should be the default because we can also get claim values by this:
$ wd d -s Q4115189 | jq .claims.P31
[
"Q2065736",
"Q571"
]
So I'd want
$ wd claims -j Q4115189 P31
[
{
"id": "Q4115189$DF92E189-4E3B-4397-AD41-B23998557E55",
"value": "Q2065736"
},
{
"id": "Q4115189$02E70CCE-15FE-4FC5-A4C9-A38BF6D7E49B",
"value": "Q571"
}
]
$ wd claims Q4115189 P31
Q4115189$DF92E189-4E3B-4397-AD41-B23998557E55 Q2065736
Q4115189$02E70CCE-15FE-4FC5-A4C9-A38BF6D7E49B Q571
By it could also be triggered by an option --ids
. Anyway the field should be named id
instead of guid
because this is the field name in original JSON data.
so since the freshly published v5.1.0
(thank to wikidata-sdk
v5.3.0
) , you can pass options to the simplify
function to produce the behavior you describe above:
wd data --simplify --keep ids Q4115189 | jq .claims.P31
or for short
wd d -sk ids Q4115189 | jq .claims.P31
closing this issue as there isn't much activity, please re-open if the proposed solution isn't satisfying
I'd like to get a claim guid for editing
wd claim $subject $property
prints the simplified object value. I'd expect some option, e.g.wd claims --guid $subject $property
.