| Package | Description |
|---|---|
| org.wikidata.wdtk.wikibaseapi |
Components for accessing the Web API of a Wikibase website, such as wikidata.org.
|
| org.wikidata.wdtk.wikibaseapi.apierrors |
| Modifier and Type | Method and Description |
|---|---|
void |
ApiConnection.checkCredentials()
Checks that the credentials are still valid for the
user currently logged in.
|
void |
OAuthApiConnection.checkCredentials()
Checks if the OAuth credentials (i.e., consumer key/secret and access token/secret) are still valid.
|
protected void |
ApiConnection.checkErrors(com.fasterxml.jackson.databind.JsonNode root)
Checks if an API response contains an error and throws a suitable
exception in this case.
|
void |
BasicApiConnection.clearCookies()
Clears the set of cookies.
|
protected void |
BasicApiConnection.confirmClientLogin(String token,
String username,
String password)
Issues a Web API query to confirm that the previous client login attempt was
successful, and sets the internal state of the API connection accordingly
in this case.
|
protected void |
BasicApiConnection.confirmLogin(String token,
String username,
String password)
Issues a Web API query to confirm that the previous login attempt was
successful, and sets the internal state of the API connection accordingly
in this case.
|
EntityDocument |
WikibaseDataEditor.createEntityDocument(EntityDocument document,
String summary,
List<String> tags)
Creates new entity document.
|
ItemDocument |
WikibaseDataEditor.createItemDocument(ItemDocument document,
String summary,
List<String> tags)
Creates new item document.
|
LexemeDocument |
WikibaseDataEditor.createLexemeDocument(LexemeDocument document,
String summary,
List<String> tags)
Creates new lexeme document.
|
PropertyDocument |
WikibaseDataEditor.createPropertyDocument(PropertyDocument document,
String summary,
List<String> tags)
Creates new property document.
|
EditingResult |
WikibaseDataEditor.editEntityDocument(EntityUpdate update,
boolean clear,
String summary,
List<String> tags)
Updates
EntityDocument entity. |
ItemDocument |
WikibaseDataEditor.editItemDocument(ItemDocument itemDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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 |
WikibaseDataEditor.editMediaInfoDocument(MediaInfoDocument mediaInfoDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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 |
WikibaseDataEditor.editPropertyDocument(PropertyDocument propertyDocument,
boolean clear,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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. |
double |
WbEditingAction.getCurrentLag()
Retrieves the current lag from the target site, by making an API call.
|
EntityDocument |
WikibaseDataFetcher.getEntityDocument(String entityId)
Fetches the documents for the entity of the given string IDs.
|
EntityDocument |
WikibaseDataFetcher.getEntityDocumentByTitle(String siteKey,
String title)
Fetches the document for the entity that has a page of the given title on
the given site.
|
Map<String,EntityDocument> |
WikibaseDataFetcher.getEntityDocuments(List<String> entityIds)
Fetches the documents for the entities of the given string IDs.
|
Map<String,EntityDocument> |
WikibaseDataFetcher.getEntityDocuments(String... entityIds)
Fetches the documents for the entities of the given string IDs.
|
Map<String,EntityDocument> |
WikibaseDataFetcher.getEntityDocumentsByTitle(String siteKey,
List<String> titles)
Fetches the documents for the entities that have pages of the given
titles on the given site.
|
Map<String,EntityDocument> |
WikibaseDataFetcher.getEntityDocumentsByTitle(String siteKey,
String... titles)
Fetches the documents for the entities that have pages of the given
titles on the given site.
|
MediaInfoIdValue |
WikibaseDataFetcher.getMediaInfoIdByFileName(String fileName)
Fetches the MediaInfoId of a file with the given name.
|
Map<String,MediaInfoIdValue> |
MediaInfoIdQueryAction.getMediaInfoIds(List<String> fileNames)
Fetches the MediaInfoIds of files with the given names.
|
Map<String,MediaInfoIdValue> |
WikibaseDataFetcher.getMediaInfoIdsByFileName(List<String> fileNames)
Fetches the MediaInfoIds of files with the given names.
|
Map<String,MediaInfoIdValue> |
WikibaseDataFetcher.getMediaInfoIdsByFileName(String... fileNames)
Fetches the MediaInfoIds of files with the given names.
|
abstract void |
ApiConnection.logout()
Logs the current user out.
|
void |
BasicApiConnection.logout()
Logs the current user out.
|
void |
WikibaseDataEditor.nullEdit(EntityIdValue entityId)
Performs a null edit on an entity.
|
<T extends StatementDocument> |
WikibaseDataEditor.nullEdit(ItemIdValue itemId)
Deprecated.
Use
WikibaseDataEditor.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> |
WikibaseDataEditor.nullEdit(PropertyIdValue propertyId)
Deprecated.
Use
WikibaseDataEditor.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> |
WikibaseDataEditor.nullEdit(T currentDocument)
Performs a null edit on an entity.
|
StatementDocument |
StatementUpdate.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.
|
TermedStatementDocument |
TermStatementUpdate.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.
|
List<WbSearchEntitiesResult> |
WikibaseDataFetcher.searchEntities(String search) |
List<WbSearchEntitiesResult> |
WikibaseDataFetcher.searchEntities(String search,
Long limit) |
List<WbSearchEntitiesResult> |
WikibaseDataFetcher.searchEntities(String search,
String language) |
List<WbSearchEntitiesResult> |
WikibaseDataFetcher.searchEntities(String search,
String language,
Long limit) |
List<WbSearchEntitiesResult> |
WikibaseDataFetcher.searchEntities(WbGetEntitiesSearchData properties) |
com.fasterxml.jackson.databind.JsonNode |
ApiConnection.sendJsonRequest(String requestMethod,
Map<String,String> parameters)
Sends a request to the API with the given parameters and the given
request method and returns the result JSON tree.
|
com.fasterxml.jackson.databind.JsonNode |
ApiConnection.sendJsonRequest(String requestMethod,
Map<String,String> parameters,
Map<String,org.apache.commons.lang3.tuple.ImmutablePair<String,File>> files)
Sends a request to the API with the given parameters and the given
request method and returns the result JSON tree.
|
ItemDocument |
WikibaseDataEditor.updateStatements(ItemIdValue itemIdValue,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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 |
WikibaseDataEditor.updateStatements(PropertyIdValue propertyIdValue,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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
WikibaseDataEditor.updateStatements(ItemIdValue, List, List, String, List). |
<T extends StatementDocument> |
WikibaseDataEditor.updateStatements(T currentDocument,
List<Statement> addStatements,
List<Statement> deleteStatements,
String summary,
List<String> tags)
Deprecated.
Use
WikibaseDataEditor.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 |
WikibaseDataEditor.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
WikibaseDataEditor.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> |
WikibaseDataEditor.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
WikibaseDataEditor.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. |
EntityDocument |
WbEditingAction.wbEditEntity(String id,
String site,
String title,
String newEntity,
String data,
boolean clear,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbeditentity" for the given parameters.
|
Map<String,EntityDocument> |
WbGetEntitiesAction.wbGetEntities(String ids,
String sites,
String titles,
String props,
String languages,
String sitefilter)
Creates a map of identifiers or page titles to documents retrieved via
the API.
|
Map<String,EntityDocument> |
WbGetEntitiesAction.wbGetEntities(WbGetEntitiesActionData properties)
Creates a map of identifiers or page titles to documents retrieved via
the API URL
|
com.fasterxml.jackson.databind.JsonNode |
WbEditingAction.wbRemoveClaims(List<String> statementIds,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbremoveclaims" for the given parameters.
|
List<WbSearchEntitiesResult> |
WbSearchEntitiesAction.wbSearchEntities(String search,
String language,
Boolean strictLanguage,
String type,
Long limit,
Long offset)
Keeping this for backwards compatibility, the real action happens in
WbSearchEntitiesAction.wbSearchEntities(String, String, Boolean, String, Long, Long, String) |
List<WbSearchEntitiesResult> |
WbSearchEntitiesAction.wbSearchEntities(String search,
String language,
Boolean strictLanguage,
String type,
Long limit,
Long offset,
String uselang)
Executes the API action "wbsearchentity" for the given parameters.
|
List<WbSearchEntitiesResult> |
WbSearchEntitiesAction.wbSearchEntities(WbGetEntitiesSearchData properties) |
com.fasterxml.jackson.databind.JsonNode |
WbEditingAction.wbSetAliases(String id,
String site,
String title,
String newEntity,
String language,
List<String> add,
List<String> remove,
List<String> set,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbsetaliases" for the given parameters.
|
com.fasterxml.jackson.databind.JsonNode |
WbEditingAction.wbSetClaim(String statement,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbsetclaim" for the given parameters.
|
com.fasterxml.jackson.databind.JsonNode |
WbEditingAction.wbSetDescription(String id,
String site,
String title,
String newEntity,
String language,
String value,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbsetlabel" for the given parameters.
|
com.fasterxml.jackson.databind.JsonNode |
WbEditingAction.wbSetLabel(String id,
String site,
String title,
String newEntity,
String language,
String value,
boolean bot,
long baserevid,
String summary,
List<String> tags)
Executes the API action "wbsetlabel" for the given parameters.
|
| Modifier and Type | Class and Description |
|---|---|
class |
AssertUserFailedException
Exception to indicate that we tried to perform an action while our login
credentials have expired.
|
class |
EditConflictErrorException
Exception to indicate a MediaWiki API error caused by an edit conflict.
|
class |
MaxlagErrorException
Exception to indicate a MediaWiki API error caused by exceeding the maxlag
parameter.
|
class |
NoSuchEntityErrorException
Exception to indicate a MediaWiki API error caused by trying to access an
entity that does not exist.
|
class |
TagsApplyNotAllowedException
Error thrown when one of the supplied tags for an edit does not exist
or cannot be applied manually.
|
class |
TokenErrorException
Exception to indicate a MediaWiki API error caused by missing or invalid
token.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
MediaWikiApiErrorHandler.throwMediaWikiApiErrorException(String errorCode,
String errorMessage)
Creates and throws a suitable
MediaWikiApiErrorException for the
given error code and message. |
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