WikibaseDataEditor.editEntityDocument(EntityUpdate, boolean, String, List)
instead.
Class to plan a statement update operation.@Deprecated public class StatementUpdate extends Object
Constructor and Description |
---|
StatementUpdate(StatementDocument currentDocument,
List<Statement> addStatements,
List<Statement> deleteStatements)
Deprecated.
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addBestReferenceToList(Reference reference,
List<Reference> referenceList)
Deprecated.
|
protected void |
addStatement(Statement statement,
boolean isNew)
Deprecated.
Adds one statement to the list of statements to be kept, possibly merging
it with other statements to be kept if possible.
|
protected boolean |
equivalentClaims(Claim claim1,
Claim claim2)
Deprecated.
Checks if two claims are equivalent in the sense that they have the same
main snak and the same qualifiers, but possibly in a different order.
|
protected <T> T |
getDatamodelObjectFromResponse(com.fasterxml.jackson.databind.JsonNode response,
List<String> path,
Class<T> targetClass)
Deprecated.
Extracts a particular data model instance from a JSON response
returned by MediaWiki.
|
String |
getJsonUpdateString()
Deprecated.
Returns a JSON serialization of the marked insertions and deletions of
statements, in the format required by the Wikibase "wbeditentity" action.
|
protected long |
getRevisionIdFromResponse(com.fasterxml.jackson.databind.JsonNode response)
Deprecated.
Extracts the last revision id from the JSON response returned
by the API after an edit
|
List<Statement> |
getUpdatedStatements()
Deprecated.
|
boolean |
isEmptyEdit()
Deprecated.
Returns true when the edit is not going to change anything on the item.
|
protected boolean |
isSameSnakSet(Iterator<Snak> snaks1,
Iterator<Snak> snaks2)
Deprecated.
Compares two sets of snaks, given by iterators.
|
protected void |
markStatementsForDeletion(StatementDocument currentDocument,
List<Statement> deleteStatements)
Deprecated.
Marks the given list of statements for deletion.
|
protected void |
markStatementsForInsertion(StatementDocument currentDocument,
List<Statement> addStatements)
Deprecated.
Marks a given list of statements for insertion into the current document.
|
protected void |
markStatementsForUpdate(StatementDocument currentDocument,
List<Statement> addStatements,
List<Statement> deleteStatements)
Deprecated.
Marks the given lists of statements for being added to or deleted from
the given document, respectively.
|
protected List<Reference> |
mergeReferences(List<? extends Reference> references1,
List<? extends Reference> references2)
Deprecated.
Merges two lists of references, eliminating duplicates in the process.
|
StatementDocument |
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.
|
void |
setGuidGenerator(GuidGenerator generator)
Deprecated.
Sets the GUID generator for this statement update.
|
public StatementUpdate(StatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements)
currentDocument
- the document with the current statementsaddStatements
- the list of new statements to be addeddeleteStatements
- the list of statements to be deletedpublic String getJsonUpdateString()
public StatementDocument performEdit(WbEditingAction action, boolean editAsBot, String summary, List<String> tags) throws IOException, MediaWikiApiErrorException
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
public boolean isEmptyEdit()
protected void markStatementsForUpdate(StatementDocument currentDocument, List<Statement> addStatements, List<Statement> deleteStatements)
currentDocument
- the document with the current statementsaddStatements
- the list of new statements to be addeddeleteStatements
- the list of statements to be deletedprotected void markStatementsForDeletion(StatementDocument currentDocument, List<Statement> deleteStatements)
currentDocument
- the document with the current statementsdeleteStatements
- the list of statements to be deletedprotected void markStatementsForInsertion(StatementDocument currentDocument, List<Statement> addStatements)
currentDocument
- the document with the current statementsaddStatements
- the list of new statements to be addedprotected void addStatement(Statement statement, boolean isNew)
statement
- statement to addisNew
- if true, the statement should be marked for writing; if false,
the statement already exists in the current data and is only
added to remove duplicates and avoid unnecessary writesprotected List<Reference> mergeReferences(List<? extends Reference> references1, List<? extends Reference> references2)
references1
- references2
- protected void addBestReferenceToList(Reference reference, List<Reference> referenceList)
protected boolean equivalentClaims(Claim claim1, Claim claim2)
claim1
- claim2
- protected boolean isSameSnakSet(Iterator<Snak> snaks1, Iterator<Snak> snaks2)
snaks1
- snaks2
- public void setGuidGenerator(GuidGenerator generator)
protected 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
protected <T> T getDatamodelObjectFromResponse(com.fasterxml.jackson.databind.JsonNode response, List<String> path, Class<T> targetClass) throws com.fasterxml.jackson.core.JsonProcessingException
response
- the API response as returned by MediaWikipath
- a list of fields from the root to the target objectcom.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