00001 <?php
00002
00015 class ApiAsk extends ApiSMWQuery {
00016
00017 public function execute() {
00018 $params = $this->extractRequestParams();
00019 $this->requireParameters( $params, array( 'query' ) );
00020
00021 $rawParams = explode( '|', $params['query'] );
00022 $queryString = '';
00023 $printouts = array();
00024
00025 SMWQueryProcessor::processFunctionParams( $rawParams, $queryString, $this->parameters, $printouts );
00026
00027 $queryResult = $this->getQueryResult( $this->getQuery(
00028 $queryString,
00029 $printouts
00030 ) );
00031
00032 $this->addQueryResult( $queryResult );
00033 }
00034
00035 public function getAllowedParams() {
00036 return array(
00037 'query' => array(
00038 ApiBase::PARAM_TYPE => 'string',
00039 ),
00040 );
00041 }
00042
00043 public function getParamDescription() {
00044 return array(
00045 'query' => 'The query string in ask-language'
00046 );
00047 }
00048
00049 public function getDescription() {
00050 return array(
00051 'API module to query SMW by providing a query in the ask language.
00052 This API module is in alpha stage, and likely to see changes in upcomming versions of SMW.'
00053 );
00054 }
00055
00056 protected function getExamples() {
00057 return array(
00058 'api.php?action=ask&query=[[Modification%20date::%2B]]|%3FModification%20date|sort%3DModification%20date|order%3Ddesc',
00059 );
00060 }
00061
00062 public function getVersion() {
00063 return __CLASS__ . ': $Id: ApiAsk.php 112438 2012-02-26 14:21:22Z nikerabbit $';
00064 }
00065
00066 }