From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png

Release status:Extension status unmaintained

ImplementationTemplate:Extension#type API, Search
DescriptionTemplate:Extension#description Extends the SMW (Semantic MediaWiki) API with support for #ask queries
Author(s)Template:Extension#username PierreMztalk
Latest versionTemplate:Extension#version 0.9a (2011-09-12)
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GNU General Public License 3.0 or later
Download SMWAskAPI


smw ask api query semantic mediawiki

Translate the SMWAskAPI extension if it is available at translatewiki.net

Check usage and version matrix.

What can this extension do?[edit]

Extends the mediawiki API with support for semantic queries #ask: allow one to execute SMW ask query via API.

As of SMW 1.7, it appears that this functionality is now integrated into SMW (with some modifications to the parameters, such a "q" is now "query").


After installing it, you can execute a semantic #ask query through the api.

This example:


will look for all pages with a property testproperty set to Dummy, and display them along with their testproperty and otherproperty values.


This extension depends on Semantic MediaWiki to work.

Both 1.6 and 1.5 versions of Semantic MediaWiki are supported - see below the download section to know where to pick the corresponding archives.

Download instructions[edit]

The most up-to-date instructions are contained in the README.txt file on sourceforge

You can either download a ZIP archive containing all the needed files, or export them from SVN.

Download a ZIP archive[edit]

Go to the sourceforge download page an pick the most recent ZIP file matching your need. The file names are built this way:

SMWAskAPI-<version of the extension>-smw<version of SMW>-rev<SVN revision>.zip

Thus, if you use SMW 1.6, you will be looking for a file looking like

SMWAskAPI-<version of the extension>-smw1.6-rev<SVN revision>.zip

Just be sure to take the one with the highest <version of the extension> and <SVN revision>, to have the most up-to-date version of the extension

The most recent ZIP archive can also be downloaded directly from this link

The ZIP archive contains a SMWAskAPI folder, which is the extension folder

Via SVN[edit]

Get the latest version of the extension from the SVN repository.

  • For SMW 1.6
svn co https://smwaskapi.svn.sourceforge.net/svnroot/smwaskapi/trunk/SMWAskAPI
  • For SMW 1.5
svn co https://smwaskapi.svn.sourceforge.net/svnroot/smwaskapi/branches/smw-1.5/SMWAskAPI

You will get a SMWAskAPI folder, which is the extension folder

Where to put the files[edit]

Move the SMWAskAPI folder into $IP/extensions/.

Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.


After placing the sources into $IP/extensions/SMWAskAPI, add following line into LocalSettings.php:

require_once( "$IP/extensions/SMWAskAPI/SMWAskAPI.php" );

Configuration parameters[edit]

  • $wgSMWAskAPI_ActionName: (optional) define the api action name used to execute the ask query. Default is 'ask'

Report a bug / request a feature[edit]

Use this link: http://sourceforge.net/apps/trac/smwaskapi/newticket to create a new ticket about a bug or a feature request. You do not need to have a sourceforge account to create a ticket (although it does not hurt)

See also[edit]