I'd like to get a number of results, which are available for a query from the semantic mediawiki. Ask API, where the number of results is greater than the query limit. Adding |format%3Dcount
to the query parameter throws this error:
Catchable fatal error: Argument 1 passed to ApiSMWQuery::addQueryResult() must be an instance of SMWQueryResult, string given, called in /Users/andru/Development/practicalplants/public/w/extensions/SemanticMediaWiki/includes/api/ApiAsk.php on line 32 and defined in /Users/andru/Development/practicalplants/public/w/extensions/SemanticMediaWiki/includes/api/ApiSMWQuery.php on line 51
from (eg.) /w/api?action=ask&query=[[Property::+]]|limit%3D5|format%3Dcount
Does anyone know of an alternate route for this via the API?
Formats like “count” are not covered by the SMW API, as far as I know (see bug 46458), but writing an extension that serves that kind of data from the API would probably not be to hard.
If the number does not need to be very exact, you could also set a property containing the count from an inline query, like {{#set:Number of results={{#ask:[[Property::+]]|format=count}}}}
. That value would however only be updated when the page is saved.