WikibaseDataEditor.editEntityDocument(EntityUpdate, boolean, String, List)
instead.
This class extends StatementUpdate to support update to terms (labels,
descriptions and aliases).
Various safeguards are implemented in this interface:
- aliases are added and deleted independently
- duplicate aliases cannot be added
- adding an alias in a language that does not have a label sets the label instead@Deprecated public class TermStatementUpdate extends StatementUpdate
Modifier and Type | Field and Description |
---|---|
protected TermedStatementDocument |
currentDocument
Deprecated.
|
Constructor and Description |
---|
TermStatementUpdate(TermedStatementDocument currentDocument,
List<Statement> addStatements,
List<Statement> deleteStatements,
List<MonolingualTextValue> addLabels,
List<MonolingualTextValue> addDescriptions,
List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases)
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAlias(MonolingualTextValue alias)
Deprecated.
Adds an individual alias.
|
protected void |
deleteAlias(MonolingualTextValue alias)
Deprecated.
Deletes an individual alias
|
List<MonolingualTextValue> |
getAddedAliases(String language)
Deprecated.
Retrieves the list of aliases that will be added in a
given language, after all the optimizations have been done
(replacing empty labels by new aliases in the same language,
for instance).
|
Map<String,List<TermImpl>> |
getAliasUpdates()
Deprecated.
Alias accessor provided for JSON serialization only
|
Map<String,TermImpl> |
getDescriptionUpdates()
Deprecated.
Description accessor provided for JSON serialization only.
|
Map<String,TermImpl> |
getLabelUpdates()
Deprecated.
Label accessor provided for JSON serialization only.
|
protected Map<String,TermImpl> |
getMonolingualUpdatedValues(Map<String,org.wikidata.wdtk.wikibaseapi.TermStatementUpdate.NameWithUpdate> updates)
Deprecated.
Helper to format term updates as expected by the Wikibase API
|
List<MonolingualTextValue> |
getRemovedAliases(String language)
Deprecated.
Retrieves the list of aliases that will be removed in a
given language, after all the optimizations have been done
(replacing empty labels by new aliases in the same language,
for instance).
|
protected Map<String,org.wikidata.wdtk.wikibaseapi.TermStatementUpdate.NameWithUpdate> |
initUpdatesFromCurrentValues(Collection<MonolingualTextValue> currentValues)
Deprecated.
Initializes the list of current values for a type of terms (label or description).
|
boolean |
isEmptyEdit()
Deprecated.
Is this change null? (Which means that nothing at all
will be changed on the item.)
|
protected TermImpl |
monolingualToJackson(MonolingualTextValue monolingualTextValue)
Deprecated.
Creates a monolingual value that is suitable for JSON serialization.
|
TermedStatementDocument |
performEdit(WbEditingAction action,
boolean editAsBot,
String summary,
List<String> tags)
Deprecated.
Performs the update, selecting the appropriate API action depending on
the nature of the change.
|
protected void |
processAliases(List<MonolingualTextValue> addAliases,
List<MonolingualTextValue> deleteAliases)
Deprecated.
Processes changes on aliases, updating the planned state of the item.
|
protected void |
processDescriptions(List<MonolingualTextValue> descriptions)
Deprecated.
Adds descriptions to the item.
|
protected void |
processLabels(List<MonolingualTextValue> labels)
Deprecated.
Adds labels to the item
|
addBestReferenceToList, addStatement, equivalentClaims, getDatamodelObjectFromResponse, getJsonUpdateString, getRevisionIdFromResponse, getUpdatedStatements, isSameSnakSet, markStatementsForDeletion, markStatementsForInsertion, markStatementsForUpdate, mergeReferences, setGuidGenerator
protected final TermedStatementDocument currentDocument
public TermStatementUpdate(TermedStatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases)
currentDocument
- the current state of the entityaddStatements
- the statements to be added to the entity.deleteStatements
- the statements to be removed from the entityaddLabels
- the labels to be added to the entityaddDescriptions
- the descriptions to be added to the entityaddAliases
- the aliases to be added to the entitydeleteAliases
- the aliases to be removed from the entityprotected Map<String,org.wikidata.wdtk.wikibaseapi.TermStatementUpdate.NameWithUpdate> initUpdatesFromCurrentValues(Collection<MonolingualTextValue> currentValues)
currentValues
- current values for the type of termsprotected void processAliases(List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases)
addAliases
- aliases that should be added to the documentdeleteAliases
- aliases that should be removed from the documentprotected void deleteAlias(MonolingualTextValue alias)
alias
- the alias to deleteprotected void addAlias(MonolingualTextValue alias)
alias
- the alias to addprotected void processDescriptions(List<MonolingualTextValue> descriptions)
descriptions
- the descriptions to addprotected void processLabels(List<MonolingualTextValue> labels)
labels
- the labels to addpublic Map<String,TermImpl> getLabelUpdates()
public Map<String,TermImpl> getDescriptionUpdates()
public Map<String,List<TermImpl>> getAliasUpdates()
public boolean isEmptyEdit()
isEmptyEdit
in class StatementUpdate
public List<MonolingualTextValue> getAddedAliases(String language)
language
- the language code of the added aliasespublic List<MonolingualTextValue> getRemovedAliases(String language)
language:
- the language code of the removed aliasespublic TermedStatementDocument performEdit(WbEditingAction action, boolean editAsBot, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
performEdit
in class StatementUpdate
action
- the endpoint to which the change should be pushededitAsBot
- if true, the edit will be flagged as a "bot edit" provided that
the logged in user is in the bot group; for regular users, the
flag will just be ignoredsummary
- 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
IOException
protected Map<String,TermImpl> getMonolingualUpdatedValues(Map<String,org.wikidata.wdtk.wikibaseapi.TermStatementUpdate.NameWithUpdate> updates)
updates
- planned updates for the type of termprotected TermImpl monolingualToJackson(MonolingualTextValue monolingualTextValue)
monolingualTextValue
- target monolingual value for serializationCopyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage