Status: | effective |
Progress: | 100% |
Version: | 3.0.0+ |
API module "askargs"
askargs | |
---|---|
Allows to do ask queries with as little ask query specific syntax as possible | |
Keywords | |
Further Information | |
Provided by: | Semantic MediaWiki |
Added: | 1.7.0 |
Removed: | still available |
The "askargs" API module allows you to do ask queries via action "askargs" (?action=askargs
) 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..
The module supports three parameters in un-serialized form, so with as little syntax as possible specific to the #ask
parser function:
- "
conditions
": The query conditions, i.e. the requirements for a subject (page or subobject) to be included - "
printouts
": The query printouts, i.e, the properties to show per subject (page or subobject) - "
parameters
": The query parameters, i.e. all non-condition and non-printout arguments
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.
- Limit and offset
As in regular inline (ask) queries, both "limit" and "offset" are specified in the parameter list, e.g. to get the first 10 results: ¶meters=limit%3D10
.
The API result contains a "query-continue-offset" key, which can be used to fetch additional results: ¶meters=offset%3D10|limit%3D10
. If there is no "query-continue-offset" key in the result, the end of the result set was reached.
Examples[edit]
- Use "dictionary" structure for JSON serialization
../api.php?action=askargs&conditions=Modification%20date::%2B&printouts=Modification%20date¶meters=sort%3DModification%20date|order%3Ddesc&format=jsonfm
API call includes the three parameters as explained earlier on this page:
&conditions=Modification%20date::%2B
&printouts=Modification%20date
¶meters=sort%3DModification%20date|order%3Ddesc
- Use "list" structure for JSON serialization
../api.php?action=askargs&conditions=Modification%20date::%2B&printouts=Modification%20date¶meters=sort%3DModification%20date|order%3Ddesc&format=jsonfm&api_version=3
|
" character as demonstrated for the parameters
module in the example above.
- 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