UB-Mannheim / RaiseWikibase

Knowledge graph construction: Fast inserts into a Wikibase instance
https://ub-mannheim.github.io/RaiseWikibase/
MIT License
45 stars 6 forks source link

adding statements to existing items with batch(new=False) deletes existing statements. #20

Open MHuberFaust opened 2 years ago

MHuberFaust commented 2 years ago

Hi,

I want to add statements to existing items using batch(new=False) to enrich the items in my Wikibase instance.

Unfortunately, already existing statements were deleted.

Having batch(new=False) add statements without deleting already existing ones would be quite useful. Either as default behaviour or as an option. I will look into it as soon as I find the time, but that might take a while.

Best, Michael

shigapov commented 2 years ago

Right, because it replaces the whole JSON representation of an item. To add what you propose we would need to read old_text from text-table (https://www.mediawiki.org/wiki/Manual:Text_table), to convert it to JSON, to add the statements to it, and only then to write it via batch(new=False).