| Status: | effective |
| Progress: | 100% |
| Version: | 3.0.0+ |
API module "ask"
| ask | |
|---|---|
| Allows to do ask queries | |
| Keywords | |
| Further Information | |
| Provided by: | Semantic MediaWiki |
| Added: | 1.7.0 |
| Removed: | still available |
The "ask" API module allows you to do ask queries via action "ask" (?action=ask) against Semantic MediaWiki using the MediaWiki API and get results back serialized in one of the supported formats. It was introduced with Semantic MediaWiki 1.7.0Released on 1 January 2012 and compatible with MW 1.16.x - 1.19.x.. API-module "compoundquery"Allows to do compounded ask queries provided by extension "Semantic Compound Queries"Provides a parser function that displays multiple semantic queries at the same time acts analogous to this module but additionally allows to compound several queries.
The module supports one semantic parameter, "query" (../api.php?action=ask&query=..), which takes the same string you'd feed into an #ask parser function, but URL-encoded.
Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. this module supports the "api_version" parameter1 allowing to choose between the dictionary structure { ... } (version "2", which is the default to ensure backwards compatibility for any consumer that uses the API) and the list structure [ ... ] (version "3") for the JSON serialization of the resulting data queried with the API.
Example[edit]
- Use "dictionary" structure for JSON serialization
../api.php?action=ask&query=[[Modification date::%2B]]|%3FModification date|sort%3DModification date|order%3Ddesc&format=jsonfm
- → run example
- Use "list" structure for JSON serialization
../api.php?action=ask&query=[[Modification date::%2B]]|%3FModification date|sort%3DModification date|order%3Ddesc&format=jsonfm&api_version=3
- → run example
- Use continuation to list results after the initial page
../api.php?action=ask&query=[[Modification date::%2B]]|%3FModification date|sort%3DModification date|order%3Ddesc|offset%3D50&format=jsonfm&api_version=3
- Further examples
- API result "Annotation URI"
- API result "Boolean"
- API result "Date"
- API result "Email"
- API result "External identifier"
- API result "Geographic coordinates"
- API result "Keyword"
- API result "Monolingual text"
- API result "Number"
- API result "Page"
- API result "Quantity"
- API result "Record"
- API result "Reference"
- API result "Telephone number"
- API result "Temperature"
- API result "Text"
- API result "URL"
References
- ^ Semantic MediaWiki: GitHub pull request gh:smw:3052