Class EditBatchProcessor

java.lang.Object
org.openrefine.wikidata.editing.EditBatchProcessor

public class EditBatchProcessor extends Object
Schedules and performs a list of updates to entities via the API.
Author:
Antonin Delpeuch
  • Constructor Details

    • EditBatchProcessor

      public EditBatchProcessor(org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher fetcher, org.wikidata.wdtk.wikibaseapi.WikibaseDataEditor editor, List<EntityEdit> entityDocuments, NewEntityLibrary library, String summary, int maxLag, List<String> tags, int batchSize, int maxEditsPerMinute)
      Initiates the process of pushing a batch of updates to Wikibase. This schedules the updates and is a prerequisite for calling performOneEdit.
      Parameters:
      fetcher - the fetcher to use to retrieve the current state of entities
      editor - the object to use to perform the edits
      entityDocuments - the list of entity updates to perform
      library - the library to use to keep track of new entity creation
      summary - the summary to append to all edits
      tags - the list of tags to apply to all edits
      batchSize - the number of entities that should be retrieved in one go from the API
      maxEditsPerMinute - the maximum number of edits per minute to do
  • Method Details

    • performEdit

      public void performEdit() throws InterruptedException
      Performs the next edit in the batch.
      Throws:
      InterruptedException
    • remainingEdits

      public int remainingEdits()
      Returns:
      the number of edits that remain to be done in the current batch
    • progress

      public int progress()
      Returns:
      the progress, measured as a percentage
    • prepareNewBatch

      protected void prepareNewBatch() throws InterruptedException
      Throws:
      InterruptedException