FFXIV Wiki:Semantic MediaWiki

From Final Fantasy XIV Online Wiki
Jump to navigation Jump to search

Community portalHelp & editingStyle guideTo-do listHistorical


Semantic MediaWiki ("SMW") is a MediaWiki extension used to store and query data. We use it extensively throughout the wiki to store data for pages that can be displayed on other pages. This allows pages to "talk" to each other: for example, a weapon may have a given item level, attack power, and job that it defines. On another page, SMW allows us to construct a table for all weapons for a given job, querying for the item level, attack power, and other stats. Due to the massive size of FFXIV, SMW is an essential tool that allows us to help keep the wiki up-to-date.

Documentation

Anyone interested in learning how to create and/or edit templates using SMW should review the official introduction. The SMW documentation is excellent, so most of the guidelines below include links to the official documentation.

Properties

Properties_and_types

Properties are the data fields stored by SMW. Examples of properties stored for various wiki pages include Has game icon (the icon associated with the wiki page) or Requires item (the item required by a quest, FATE, etc.).

Setting Property Values

Setting values

Browsing Properties

To view the properties associated with a wiki page, click on the "Browse properties" link on the page. Each property will be displayed along with the value(s) stored for that wiki page. Properties that have not been created yet will be displayed in red. That can happen if a property is set on the page before the property is created, which should be avoided. If you see a red property, refer to "Creating New Properties" below.

Creating New Properties

Property declaration

New properties should be created very carefully, with as much specificity as possible. If you are unsure of whether or how to create a new property, reach out to other editors in Discord.

Editing Properties

Properties should be created very carefully to avoid requiring any future edits. If a property requires an edit, reach out in Discord for guidance.

Queries

"Ask" Queries - queries for multiple results

"Show" Queries - queries for a single page's data

Our templates often use SMW queries to display data related to other wiki pages. A basic SMW "ask" query (inline query used to display information from multiple pages) looks like this:

{{#ask:
<!--Query conditions-->
[[Category:Triple Triad Cards]]
[[Has patch::7.4]] 
<!--Property values to be returned by the query,  along with the page name-->
|? Has card number
|? Has game icon
}}

Result:

 Has card numberHas vendor value
Doomtrain Card440800
Lindwurm Card4411,500
Thundergust Griffin Card439500

Results Formats

Results formats

To improve the appearance of query results, we generally use the "template" result format, which allows us to customize the display of the results. A variety of other result formats are available, including CSV files, result counts, etc.

Examples

To see examples of tables generated by SMW queries and formatted by a template, see {{Achievement list}} and {{Achievement table row format}}.

Use named args

When using a query that will be formatted by a template, the best practice is to specify the name of each argument that will be passed to the template. Example:

{{#ask:
 [[Has context::Item]]
 | ?Has material type = material-type
 | named args = yes
}}

This allows the template to use the argument {{{material-type}}} instead of unnamed, numbered arguments. One or two unnamed args are okay, but too many can be difficult to read/understand in a complex template. Full example of a query/template using named args: {{Quest list}}, {{Quest list result format}}