Hi,
I wrote a gadget editing Wikidata. I managed to find out how to add new statements to an item:
Code
guid= (new wb.utilities.ClaimGuidGenerator(qid)).newGuid();
cl = new wb.datamodel.Claim(snak, null, guid);
st = new wb.datamodel.Statement(cl);
g = new wb.datamodel.StatementGroup(prop);
g.addItem(st);
entity = new wikibase.datamodel.Item(qid);
deserializer = new wb.serialization.StatementDeserializer();
revisionStore = new wb.RevisionStore( mw.config.get( 'wgCurRevisionId' ) );
entityChangersFactory = new wb.entityChangers.EntityChangersFactory(
new wb.api.RepoApi(new mw.Api()),
revisionStore,
entity
);
sc = entityChangersFactory.getStatementsChanger();
sc.save(st).done( function ( result ) { /* … */ });
But what I haven’t figured out is how do I update the revisionStore, so that the newly added statement is editable. I’m kinda stuck here, so would appreciate any help.
And yes, I know that the Wikidata-Javascript-API is not stable yet and that such gadget might break in future – but I anyway don’t want to wait anymore.