Semantic Result Formats

From semantic-mediawiki.org
Jump to: navigation, search
Semantic Result Formats
Additional formats for Semantic MediaWiki inline queries
Image collection
Further Information
Homepage: follow this link
Maintainer(s): James Hong Kong, Yaron Koren, Jeroen De Dauw
First released: August 2008
Release status: stable
Development status: active
Area of usage: Displaying data
Associated with:SMW = Semantic MediaWiki, SB = Semantic Bundle, SMW+ = Semantic MediaWiki Plus, MW = MediaWiki SMW, SB
Shortcut:This is the shortcut to mark the beginning of the subject line when writing a support request to the mailing list or to the extension's author directly. See also this help page. SRF
Repository: Git [?]:
Table of Contents

Semantic Result Formats is an extension to Semantic MediaWiki (SMW) that adds a large number of further result formats to inline queries, including formats for calendars, timelines, charts, graphs and mathematical functions.

Result formats provided

misc

math

  • Average format (Displays the average of all queried numerical data)
  • Max format (Displays the maximum of all queried numerical data)
  • Median format (Displays the median of all queried numerical data)
  • Min format (Displays the minimum of all queried numerical data)
  • Product format (Displays the product of all queried numerical data)
  • Sum format (Displays the sum of all queried numerical data)

export

time

charts

  • D3 chart format (Various charts using the d3.js as visualization library)
  • Dygraphs format (high performance series charting using the dygraphs Javascript library)
  • Google bar format (Produces a bar chart using the Google Charts API)
  • Google pie format (Produces a pie chart using the Google Charts API)
  • Jqplotseries format (enable sets of numerical data to be displayed as a chart series using the jqPlot Javascript library)
  • Sparkline format (generates small inline charts (also known as sparklines))
  • Timeseries format (aggregated values assigned to a date (property type date) are plotted as a line/bar chart)
  • Jqplotchart format (Displays aggregated numerical data as a bar, line, pie, or donut chart)

table

  • Datatables format (A progressive table result printer that integrates the DataTables JavaScript library)

graph


Version

Semantic Result Formats requires Semantic MediaWiki to run, at least at the same second-level version number as Semantic Result Formats, i.e. SRF 1.6.2 requires SMW 1.6.x. For a full list of changes in the different versions of Semantic Result Formats, see the release notes.

Compatibility

The Compatibility of Semantic Result Formats with MediaWiki, Semantic MediaWiki, PHP, etc, is outlined on this page.

Installation

Since SRF ≥ 1.9.0 Composer needs to be installed on your machine for this to work. To install Composer please follow the instuctions provided on the help page on installing "Composer". In case of MediaWiki 1.19.x and 1.21.x you will additionally need to install the Extension Installer extension as described on the help page on installing "Extension Installer".

MediaWiki 1.24
  1. Install like for 1.22+
  2. Fix a JQuery problem: As explained in the release notes for MW 1.24, jQuery was upgraded from 1.8.3 to 1.11.1. This will break the jqplot library. To fix the problem, add $wgIncludejQueryMigrate = true; to LocalSettings.php
MediaWiki 1.22+
  1. Run the installation script from the base directory[1] of your MediaWiki installation:[2]
    php composer.phar require mediawiki/semantic-result-formats "1.9.*"
  2. Add optional settings to the end of the "LocalSettings.php" file after the settings included for Semantic MediaWiki as described in the section on enabling additional formats.
  3. Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
  4. Done!
MediaWiki 1.19.x to 1.21.x
  1. Add the following line to the "require" section of the composer.json file in the …/extensions/ExtensionInstaller/ directory.[3]
    "mediawiki/semantic-result-formats": "1.9.*"
  2. Run the installation script from the …/extensions/ExtensionInstaller/ directory:[2]
    php composer.phar install
  3. Add optional settings to the end of the "LocalSettings.php" file after the settings included for Semantic MediaWiki as described in the section on enabling additional formats.
  4. Navigate to "Special:Version" on your wiki to verify that the extension is successfully installed.
  5. Done!

Enabling additional formats

If nothing else is added, all but the following formats are enabled: 'exhibit', 'filtered', 'googlebar', 'googlepie' and 'excel'. In order to additionally add one of these formats, you can add lines like:

$srfgFormats[] = 'googlebar';
$srfgFormats[] = 'googlepie';

...or alternatively

$srfgFormats = array_merge( $srfgFormats, array( 'googlebar', 'googlepie' ) );

...or you can override the set of formats entirely, with a call like:

$srfgFormats = array('calendar', 'timeline', 'exhibit');

... using one or more of the following values: average, bibtex, calendar, eventline, exhibit, googlebar, googlepie, graph, icalendar, jqplotbar, jqplotpie, max, min, outline, sum, timeline, vcard.

There are some formats that you may not want to include because they may not follow certain policies within your wiki; the formats 'googlebar' and 'googlepie', for instance, send data to external web services for rendering, which may be considered a data leak.

In the event you want to use features that are taking advantage of Google Maps (such as the map view created by the Exhibit result printer), please assign a valid Google Maps key to the $wgGoogleMapsKey variable in LocalSettings.php. Otherwise, these features will not be available. If you don't yet have a Google Maps key for your wiki, you can get one at http://code.google.com/intl/en-en/apis/maps/signup.html.

FAQ

I see a spinning wheel but no output.

If you just see a spinning wheel, chances are high that the ResourceLoader could not locate a JavaScript resource or had a problem in executing. In either case, you will need to fix the problem before the result format can display. Using &debug=true together with a tool like Firebug or Gooogle Chrome's "inspect element" will most likely help to find the delinquent JavaScript resource. Also, see the warning and hacks above concerning the new jQuery version in MW 1.24.

Some data seems to be ignored in the results.

By default, inline queries return 50 pages. Even if you're aggregating the results, using distribution=yes, that limit still applies. You probably need to increase the limit, by setting the |limit= parameter within the query, and (if you need to query more than 500 pages) by setting $smwgQMaxInlineLimit in LocalSettings.php as well.

Mailing list

You should use the Semantic MediaWiki mailing list, semediawiki-user, for any questions, suggestions or bug reports about Semantic Result Formats. If possible, please add "[SRF]" at the beginning of the subject line, to clarify the subject matter.

Contributing to the project

Bugs and feature requests

You can submit bug reports and requests for new features at MediaWiki's Bugzilla, here.

The current list of known bugs and requested features for Semantic Result Formats can be found here.

Contributing patches

If you found some bug and fixed it, or if you wrote code for a new feature, please create a patch by going to the main "SemanticResultFormats" directory, and typing:

git diff >descriptivename.patch

Then go to the relevant bug report in Bugzilla, or create one if one doesn't exist (note, again, that Bugzilla is used for both bugs and feature requests), and attach this patch file to it.

If, for any reason, you don't wish to use Bugzilla, feel free to simply send this patch, with a description, to the semediawiki-devel mailing list.

See also

Links
Video tutorial

Notes

  1. This is the directory which contains the "LocalSettings.php" file.
  2. 2.0 2.1 In case you installed Composer "globally" on your server, you will have to drop the php and .phar particles from the command.
  3. See also the example "composer.json" file which already contains the line to be added here.


This documentation page applies to all SMW versions from 1.9.0 to the most current version.
Other versions: 1.4.0 – 1.8.0      

Semantic Result Formats en 1.9.0