Package org.wikidata.wdtk.wikibaseapi
Class WbSearchEntitiesAction
java.lang.Object
org.wikidata.wdtk.wikibaseapi.WbSearchEntitiesAction
Java implementation of the wbsearchentities action.
- Author:
- Sören Brunk
-
Constructor Summary
ConstructorDescriptionWbSearchEntitiesAction
(ApiConnection connection, String siteUri) Creates an object to fetch data from the given ApiConnection. -
Method Summary
Modifier and TypeMethodDescriptionwbSearchEntities
(String search, String language, Boolean strictLanguage, String type, Long limit, Long offset) Keeping this for backwards compatibility, the real action happens inwbSearchEntities(String, String, Boolean, String, Long, Long, String)
wbSearchEntities
(String search, String language, Boolean strictLanguage, String type, Long limit, Long offset, String uselang) Executes the API action "wbsearchentity" for the given parameters.wbSearchEntities
(WbGetEntitiesSearchData properties)
-
Constructor Details
-
WbSearchEntitiesAction
Creates an object to fetch data from the given ApiConnection. The site URI is necessary since it is not contained in the data retrieved from the API.- Parameters:
connection
-ApiConnection
Object to send the requestssiteUri
- the URI identifying the site that is accessed (usually the prefix of entity URIs), e.g., "http://www.wikidata.org/entity/"
-
-
Method Details
-
wbSearchEntities
public List<WbSearchEntitiesResult> wbSearchEntities(WbGetEntitiesSearchData properties) throws MediaWikiApiErrorException, IOException -
wbSearchEntities
public List<WbSearchEntitiesResult> wbSearchEntities(String search, String language, Boolean strictLanguage, String type, Long limit, Long offset) throws MediaWikiApiErrorException, IOException Keeping this for backwards compatibility, the real action happens inwbSearchEntities(String, String, Boolean, String, Long, Long, String)
-
wbSearchEntities
public List<WbSearchEntitiesResult> wbSearchEntities(String search, String language, Boolean strictLanguage, String type, Long limit, Long offset, String uselang) throws MediaWikiApiErrorException, IOException Executes the API action "wbsearchentity" for the given parameters. Searches for entities using labels and aliases. Returns a label and description for the entity in the user language if possible. Returns details of the matched term. The matched term text is also present in the aliases key if different from the display label.See the online API documentation for further information.
- Parameters:
search
- (required) search for this textlanguage
- (required) search in this languagestrictLanguage
- (optional) whether to disable language fallbacktype
- (optional) search for this type of entity One of the following values: item, property Default: itemlimit
- (optional) maximal number of results no more than 50 (500 for bots) allowed Default: 7offset
- (optional) offset where to continue a search Default: 0 this parameter is called "continue" in the API (which is a Java keyword)uselang
- (optional) the response should have this language, default en- Returns:
- list of matching entities retrieved via the API URL
- Throws:
MediaWikiApiErrorException
- if the API returns an errorIllegalArgumentException
- if the given combination of parameters does not make senseMalformedResponseException
- if response JSON cannot be parsedIOException
-