public class WbGetEntitiesAction extends Object
Constructor and Description |
---|
WbGetEntitiesAction(ApiConnection connection,
String siteIri)
Creates an object to fetch data from the given ApiConnection.
|
Modifier and Type | Method and Description |
---|---|
Map<String,EntityDocument> |
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> |
wbGetEntities(WbGetEntitiesActionData properties)
Creates a map of identifiers or page titles to documents retrieved via
the API URL
|
public WbGetEntitiesAction(ApiConnection connection, String siteIri)
connection
- ApiConnection
Object to send the requestssiteIri
- the URI identifying the site that is accessed (usually the
prefix of entity URIs), e.g.,
"http://www.wikidata.org/entity/"public Map<String,EntityDocument> wbGetEntities(WbGetEntitiesActionData properties) throws MediaWikiApiErrorException, IOException
properties
- parameter setting for wbgetentitiesMediaWikiApiErrorException
- if the API returns an errorIOException
- if we encounter network issues or HTTP 500 errors from WikibaseMalformedResponseException
- if one of the returned entities cannot be parsedpublic Map<String,EntityDocument> wbGetEntities(String ids, String sites, String titles, String props, String languages, String sitefilter) throws MediaWikiApiErrorException, IOException
ApiConnection.implodeObjects(Iterable)
. There is a limit on how
many entities can be retrieved in one request, usually 50 by default and
500 for bots. This limit may also apply to the number of language codes
and sites used for filtering.
If an error occurs (e.g., exceptions trying to access the Web API), the exception will be propagated to the caller.
ids
- list of ids of entities for which data should be retrievedsites
- site key (e.g. "enwiki"); used together with parameters
"titles"; the API supports the use of many site keys with a
single title, but this implementation does not support this
(the resulting map will use title strings for keys)titles
- list of titles of the page corresponding to the requested
entities on the given site; use together with 'sites', but
only give one site for several titles or several sites for one
titleprops
- list of strings that specifies what kind of data should be
retrieved for each entity; possible values include "info",
"sitelinks", "sitelinks/urls", "aliases", "labels",
"descriptions", "claims" (statements), "datatype"; additional
filters may apply; defaults to
"info|sitelinks|aliases|labels|descriptions|claims|datatype"languages
- list of language codes to return labels, aliases or
descriptions for; if omitted, data for all languages is
returnedsitefilter
- list of site keys to return sitelinks for; if omitted, data
for all languages is returnedMediaWikiApiErrorException
- if the API returns an errorIOException
- if we encounter network errors, or HTTP 500 errors on Wikibase's sideIllegalArgumentException
- if the given combination of parameters does not make senseMalformedResponseException
- if one of the returned entities cannot be parsedCopyright © 2014–2024 Wikidata Toolkit Developers. Generated from source code published under the Apache License 2.0. For more information, see the Wikidata Toolkit homepage