Looking at the code it is indeed impossible to pass an empty guid in currently in SetClaim.php
The ChangeOpClaim class that SetClaim uses can actually handle no guid in a claim and will create one for such a claim but it looks like we don't use this in SetClaim, and can't.
The reason we can not accept an empty GUID is that wbsetclaim then has no way of knowing where you would intend to create the claim.

If you take a look at the wbeditentity module you should be able to do everything through there! i.e. pass in a claim with no guid and it will be created.

Addshore


On 26 February 2014 19:01, Markus Krötzsch <markus@semantic-mediawiki.org> wrote:
On 26/02/14 18:41, Jeroen De Dauw wrote:
Hey,

 >> you can create claims with wbsetclaim. But you would need to create
a valid
 >> GUID [1] yourself. The claim-GUID you send with your request needs to be
 >> <entityId>$<GUID> (e.g. Q2$5627445f-43cb-ed6d-3adb-760e66bd17ee).

 > Uh, didn't we fix this a long time ago? Client-Supplied GUIDs are evil :(

This has come up at some point, and as far as I recall, we dropped the
requirement to provide the GUID. So I suspect one can provide a claim
without a GUID, else something went wrong somewhere.

 > Requests with GUIDs that are not associated with any Statement should
be rejected

Not allowing specifying GUIDs is another topic altogether. Disallowing
them is not the intention of the current system, and needs discussion
before that is changed. This seems to be both out of scope of this
thread and be way to low on the priority list (after all, where is the
problem, its been working just fine) to spend time on.

As Daniel said: "Client-Supplied GUIDs are evil :(". My only point was that one should never use such GUIDs for new statements. Returning an error seems better than just creating a new GUID, but both would work. Mainly, we should not use externally provided GUIDs. For example, if somebody is mistaken to believe that any string of the proper format can be used, then we might get bot code where the "GUID" is based on a constant. Wikibase should better make sure that it uses quality GUIDs, which are as random as a GUID is supposed to be.


Markus


_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech