Extension "Semantic Result Formats"

From semantic-mediawiki.org
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 = Extension: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 [?]:
Wikidata-ID: not yet provided

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 added by Semantic Result Formats[edit]


  • Array format (Comma-separated list, with additional outputs shown in parentheses and extra formatting options)
  • Hash format (Comma-separated list, with additional outputs shown in parentheses and extra formatting options)
  • Incoming format (Displays incoming properties to a page or property/value pair)
  • Oltree format (Displays query results as a tree (nested HTML ordered lists))
  • Outline format (Lists pages in a hierarchical outline, based on property values)
  • Pagewidget format (Widget for embedded page content)
  • Tagcloud format (Displays queried data in a tagcloud)
  • Tree format (Displays query results as a tree (nested HTML bulleted lists))
  • Valuerank format (Lists values based on their occurrence)



  • D3 chart format (Various charts using the d3.js as visualization library)
  • Dygraphs format (high performance series charting using the dygraphs Javascript library)
  • 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)


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




  • 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)



You can see the version history here.


Semantic Result Formats can be obtained in several ways:

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticResultFormats.git

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.


In order to include the default available result formats, simply add the following line to your LocalSettings.php:


Enabling additional formats[edit]

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.


I have a spinning wheel but no output[edit]

If you see a spinning wheel but no actual output chances are high that the ResourceLoader could not located a JavaScript resource or had a problem to execute a dependency. In either case the problem of a "rouge" JavaScript needs to be resolved before the printer format can load their JavaScript plugin module to provide an output result.

Using &debug=true together with a tool like Firebug will most likely help to find the delinquent JavaScript resource.

Mailing list[edit]

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

Bugs and feature requests[edit]

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

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

Talks (videos and slides)[edit]

New features in Semantic Result Formats 1.8, SMWCon Fall 2012

Automatically transforming structured data into useful output formats, Wikimania 2010

This documentation page applies to all SMW versions from 1.4.0 to 1.8.0.
      Other languages: dezh-hans