MetaBattle Wiki:Semantic MediaWiki

Semantic MediaWiki (SMW) is a data-management extension for MediaWiki that is an integral part of MetaBattle Wiki. It allows us to store data on articles in a way that it can be queried, aggregated, and displayed in other articles.

This page serves to document the semantic properties being used throughout the wiki. For the most part, these properties are set automatically by the infobox template on a page based on the input values given. These properties comprise a shortened version of Official Guild Wars 2 Wiki layout, tailored specifically for the purposes of MetaBattle. A major distinction is that infoboxes are renamed to info, and these are only used to store data, delegating formatting and display to tooltip creation templates such as {{Trait tooltip}}.

The wiki uses semantic notation and templates in articles, so users should familiarize themselves with the use of SMW and its functions even if they are not directly involved with the project.

Version lists the currently installed version of SMW and related semantic extensions.

Category-specific pages

Each info template uses a distinct set of properties, which are described on the subpages below.

Template Corresponding tooltip template Documentation subpage
n/a n/a General properties
{{Item info}} {{Item tooltip}} Items
{{Skill info}} {{Skill tooltip}} Skills
{{Trait info}} {{Trait tooltip}} Traits
{{Skill fact}} n/a* Skill facts
{{MBuild}} n/a Builds**

* Note that skill facts don't exist alone, and as such don't have a proper tooltip template. These are a sub-property of skills and traits, and are stored as an array of subobjects for each skill/trait.
** Build properties are generated by other templates besides MBuild.

Inline queries

Parameter Possible values Description
format a format name selected output format; some formats allow further parameters (see Help:Result formats)
sep plain text the results separator. Only works in the case of format = list (does not work for format = template)
template name of a template a template to wrap each result with
limit non-negative number maximal number of pages selected (in the case of a table: rows)
offset number where to start
sort property name or a list of property names separated by , name of properties to use for sorting queries, a blank as a value stands for the main result column (see Help:Selecting pages)
order ascending/asc, descending/desc/reverse, random/rand
or a list of those if more than one property is used for sorting
defines how results should be ordered, ascending is the default, without using parameter "sort" the sort order of the main result column is set (see Help:Selecting pages)
align right, center, left defines how results should be aligned, only applicable for the result formats table and broadtable (see Help:Result formats)
headers show, plain, hide show headers (with links), show headers (just text) or hide them. show is default
mainlabel plain text title of the first column (the one with the page titles in it), default is no title; set to - to suppress printing the page titles
index number defines which value within a record should be displayed, only applicable for properties of type Record
link none, subject, all defines which article names in the result are hyperlinked, all normally is the default

Note: linking can also be controlled for individual printouts using the plain output format as described in Displaying information.

default plain text if, for any reason, the query returns no results, this will be printed instead
intro plain text initial text that prepends the output, if at least some results exist
outro plain text text that is appended to the output, if at least some results exist
searchlabel plain text text for continuing the search (default is Ā«… further resultsĀ»)

Quirks

Properties not updated while updating templates

When making changes to a template that affects multiple pages, it may take a few seconds to a few minutes for all the pages to update. In the mean time, the page will display its old value if it is different. To validate that the change is working on a specific page, you may need to force the page to update with a null edit. Edit the page, hit show preview, and then save the page without making changes. This forces SMW to recalculate the values of all properties on the page.

Pages with queries not updating automatically

Similar issue with the templates. Purging the cache may not force the templates using queries to update immediately. Make a "null edit" on the page where you simply edit the page and hit save to update the page.

Semantic forms

The {{{field}}} used in forms will evaluate parameters as empty field if the form is used on an existing page. This will leave empty fields in templates and the wiki prefers to remove empty parameters from templates. Forms can be set as hidden, but the form can't be told to ignore a field as the {{{field}}} values is evaluated after parser functions and magic words. Therefore, the form can't differentiate between a user not defining a value for an parameter or simply not including a parameter for the template.

Ul format

Ul format inserts an unwanted additional empty paragraph element, which causes a newline, after the ul element.

Sorting

Sorting will remove in articles that do not have the property to be sorted by. You can only sort by properties from the result set of articles from the query; you can not sort by subquery results. There is an exception if you include all results (+) from a subquery, you will be allowed to sort by that property since the property will be present for all articles. This is not a suggested practice because it leads to ambiguity on which property is being sorted, the article or the article of the subquery.

Premium Membership

Upgrade to premium membership and take advantage of all the premium benefits, including complete ad removal across the entire website, for only $8.99 per year! Click here for more info.