public class WikibaseDataEditor extends Object
Constructor and Description |
---|
WikibaseDataEditor(ApiConnection connection,
String siteUri)
Creates an object to edit data via the Web API of the given
ApiConnection object. |
WikibaseDataEditor(ApiConnection connection,
String siteUri,
GuidGenerator generator)
Creates an object to edit data via the Web API of the given
ApiConnection object. |
Modifier and Type | Method and Description |
---|---|
EntityDocument |
createEntityDocument(EntityDocument document,
String summary,
List<String> tags)
Creates new entity document.
|
ItemDocument |
createItemDocument(ItemDocument document,
String summary,
List<String> tags)
Creates new item document.
|
LexemeDocument |
createLexemeDocument(LexemeDocument document,
String summary,
List<String> tags)
Creates new lexeme document.
|
PropertyDocument |
createPropertyDocument(PropertyDocument document,
String summary,
List<String> tags)
Creates new property document.
|
void |
disableEditing()
Sets the remaining edits for this component to 0, so that all edits are
simulated but not actually send to the API.
|
boolean |
editAsBot()
Returns true if edits should be flagged as bot edits.
|
EditingResult |
editEntityDocument(EntityUpdate update,
boolean clear,
String summary,
List<String> tags)
Updates
EntityDocument entity. |
ItemDocument |
editItemDocument(ItemDocument itemDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Writes the data for the given item document with the summary message as
given. Optionally, the existing data is cleared (deleted).
The id of the given item document is used to specify which item document should be changed. The site IRI will be ignored for this. The revision id of the given item document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear"). If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels, descriptions, and aliases will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in a language will overwrite all aliases in this language, so some care is needed. |
MediaInfoDocument |
editMediaInfoDocument(MediaInfoDocument mediaInfoDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Writes the data for the given media info document with the summary message
as given. Optionally, the existing data is cleared (deleted).
It creates the media info if needed.
The id of the given media info document is used to specify which media info document should be changed or created. The site IRI will be ignored for this. The revision id of the given media info document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear"). If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in |
PropertyDocument |
editPropertyDocument(PropertyDocument propertyDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Writes the data for the given property document with the summary message
as given. Optionally, the existing data is cleared (deleted).
The id of the given property document is used to specify which property document should be changed. The site IRI will be ignored for this. The revision id of the given property document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear"). If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels, descriptions, and aliases will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in a language will overwrite all aliases in this language, so some care is needed. |
int |
getAverageTimePerEdit()
Returns the average time that a single edit should take, measured in
milliseconds.
|
int |
getMaxLag()
Returns the current value of the maxlag parameter.
|
double |
getMaxLagBackOffFactor()
Factor by which the wait time between two maxlag retries should be
multiplied at each attempt.
|
int |
getMaxLagFirstWaitTime()
Initial wait time in milliseconds, when an edit fails for the first
time because of a high lag.
|
int |
getMaxLagMaxRetries()
Number of times we should retry if an editing action fails because
the lag is too high.
|
int |
getRemainingEdits()
Returns the number of edits that will be performed before entering
simulation mode, or -1 if there is no limit on the number of edits
(default).
|
protected long |
getRevisionIdFromResponse(com.fasterxml.jackson.databind.JsonNode response)
Extracts the last revision id from the JSON response returned
by the API after an edit
|
void |
nullEdit(EntityIdValue entityId)
Performs a null edit on an entity.
|
<T extends StatementDocument> |
nullEdit(ItemIdValue itemId)
Deprecated.
Use
nullEdit(EntityIdValue) instead.
Performs a null edit on an item. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI. |
<T extends StatementDocument> |
nullEdit(PropertyIdValue propertyId)
Deprecated.
Use
nullEdit(EntityIdValue) instead.
Performs a null edit on a property. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI. |
<T extends EntityDocument> |
nullEdit(T currentDocument)
Performs a null edit on an entity.
|
void |
setAverageTimePerEdit(int milliseconds)
Sets the average time that a single edit should take, measured in
milliseconds.
|
void |
setEditAsBot(boolean editAsBot)
Switches the use of the bot parameter on or of.
|
void |
setMaxLag(int maxLag)
Set the value of the maxlag parameter.
|
void |
setMaxLagBackOffFactor(double value)
Factor by which the wait time between two maxlag retries should be
multiplied at each attempt.
|
void |
setMaxLagFirstWaitTime(int time)
Initial wait time in milliseconds, when an edit fails for the first
time because of a high lag.
|
void |
setMaxLagMaxRetries(int retries)
Number of times we should retry if an editing action fails because
the lag is too high.
|
void |
setRemainingEdits(int remainingEdits)
Sets the number of edits that this object can still perform.
|
ItemDocument |
updateStatements(ItemIdValue itemIdValue,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Updates the statements of the item document identified by the given item
id. The updates are computed with respect to the current data found
online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. |
PropertyDocument |
updateStatements(PropertyIdValue propertyIdValue,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Updates the statements of the property document identified by the given
property id. The computation of updates is the same as for
updateStatements(ItemIdValue, List, List, String, List) . |
<T extends StatementDocument> |
updateStatements(T currentDocument,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Updates statements of the given document. The document should be the
current revision of the data that is to be updated. The updates are
computed with respect to the data found in the document, making sure that
no redundant deletions or duplicate insertions happen. The references of
duplicate statements will be merged.
The generic type T of this method must be a general interface such as
|
ItemDocument |
updateTermsStatements(ItemIdValue itemIdValue,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Updates the terms and statements of the item document identified by the
given item id. The updates are computed with respect to the current data
found online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given language are kept distinct. |
<T extends TermedStatementDocument> |
updateTermsStatements(T currentDocument,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
editEntityDocument(EntityUpdate, boolean, String, List) instead.
Updates the terms and statements of the current document.
The updates are computed with respect to the current data in the document,
making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given language are kept distinct. |
public WikibaseDataEditor(ApiConnection connection, String siteUri)
ApiConnection
object. The site URI is necessary to create data
objects from API responses, since it is not contained in the data
retrieved from the URI.connection
- ApiConnectionsiteUri
- the URI identifying the site that is accessed (usually the
prefix of entity URIs), e.g.,
"http://www.wikidata.org/entity/"public WikibaseDataEditor(ApiConnection connection, String siteUri, GuidGenerator generator)
ApiConnection
object. The site URI is necessary to create data
objects from API responses, since it is not contained in the data
retrieved from the URI.connection
- ApiConnectionsiteUri
- the URI identifying the site that is accessed (usually the
prefix of entity URIs), e.g.,
"http://www.wikidata.org/entity/"generator
- the generator to use when creating fresh GUIDs for statements,
snaks or referencespublic boolean editAsBot()
setEditAsBot(boolean)
for details.public void setEditAsBot(boolean editAsBot)
editAsBot
- public int getMaxLag()
public void setMaxLag(int maxLag)
getMaxLag()
for details.maxLag
- the new value in secondspublic int getMaxLagMaxRetries()
public void setMaxLagMaxRetries(int retries)
public int getMaxLagFirstWaitTime()
public void setMaxLagFirstWaitTime(int time)
public double getMaxLagBackOffFactor()
public void setMaxLagBackOffFactor(double value)
public int getAverageTimePerEdit()
WbEditingAction.getAverageTimePerEdit()
for
details.public void setAverageTimePerEdit(int milliseconds)
WbEditingAction.getAverageTimePerEdit()
for
details.milliseconds
- the new value in millisecondspublic int getRemainingEdits()
WbEditingAction.getRemainingEdits()
for
details.public void setRemainingEdits(int remainingEdits)
WbEditingAction.setRemainingEdits(int)
for details.remainingEdits
- number of edits that can still be performed, or -1 to disable
this limit (default setting)public void disableEditing()
public EntityDocument createEntityDocument(EntityDocument document, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
ItemIdValue.NULL
, and its revision ID must be 0.
The newly created document is returned. It will contain the new item ID and revision ID. Note that the site IRI used in the item ID is not part of the API response. The site IRI given when constructing this object is used in its place.
Statements in the provided document must not have IDs.
Summary message will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Everything above that limit will be cut off.
document
- document that contains the data to be writtensummary
- summary for the edittags
- string identifiers of the tags to apply to the edit, null
or empty for no tagsnull
for simulated edit (see
disableEditing()
IOException
- if there was an IO problem, such as missing network connectionMediaWikiApiErrorException
- if MediaWiki API returned an error responsepublic ItemDocument createItemDocument(ItemDocument document, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
ItemIdValue.NULL
, and its revision ID must be 0.
The newly created document is returned. It will contain the new item ID and revision ID. Note that the site IRI used in the item ID is not part of the API response. The site IRI given when constructing this object is used in its place.
Statements in the provided document must not have IDs.
Summary message will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Everything above that limit will be cut off.
document
- document that contains the data to be writtensummary
- summary for the edittags
- string identifiers of the tags to apply to the edit, null
or empty for no tagsnull
for simulated edit (see
disableEditing()
IOException
- if there was an IO problem, such as missing network connectionMediaWikiApiErrorException
- if MediaWiki API returned an error responsepublic PropertyDocument createPropertyDocument(PropertyDocument document, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
PropertyIdValue.NULL
, and its revision ID must
be 0.
The newly created document is returned. It will contain the new property ID and revision ID. Note that the site IRI used in the property ID is not part of the API response. The site IRI given when constructing this object is used in its place.
Statements in the provided document must not have IDs.
Summary message will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Everything above that limit will be cut off.
document
- document that contains the data to be writtensummary
- summary for the edittags
- string identifiers of the tags to apply to the edit, null
or empty for no tagsnull
for simulated edit
(see disableEditing()
IOException
- if there was an IO problem, such as missing network connectionMediaWikiApiErrorException
- if MediaWiki API returned an error responsepublic LexemeDocument createLexemeDocument(LexemeDocument document, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
LexemeIdValue.NULL
, and its revision ID must be 0.
The newly created document is returned. It will contain the new lexeme ID and revision ID. Note that the site IRI used in the lexeme ID is not part of the API response. The site IRI given when constructing this object is used in its place.
Statements, senses, and forms in the provided document must not have IDs.
Summary message will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Everything above that limit will be cut off.
document
- document that contains the data to be writtensummary
- summary for the edittags
- string identifiers of the tags to apply to the edit, null
or empty for no tagsnull
for simulated edit (see
disableEditing()
IOException
- if there was an IO problem, such as missing network connectionMediaWikiApiErrorException
- if MediaWiki API returned an error response@Deprecated public ItemDocument editItemDocument(ItemDocument itemDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Writes the data for the given item document with the summary message as
given. Optionally, the existing data is cleared (deleted).
The id of the given item document is used to specify which item document should be changed. The site IRI will be ignored for this.
The revision id of the given item document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear").
If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels, descriptions, and aliases will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in a language will overwrite all aliases in this language, so some care is needed.
itemDocument
- the document that contains the data to be writtenclear
- if true, the existing data will be replaced by the given data;
if false, the given data will be added to the existing data,
overwriting only parts that are set to new valuessummary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.IOException
- if there was an IO problem, such as missing network
connectionMediaWikiApiErrorException
public EditingResult editEntityDocument(EntityUpdate update, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
EntityDocument
entity. ID of the entity to update is taken
from the update object. Its site IRI is ignored. No action is taken if the
update is empty.
If the update object references base revision of the document, its revision ID is used to specify the base revision in the API request, enabling the API to detect edit conflicts. It is strongly recommended to specify base revision document in the update object.
Summary message will be prepended by an automatically generated comment. The length limit of the autocomment together with the summary is 260 characters. Everything above that limit will be cut off.
update
- collection of changes to be writtenclear
- if set to true
, existing entity data will be removed and
the update will be applied to empty entitysummary
- summary for the edittags
- string identifiers of the tags to apply to the edit, null
or empty for no tagsIOException
- if there was an IO problem, such as missing network connectionMediaWikiApiErrorException
- if MediaWiki API returned an error response@Deprecated public PropertyDocument editPropertyDocument(PropertyDocument propertyDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Writes the data for the given property document with the summary message
as given. Optionally, the existing data is cleared (deleted).
The id of the given property document is used to specify which property document should be changed. The site IRI will be ignored for this.
The revision id of the given property document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear").
If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels, descriptions, and aliases will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in a language will overwrite all aliases in this language, so some care is needed.
propertyDocument
- the document that contains the data to be writtenclear
- if true, the existing data will be replaced by the given data;
if false, the given data will be added to the existing data,
overwriting only parts that are set to new valuessummary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.IOException
- if there was an IO problem, such as missing network
connectionMediaWikiApiErrorException
@Deprecated public MediaInfoDocument editMediaInfoDocument(MediaInfoDocument mediaInfoDocument, boolean clear, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Writes the data for the given media info document with the summary message
as given. Optionally, the existing data is cleared (deleted).
It creates the media info if needed.
The id of the given media info document is used to specify which media info document should be changed or created. The site IRI will be ignored for this.
The revision id of the given media info document is used to specify the base revision, enabling the API to detect edit conflicts. The value 0 can be used to omit this. It is strongly recommended to give a revision id when making edits where the outcome depends on the previous state of the data (i.e., any edit that does not use "clear").
If the data is not cleared, then the existing data will largely be preserved. Statements with empty ids will be added without checking if they exist already; statements with (valid) ids will replace any existing statements with these ids or just be added if there are none. Labels will be preserved for all languages for which no data is given at all. For aliases this means that writing one alias in
mediaInfoDocument
- the document that contains the data to be writtenclear
- if true, the existing data will be replaced by the given data;
if false, the given data will be added to the existing data,
overwriting only parts that are set to new valuessummary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.IOException
- if there was an IO problem, such as missing network
connectionMediaWikiApiErrorException
@Deprecated public ItemDocument updateStatements(ItemIdValue itemIdValue, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Updates the statements of the item document identified by the given item
id. The updates are computed with respect to the current data found
online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged.itemIdValue
- id of the document to be updatedaddStatements
- the list of statements to be added or updated; statements with
empty statement id will be added; statements with non-empty
statement id will be updated (if such a statement exists)deleteStatements
- the list of statements to be deleted; statements will only be
deleted if they are present in the current document (in
exactly the same form, with the same id)summary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.MediaWikiApiErrorException
- if the API returns errorsIOException
- if there are IO problems, such as missing network connection@Deprecated public ItemDocument updateTermsStatements(ItemIdValue itemIdValue, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Updates the terms and statements of the item document identified by the
given item id. The updates are computed with respect to the current data
found online, making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given language are kept distinct.itemIdValue
- id of the document to be updatedaddLabels
- labels to be set on the item. They will overwrite existing values
in the same language.addDescriptions
- description to be set on the item. They will overwrite existing values
in the same language.addAliases
- aliases to be added. Existing aliases will be kept.deleteAliases
- aliases to be deleted.addStatements
- the list of statements to be added or updated; statements with
empty statement id will be added; statements with non-empty
statement id will be updated (if such a statement exists)deleteStatements
- the list of statements to be deleted; statements will only be
deleted if they are present in the current document (in
exactly the same form, with the same id)summary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.MediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connection@Deprecated public PropertyDocument updateStatements(PropertyIdValue propertyIdValue, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Updates the statements of the property document identified by the given
property id. The computation of updates is the same as for
updateStatements(ItemIdValue, List, List, String, List)
.propertyIdValue
- id of the document to be updatedaddStatements
- the list of statements to be added or updated; statements with
empty statement id will be added; statements with non-empty
statement id will be updated (if such a statement exists)deleteStatements
- the list of statements to be deleted; statements will only be
deleted if they are present in the current document (in
exactly the same form, with the same id)summary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.MediaWikiApiErrorException
- if the API returns errorsIOException
- if there are IO problems, such as missing network connection@Deprecated public <T extends StatementDocument> T updateStatements(T currentDocument, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Updates statements of the given document. The document should be the
current revision of the data that is to be updated. The updates are
computed with respect to the data found in the document, making sure that
no redundant deletions or duplicate insertions happen. The references of
duplicate statements will be merged.
The generic type T of this method must be a general interface such as
ItemDocument
, PropertyDocument
, or
StatementDocument
. Specific implementations of these interfaces
are not permitted.
currentDocument
- the document that is to be updated; needs to have a correct
revision id and entity idaddStatements
- the list of statements to be added or updated; statements with
empty statement id will be added; statements with non-empty
statement id will be updated (if such a statement exists)deleteStatements
- the list of statements to be deleted; statements will only be
deleted if they are present in the current document (in
exactly the same form, with the same id)summary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.
Ignored if null or empty.MediaWikiApiErrorException
- if the API returns errorsIOException
- if there are IO problems, such as missing network connection@Deprecated public <T extends TermedStatementDocument> T updateTermsStatements(T currentDocument, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases, List<Statement> addStatements, List<Statement> deleteStatements, String summary, List<String> tags) throws MediaWikiApiErrorException, IOException
editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Updates the terms and statements of the current document.
The updates are computed with respect to the current data in the document,
making sure that no redundant deletions or duplicate insertions
happen. The references of duplicate statements will be merged. The labels
and aliases in a given language are kept distinct.currentDocument
- the document to be updated; needs to have a correct revision id and
entity idaddLabels
- labels to be set on the item. They will overwrite existing values
in the same language.addDescriptions
- description to be set on the item. They will overwrite existing values
in the same language.addAliases
- aliases to be added. Existing aliases will be kept.deleteAliases
- aliases to be deleted.addStatements
- the list of statements to be added or updated; statements with
empty statement id will be added; statements with non-empty
statement id will be updated (if such a statement exists)deleteStatements
- the list of statements to be deleted; statements will only be
deleted if they are present in the current document (in
exactly the same form, with the same id)summary
- summary for the edit; will be prepended by an automatically
generated comment; the length limit of the autocomment
together with the summary is 260 characters: everything above
that limit will be cut offtags
- string identifiers of the tags to apply to the edit.
Ignored if null or empty.MediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connectionpublic void nullEdit(EntityIdValue entityId) throws IOException, MediaWikiApiErrorException
entityId
- the document to perform a null edit onMediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connection@Deprecated public <T extends StatementDocument> void nullEdit(ItemIdValue itemId) throws IOException, MediaWikiApiErrorException
nullEdit(EntityIdValue)
instead.
Performs a null edit on an item. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI.itemId
- the document to perform a null edit onMediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connection@Deprecated public <T extends StatementDocument> void nullEdit(PropertyIdValue propertyId) throws IOException, MediaWikiApiErrorException
nullEdit(EntityIdValue)
instead.
Performs a null edit on a property. This has some effects on Wikibase,
such as refreshing the labels of the referred items in the UI.propertyId
- the document to perform a null edit onMediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connectionpublic <T extends EntityDocument> T nullEdit(T currentDocument) throws IOException, MediaWikiApiErrorException
currentDocument
- the document to perform a null edit onMediaWikiApiErrorException
- if the API returns errorsIOException
- if there are any IO errors, such as missing network connectionprotected long getRevisionIdFromResponse(com.fasterxml.jackson.databind.JsonNode response) throws com.fasterxml.jackson.core.JsonProcessingException
response
- the response as returned by Mediawikicom.fasterxml.jackson.core.JsonProcessingException
Copyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage