Package org.openrefine.wikibase.editing
Class EditBatchProcessor
- java.lang.Object
-
- org.openrefine.wikibase.editing.EditBatchProcessor
-
public class EditBatchProcessor extends Object
Schedules and performs a list of updates to entities via the API.- Author:
- Antonin Delpeuch
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EditBatchProcessor.EditResult
-
Constructor Summary
Constructors Constructor Description EditBatchProcessor(org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher fetcher, org.wikidata.wdtk.wikibaseapi.WikibaseDataEditor editor, org.wikidata.wdtk.wikibaseapi.ApiConnection connection, 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EditBatchProcessor.EditResult
performEdit()
Performs the next edit in the batch.protected void
prepareNewBatch()
int
progress()
int
remainingEdits()
-
-
-
Constructor Detail
-
EditBatchProcessor
public EditBatchProcessor(org.wikidata.wdtk.wikibaseapi.WikibaseDataFetcher fetcher, org.wikidata.wdtk.wikibaseapi.WikibaseDataEditor editor, org.wikidata.wdtk.wikibaseapi.ApiConnection connection, 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 callingperformEdit()
.- Parameters:
fetcher
- the data fetcher to fetch the existing state of the entities to editeditor
- the editor to perform the editsconnection
- the connection to use to retrieve the current state of entities and edit thementityDocuments
- the list of entity updates to performlibrary
- the library to use to keep track of new entity creationsummary
- the summary to append to all editstags
- the list of tags to apply to all editsbatchSize
- the number of entities that should be retrieved in one go from the APImaxEditsPerMinute
- the maximum number of edits per minute to do
-
-
Method Detail
-
performEdit
public EditBatchProcessor.EditResult 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
-
-