-
Notifications
You must be signed in to change notification settings - Fork 6
Editing items with page
argument new=False
#15
Comments
Hi Fabian! Thank your for the detailed issue! Indeed my use case was only initial data upload with RaiseWikibase, so I didn't care much about Before handling with the secondary tables the problem with Let's continue tomorrow. |
I've uncommented the debugger options in LocalSettings.php.template and edited an item. At the item page I see the message |
Thank you for confirming that this is an issue and mentioning the best starting point to look closer into this. My experience with the database schema of MediaWiki is limited but I'll take a closer look into it the |
It seems the The current code works with the following example which creates one property & one item and then edits the item: from RaiseWikibase.datamodel import label, alias, description, snak, claim, entity
from RaiseWikibase.raiser import batch
p = entity(labels=label(value='Wikidata ID'),
aliases=alias(value=["WID", 'WikidataID']),
descriptions=description(value="ID of an entity in Wikidata"),
claims={},
etype='property',
datatype='external-id')
batch('wikibase-property', [p])
e = entity(labels=label(value='human'),
aliases={},
descriptions={},
claims={},
etype='item')
batch('wikibase-item', [e])
m = entity(labels=label(value='human'),
aliases=alias(value=['person']),
descriptions=description(value='a human being'),
claims=claim(prop='P1',
mainsnak=snak(datatype='external-id',
value='Q5',
prop='P1',
snaktype='value')),
etype='item')
m["id"]="Q1"
batch('wikibase-item', [m], new=False) Please let me know whether this works for you. |
Sorry, I just found the time to test it today. It works perfectly now. Thank you very much for the fast bug fix. |
I am trying to use the
page
function provided in the raiser module to edit existing items by setting thenew
argument toFalse
. However this seems to not work at all.My code looks like this:
Setting
new=True
creates a correct new item. Indicating that the Wikibase data format should be fine. Given that thenew=False
option causes in any case an issue for items and properties thepage
function might not be intended to change these types of pages. In that case this issue can be solved by using a completely different workflow to edit existing items and properties. If so a pointer towards a description of this workflow would help me a lot. If thepage
function is intended to be used to edit existing items and properties that part of thepage
function seems to contain a few bugs.Firstly, the local variable
new_eid
variable isn't assigned but used when trying to write the fingerprint into the secondary tables. However, after fixing this trying to write the fingerprint doesn't work either, because theconnection.insert_secondary([...])
method throws anMySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry '5-1' for key 'wbt_item_terms_term_in_lang_id [...]
exception if the same fingerprint or one with different values is used. Additionally, using an empty fingerprint runs without an error message, but corrupts the item page (most likely due to removing the whole fingerprint). In general usingpage
withnew=False
seem to leave the MediaWiki database in an inconsistent state.I hope this error can be reproduced with the help of this description. Please, let me know if you need additional information. I am happy to help with fixing this issue.
Best,
Fabian
The text was updated successfully, but these errors were encountered: