Package org.wikidata.wdtk.wikibaseapi
Class TermStatementUpdate
java.lang.Object
org.wikidata.wdtk.wikibaseapi.StatementUpdate
org.wikidata.wdtk.wikibaseapi.TermStatementUpdate
Deprecated.
- Author:
- antonin
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTermStatementUpdate
(TermedStatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) Deprecated.Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAlias
(MonolingualTextValue alias) Deprecated.Adds an individual alias.protected void
deleteAlias
(MonolingualTextValue alias) Deprecated.Deletes an individual aliasgetAddedAliases
(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).Deprecated.Alias accessor provided for JSON serialization onlyDeprecated.Description accessor provided for JSON serialization only.Deprecated.Label accessor provided for JSON serialization only.getMonolingualUpdatedValues
(Map<String, org.wikidata.wdtk.wikibaseapi.TermStatementUpdate.NameWithUpdate> updates) Deprecated.Helper to format term updates as expected by the Wikibase APIgetRemovedAliases
(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).initUpdatesFromCurrentValues
(Collection<MonolingualTextValue> currentValues) Deprecated.Initializes the list of current values for a type of terms (label or description).boolean
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.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 itemMethods inherited from class org.wikidata.wdtk.wikibaseapi.StatementUpdate
addBestReferenceToList, addStatement, equivalentClaims, getDatamodelObjectFromResponse, getJsonUpdateString, getRevisionIdFromResponse, getUpdatedStatements, isSameSnakSet, markStatementsForDeletion, markStatementsForInsertion, markStatementsForUpdate, mergeReferences, setGuidGenerator
-
Field Details
-
currentDocument
Deprecated.
-
-
Constructor Details
-
TermStatementUpdate
public TermStatementUpdate(TermedStatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements, List<MonolingualTextValue> addLabels, List<MonolingualTextValue> addDescriptions, List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) Deprecated.Constructor. Plans an update on the statements and terms of a document. Statements are merged according to StatementUpdate's logic. Labels and descriptions will overwrite any existing values. The first aliases added on a language where no label is available yet will be treated as a label instead. Duplicate aliases are ignored.- Parameters:
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 entity
-
-
Method Details
-
initUpdatesFromCurrentValues
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).- Parameters:
currentValues
- current values for the type of terms- Returns:
- a map of updates (where all terms are marked as not for write)
-
processAliases
protected void processAliases(List<MonolingualTextValue> addAliases, List<MonolingualTextValue> deleteAliases) Deprecated.Processes changes on aliases, updating the planned state of the item.- Parameters:
addAliases
- aliases that should be added to the documentdeleteAliases
- aliases that should be removed from the document
-
deleteAlias
Deprecated.Deletes an individual alias- Parameters:
alias
- the alias to delete
-
addAlias
Deprecated.Adds an individual alias. It will be merged with the current list of aliases, or added as a label if there is no label for this item in this language yet.- Parameters:
alias
- the alias to add
-
processDescriptions
Deprecated.Adds descriptions to the item.- Parameters:
descriptions
- the descriptions to add
-
processLabels
Deprecated.Adds labels to the item- Parameters:
labels
- the labels to add
-
getLabelUpdates
Deprecated.Label accessor provided for JSON serialization only. -
getDescriptionUpdates
Deprecated.Description accessor provided for JSON serialization only. -
getAliasUpdates
Deprecated.Alias accessor provided for JSON serialization only -
isEmptyEdit
public boolean isEmptyEdit()Deprecated.Is this change null? (Which means that nothing at all will be changed on the item.)- Overrides:
isEmptyEdit
in classStatementUpdate
-
getAddedAliases
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).- Parameters:
language
- the language code of the added aliases- Returns:
- the list of added aliases
-
getRemovedAliases
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).- Parameters:
language
- : the language code of the removed aliases- Returns:
- the list of removed aliases
-
performEdit
public TermedStatementDocument performEdit(WbEditingAction action, boolean editAsBot, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException Deprecated.Performs the update, selecting the appropriate API action depending on the nature of the change.- Overrides:
performEdit
in classStatementUpdate
- Parameters:
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.- Returns:
- the new document after update with the API
- Throws:
MediaWikiApiErrorException
IOException
-
getMonolingualUpdatedValues
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- Parameters:
updates
- planned updates for the type of term- Returns:
- map ready to be serialized as JSON by Jackson
-
monolingualToJackson
Deprecated.Creates a monolingual value that is suitable for JSON serialization.- Parameters:
monolingualTextValue
- target monolingual value for serialization- Returns:
- Jackson implementation that is serialized appropriately
-
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