So I would like to create a statement with a qualifier, in one go.
I do *not* want to use wbcreateclaim/wbsetqualifier if possible.
I have tried: action=wbsetclaim claim={ "type": "claim", "mainsnak": { "snaktype": "value", "property": "P50", "datatype": "wikibase-item", "datavalue": { "value": { "entity-type": "item", "numeric-id": 2069573 }, "type": "wikibase-entityid" } }, "qualifiers": { "P1545": [ { "snaktype": "value", "property": "P1545", "datavalue": { "value": "8", "type": "string" }, "datatype": "string" } ] }, "rank": "normal" }
But it complains about the missing GUID. Is there a way to create one automatically? Or to "fake" it? Neither the API or the docs on mediawiki.org were helpful in that respect.
Hi Magnus,
Yes, you can create your own statement GUIDs. They are, in essence, nothing but the entity ID and a random number.
$guid = $entityId->getSerialization() . '$' . trim( com_create_guid(), '{}' );
https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/... https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/...
I hope that helps. Sorry, no guarantee, Editing via action=wbeditentity should always work, but you will probably run into the same issue.
Best Thiemo
Thanks, that works! (I do wonder what the chance of collision is though... looks low, but still...)
On Wed, Oct 14, 2015 at 6:18 PM Thiemo Mättig thiemo.maettig@wikimedia.de wrote:
Hi Magnus,
Yes, you can create your own statement GUIDs. They are, in essence, nothing but the entity ID and a random number.
$guid = $entityId->getSerialization() . '$' . trim( com_create_guid(), '{}' );
https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/...
https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/...
I hope that helps. Sorry, no guarantee, Editing via action=wbeditentity should always work, but you will probably run into the same issue.
Best Thiemo _______________________________________________ Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
On Wed, Oct 14, 2015 at 1:54 PM, Magnus Manske magnusmanske@googlemail.com wrote:
(I do wonder what the chance of collision is though... looks low, but still...)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Random_UUID_prob...
Tom
Hi all,
I have also done this using wbeditentity without having to make any GUID.
Cheers,
Markus
On 14.10.2015 19:18, Thiemo Mättig wrote:
Hi Magnus,
Yes, you can create your own statement GUIDs. They are, in essence, nothing but the entity ID and a random number.
$guid = $entityId->getSerialization() . '$' . trim( com_create_guid(), '{}' );
https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/... https://github.com/wmde/WikibaseDataModelServices/blob/master/src/Statement/...
I hope that helps. Sorry, no guarantee, Editing via action=wbeditentity should always work, but you will probably run into the same issue.
Best Thiemo
Wikidata-tech mailing list Wikidata-tech@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
wikidata-tech@lists.wikimedia.org