Extension:SemanticQueryFormTool
From MediaWiki.org
|
Release status: experimental |
|
|---|---|
| Implementation | Parser function, Search |
| Description | Tool for semantic SMW data, retrieves unique property value lists to aid creation of query forms, also saves, combines and manages query results (Help page) |
| Author(s) | G. Zehetner |
| Last Version | 0.2.6 for >= SMW 1.4.2 (0.1.6 for <= SMW 1.3 and 0.1.9 for >= SMW 1.4 < 1.4.2) (2009-11-18) |
| MediaWiki | 1.11.0 - 1.15.1 |
| License | GPLv2 |
| Download | http://download.malariapedia.info/ |
| Example | http://help.malariapedia.info/ |
|
check usage (experimental) |
|
Contents |
[edit] NOTE that SMW 1.4.2 (or later) is required for SemanticQueryFormTool version 0.2.0 or later !!!
[edit] Introduction
The SemanticQueryFormTool (SQFT) extension is an extension of the SMW extension rather than of MW itself. It implements the parser function {{#sask:}} (the leading 's' stands for 'Select' and 'Save' because generating 'select' form elements and saving query results are the two main usages of the function) which uses a similar syntax as the original SMW {{#ask:}} parser function.
This extension was developed as a tool to support the generation of user friendly query forms for semantic data in our wiki. For many properties user neither know what data are already present nor what the syntax of the values is. Therefore it would be impossible to enter exact search terms into a text field of a query form. By providing select elements which contain the existing values of a property the user can simply select the desired value(s).
The extension has now also a Browse function for an enhanced and configurable display of properties and their values (for details see the description on help.malariapedia.info).
[edit] Installation
[edit] Pre-requisite
- Make sure the SMW extension is installed
[edit] Mandatory steps
- Download zip file from from here and unzip
- Create $IP/extensions/SemanticQueryFormTool/ folder
- Note: $IP is your MediaWiki install dir.
- Copy files from the unziped SemanticQueryFormTool_version folder into the newly created folder
- Enable the extension by adding this line to your LocalSettings.php
include_once('extensions/SemanticQueryFormTool/includes/SQFT_Settings.php');- Note: Make sure this appears LocalSettings below the include_once() call that enables Semantic MediaWiki itself!
- For versions >= 0.2 the following additional indexes SHOULD be created (speed up in large wikis):
- create index p_s_val on $wgDBprefix_smw_atts2(p_id, s_id, value_xsd);
- create index p_o_id on $wgDBprefix_smw_rels2(p_id, o_id);
[edit] Optional steps
- Optionally add lines to set values for variables in LocalSettings.php (see SQFT_Settings.php file)
- $sqftgAdjustSMWQMaxVals
- $sqftgDefaultParameter
- $sqftgUseCache (requires creation of sqf_cache_time and sqft_cache_time database tables - see below !)
- $sqftgUseCacheDefaults (requires creation of sqft_cache_time and sqft_cache_time database tables - see below !)
- $sqftgAllowedNamespaces
- $sqftgDefaultNamespaces
- If in version >= 0.2 the custom indexes have been created (see point 5. above) the following line should be added to LocalSettings.php:
- $sqftgCustomIndexes = true; (set it to 'false' if you are sure NOT to create the indexes)
- Optionally create the following extra tables in your mediawiki db
- Note $wgDBprefix stands for the database table prefix defined in your LocalSettings.php
- Cache tables which may speed up execution
- $wgDBprefix_sqft_cache_time
create table $wgDBprefix_sqft_cache_time (timestamp mediumtext, id varchar(480) primary key);
- $wgDBprefix_sqft_cache_value
create table $wgDBprefix_cache_values (id varchar(480), value mediumtext, index(id));
- $wgDBprefix_sqft_cache_time
- If result-lists are saved in the in the type=article mode the following extra table needs to exist
- $wgDBprefix_sqft_save_results
create table $wgDBprefix_sqft_save_results (user_id int(11), result_name varchar(255) not null, result_namespace int(11) not null,result_title varchar(255) not null, index(user_id), index(result_namespace));
- $wgDBprefix_sqft_save_results
- If several namespaces are used in the wiki and the default search namespace should be changed interactively the following extra table needs to exist
- $wgDBprefix_sqft_namespaces
create table $wgDBprefix_sqft_namespaces (user_id int(11), namespaces mediumtext, index(user_id));
- $wgDBprefix_sqft_namespaces
[edit] Syntax
-
- {{#sask: ?Property}} or {{#sask: ?Property | Parameters}}
- Property is the name of any SMW property used in the wiki.
- Parameters are a number of optional parameters which direct the behaviour of the function and determine the result format (they usually have the format name=value)
[edit] List and description of available parameters can be found here
[edit] Usage
[edit] A help page with a list of parameters and example usages can be found here
[edit] Property type usage mode
The main purpose of the parser function is to generate a unique list of values existing for a specific property or a value-part of a multi-valued (nary) property in various formats. In its default form the function returns a complete 'select' element of an HTML form which can be incorporated directly in a form (in our case forms are build using the SimpleForms extension). This is the default type=property usage mode.
[edit] Article type usage mode
A second more specific functionality of the parser function is to store, combine and manage search results in form of article title lists (type=article usage mode). This was implemented to be able to use basic generic query forms but still allow to answer more complex questions by combining the results of the basic queries. This mode requires an extra table to be created in the database.
[edit] Compatibility
[edit] MW
Version 0.1 has fixed some problems with MW 1.13 and is now the recommended version. The Ajax function of the SimpleForms extension works also with MW 1.13 after applying the patch posted by Danbrice on the SF Talk page.
As our wiki uses the Ajax feature of the SimpleForms extension (which doesn't work on MW versions later than 1.11) with query forms, version 0.1RC has mainly been tested with MW 1.11. However, prelimary testing on a MW 1.13 installation show no incompatibilities so far and the expeted outputs (MW 1.12 has not yet been tested).
Version 0.2.0 has been tested against the last SVN update (12.2.2009): MW 1.13.4 (r47174)
[edit] SMW
- Version 0.2.0 is the first version compatible with SMW 1.4.2 and later (tested against the update: SMW 1.4.3 (Version 1.5g-SVN)
- Version 0.1.9a is the last version compatible with SMW 1.4 - 1.4.1
- Version 0.1.7 is the first version compatible with SMW 1.4 - 1.4.1
- Version 0.1.6 is the last version compatible with SMW 1.3
Versions 0.1+ works also with the new SMW storage engine.
Version 0.1RC of the extension works with SMW 1.3 and 1.2 but only with the old data storage engine.