Class ItemUpdateBuilder
java.lang.Object
org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.LabeledDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.TermedDocumentUpdateBuilder
org.wikidata.wdtk.datamodel.helpers.ItemUpdateBuilder
Builder for incremental construction of
ItemUpdate
objects.-
Method Summary
Modifier and TypeMethodDescriptionappend
(ItemUpdate update) Replays all changes in provided update into this builder object.build()
Creates newTermedStatementDocumentUpdate
object with contents of this builder object.static ItemUpdateBuilder
forBaseRevision
(ItemDocument revision) Creates new builder object for constructing update of given base item entity revision.static ItemUpdateBuilder
forBaseRevisionId
(ItemIdValue itemId, long revisionId) Creates new builder object for constructing update of item entity with given revision ID.static ItemUpdateBuilder
forEntityId
(ItemIdValue itemId) Creates new builder object for constructing update of item entity with given ID.putSiteLink
(SiteLink link) Adds or replaces site link.removeSiteLink
(String site) Removes site link.updateAliases
(String language, AliasUpdate update) Updates entity aliases.updateDescriptions
(TermUpdate update) Updates entity descriptions.updateLabels
(TermUpdate update) Updates entity labels.updateStatements
(StatementUpdate update) Updates entity statements.Methods inherited from class org.wikidata.wdtk.datamodel.helpers.TermedDocumentUpdateBuilder
forBaseRevision, forBaseRevisionId, forEntityId
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.LabeledDocumentUpdateBuilder
forBaseRevision
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.StatementDocumentUpdateBuilder
forBaseRevision
Methods inherited from class org.wikidata.wdtk.datamodel.helpers.EntityUpdateBuilder
forBaseRevision
-
Method Details
-
forBaseRevisionId
Creates new builder object for constructing update of item entity with given revision ID.- Parameters:
itemId
- ID of the item entity that is to be updatedrevisionId
- ID of the base item revision to be updated or zero if not available- Returns:
- update builder object
- Throws:
NullPointerException
- ifitemId
isnull
IllegalArgumentException
- ifitemId
is a placeholder ID
-
forEntityId
Creates new builder object for constructing update of item entity with given ID.- Parameters:
itemId
- ID of the item entity that is to be updated- Returns:
- update builder object
- Throws:
NullPointerException
- ifitemId
isnull
IllegalArgumentException
- ifitemId
is a placeholder ID
-
forBaseRevision
Creates new builder object for constructing update of given base item entity revision. Provided item document might not represent the latest revision of the item entity as currently stored in Wikibase. It will be used for validation in builder methods. If the document has revision ID, it will be used to detect edit conflicts.- Parameters:
revision
- base item entity revision to be updated- Returns:
- update builder object
- Throws:
NullPointerException
- ifrevision
isnull
IllegalArgumentException
- ifrevision
has placeholder ID
-
updateStatements
Description copied from class:StatementDocumentUpdateBuilder
Updates entity statements. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.- Overrides:
updateStatements
in classTermedDocumentUpdateBuilder
- Parameters:
update
- statement update, possibly empty- Returns:
this
(fluent method)
-
updateLabels
Description copied from class:LabeledDocumentUpdateBuilder
Updates entity labels. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.- Overrides:
updateLabels
in classTermedDocumentUpdateBuilder
- Parameters:
update
- changes in entity labels- Returns:
this
(fluent method)
-
updateDescriptions
Description copied from class:TermedDocumentUpdateBuilder
Updates entity descriptions. If this method is called multiple times, changes are accumulated. If base entity revision was provided, redundant changes are silently ignored, resulting in empty update.- Overrides:
updateDescriptions
in classTermedDocumentUpdateBuilder
- Parameters:
update
- changes in entity descriptions- Returns:
this
(fluent method)
-
updateAliases
Description copied from class:TermedDocumentUpdateBuilder
Updates entity aliases. If this method is called multiple times, changes are accumulated. If base entity revision was provided, the update is checked against it and redundant changes are silently ignored, resulting in empty update.- Overrides:
updateAliases
in classTermedDocumentUpdateBuilder
- Parameters:
language
- language code of the altered aliasesupdate
- alias changes- Returns:
this
(fluent method)
-
putSiteLink
Adds or replaces site link. If there is no site link for the site key, new site link is added. If a site link with this site key already exists, it is replaced. Site links with other site keys are not touched. Calling this method overrides any previous changes made with the same site key by this method orremoveSiteLink(String)
.If base entity revision was provided, attempt to overwrite some site link with identical site link will be silently ignored, resulting in empty update.
- Parameters:
link
- new or replacement site link- Returns:
this
(fluent method)- Throws:
NullPointerException
- iflink
isnull
-
removeSiteLink
Removes site link. Site links with other site keys are not touched. Calling this method overrides any previous changes made with the same site key by this method orputSiteLink(SiteLink)
.If base entity revision was provided, attempts to remove missing site links will be silently ignored, resulting in empty update.
- Parameters:
site
- site key of the removed site link- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifsite
isnull
IllegalArgumentException
- ifsite
is blank
-
append
Replays all changes in provided update into this builder object. Changes from the update are added on top of changes already present in this builder object.- Parameters:
update
- item update to replay- Returns:
this
(fluent method)- Throws:
NullPointerException
- ifupdate
isnull
IllegalArgumentException
- ifupdate
cannot be applied to base entity revision (if available)
-
build
Description copied from class:TermedDocumentUpdateBuilder
Creates newTermedStatementDocumentUpdate
object with contents of this builder object.- Specified by:
build
in classTermedDocumentUpdateBuilder
- Returns:
- constructed object
-