API module "askargs"

From semantic-mediawiki.org
askargs
Allows to do ask queries with as little ask query specific syntax as possible
Keywords
API · API module · ask query · action askargs · askargs
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:

  1. "conditions": The query conditions, i.e. the requirements for a subject (page or subobject) to be included
  2. "printouts": The query printouts, i.e, the properties to show per subject (page or subobject)
  3. "parameters": The query parameters, i.e. all non-condition and non-printout arguments


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: &parameters=limit%3D10.

The API result contains a "query-continue-offset" key, which can be used to fetch additional results: &parameters=offset%3D10|limit%3D10. If there is no "query-continue-offset" key in the result, the end of the result set was reached.

Example

../api.php?action=askargs&conditions=Modification%20date::%2B&printouts=Modification%20date&parameters=sort%3DModification%20date|order%3Ddesc&format=jsonfm

API call includes the three parameters as explained earlier on this page
  1. &conditions=Modification%20date::%2B
  2. &printouts=Modification%20date
  3. &parameters=sort%3DModification%20date|order%3Ddesc

run example

The arguments to all three modules may be concatenated using the pipe "|" character as demonstrated for the parameters module in the example above.