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

Release status: beta

Implementation API, Search
Description Extends the SMW (Semantic MediaWiki) API with support for #ask queries
Author(s) PierreMztalk
Latest version 0.9a (2011-09-12)
Database changes No
License GPLv3
Download SMWAskAPI


smw ask api query semantic mediawiki

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

Check usage and version matrix; code metrics

What can this extension do?[edit | edit source]

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").

Usage[edit | edit source]

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.

Dependencies[edit | edit source]

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 | edit source]

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 | edit source]

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 | edit source]

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 | edit source]

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.

Installation[edit | edit source]

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

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

Configuration parameters[edit | edit source]

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

Report a bug / request a feature[edit | edit source]

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 | edit source]