User:Bongolium500/Beginners Guide to Semantic MediaWiki

From Tardis Wiki, the free Doctor Who reference

Semantic MediaWiki (SMW) is an incredibly powerful MediaWiki extension that this wiki is lucky enough to have installed. This page aims to give a simple but quite in-depth overview of the extension to help the average editor gain enough of an understanding to make important decisions around it. I will aim to use as simple language as possible but if anything is unclear you can feel free to ask on my talk page.

Before we start properly, lets return to the first sentence of this guide:

Semantic MediaWiki (SMW) is an incredibly powerful MediaWiki extension that this wiki is lucky enough to have installed.This page, just up a bit

I'm going to break this down piece by piece as it is essential that this is understood. Semantic MediaWiki is the tool being discussed here. Semantic, in this case, means that the information on a page can be understood by a machine (without the need for any form of AI). SMW is a common shortening for Semantic MediaWiki. MediaWiki is the base software that Fandom, Wikipedia and many other wikis use. An extension is a piece of software that extends the base functionality of MediaWiki.

It isn't particularly important but the reason this wiki is lucky enough to have the extension is that Fandom no longer lets wikis request it.[note 1]

Demonstrating the extension in action[[edit] | [edit source]]

I feel that the best way to learn about Semantic MediaWiki is to use it. Open Special:Ask in a new tab. This page allows you to ask the wiki questions through SMW. Let's say you want to find all of the times Russell T Davies has been credited as a writer. To do this, simply type the following into the top-left box, 'Condition':

[[writer::Russell T Davies]]

Scroll down and click 'Find results'. After waiting for about a short period of time, you will be presented with a list of every time Russell T Davies has been credited as a writer.

Let's try another example, this time in universe. If you want to find out all of the individuals who have the Doctor as their grandparent (e.g. all of the Doctor's grandchildren), you would type the following into the same box (remember to remove [[writer::Russell T Davies]] first):

[[grandparent::The Doctor]]

Click 'Find results' and your presented with a short list of all the individuals who have the Doctor as their grandparent.

Now let's say we also want to find out who the parents of all of these people were. In the top-right box, 'Printout selection', type the following:

Father
Mother

Clicking 'Find results' once more will add 2 more columns to the table with the father and mother of each of these people (when the information is available).

Practical uses on the wiki[[edit] | [edit source]]

This is all well and good, you might be saying, but how can this actually be used on a page. I'll give an example. Let's say you're creating a page about the position of Additional VFX. You'll probably want to include a list of times that role has been credited. You could do it manually but that would be slow and annoying to maintain. With SMW, however, it can be done with just a few lines of code. Return to Special:Ask, clear both boxes (there is a 'clear all entries' link at the top-right, above the 'Printout selection' box, that can do this for you) and type into 'Condition':

[[Additional VFX::+]]

In this case, the '+' is asking SMW to return all of the times Additional VFX has been credited. Add the following to 'Printout selection':

Additional VFX

Clicking 'Find results' gives us a table with exactly what we need. To use this on a page, simply click the 'Code' tab (bellow the 'Find results' button) and copy and paste the code it gives onto the page. What you'd find is that the following small amount of code creates a simple, automatically updated table.

{{#ask: [[Additional VFX::+]]
 |?Additional VFX
 |format=broadtable
 |limit=50
 |offset=0
 |link=all
 |sort=
 |order=asc
 |headers=show
 |searchlabel=... further results
 |class=sortable wikitable smwtable
}}
 Additional VFX
73 Yards (TV story)BBC Wales Graphics
Egg VFX
The Bells of Saint John (TV story)BBC Wales VFX
Boom (TV story)BBC Wales Graphics
Can You Hear Me? (TV story)BBC Wales Graphics
Ben Pickles
The 2D Workshop
The Church on Ruby Road (TV story)BBC Wales Graphics
Egg VFX
Cold War (TV story)BBC Wales VFX
The Day of the Doctor (TV story)Jellyfish Pictures
BlueBolt
The Devil's Chord (TV story)BBC Wales Graphics
The Doctor, the Widow and the Wardrobe (TV story)BBC Wales Graphics
Space Digital
Dot and Bubble (TV story)BBC Wales Graphics
Egg VFX
Empire of Death (TV story)BBC Wales Graphics
Egg VFX
Eve of the Daleks (TV story)Martyn Western
Ben Pickles
Zodiak VFX
The 2D Workshop
Rory Williams (VFX artist)
Fugitive of the Judoon (TV story)BBC Wales Graphics
Zodiak VFX
The Halloween Apocalypse (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX
Hide (TV story)BBC Wales VFX
Journey to the Centre of the TARDIS (TV story)BBC Wales VFX
The Legend of Ruby Sunday (TV story)BBC Wales Graphics
Egg VFX
Legend of the Sea Devils (TV story)Martyn Western
Ben Pickles
Zodiak VFX
Rory Williams (VFX artist)
The Name of the Doctor (TV story)BBC Wales VFX
Nightmare in Silver (TV story)BBC Wales VFX
Nikola Tesla's Night of Terror (TV story)BBC Wales Graphics
Ben Pickles
Once, Upon Time (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX
Orphan 55 (TV story)BBC Wales VFX
Ben Pickles
The Power of the Doctor (TV story)Rory Williams
Martyn Western
Ben Pickles
Zodiak VFX
Revolution of the Daleks (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX
The Rings of Akhaten (TV story)BBC Wales VFX
Rogue (TV story)BBC Wales Graphics
The Snowmen (TV story)BBC Wales VFX
Space Babies (TV story)BBC Wales Graphics
Spyfall (TV story)BBC Wales Graphics
Ben Pickles
Survivors of the Flux (TV story)Martyn Western
Ben Pickles
Zodiak VFX
The 2D Workshop
Rory Williams (VFX artist)
The Timeless Children (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX
Twice Upon a Time (TV story)Ben Pickles
The Vanquishers (TV story)Martyn Western
Ben Pickles
Zodiak VFX
The 2D Workshop
Rory Williams (VFX artist)
Village of the Angels (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX
War of the Sontarans (TV story)BBC Wales Graphics
Ben Pickles
Zodiak VFX

This is what is already used on the Additional VFX page as well as many pages like it. The only difference is that it is made easier using the template {{Job table}}, which adds extra formatting and looks like this:

A quick note on the headings: +

Please ignore the strange text on the headings. This does not occur when the template is used on actual pages

Another great example of this template and SMW in action is with writer:

... further results

Adding information to pages in the first place[[edit] | [edit source]]

At this point, you may be wondering how SMW knows who wrote Rose, for example. It's very simple actually. Somewhere on the page, the following appears:

[[writer::Russell T Davies]]

This small bit of code creates a link to Russell T Davies (this looks identical to a normal link for the reader) and tells SMW that, for this episode, Russell T Davies was the writer. That's it. The only thing with this example is that this is done automatically with the template {{Wales crew}} (as with every other credited crew position from 2005+ episodes of Doctor Who (and a few special cases before hand)). The same principal can be applied to pretty much anything else, allowing almost any data this wiki holds to be machine-sortable.

Going a little deeper[[edit] | [edit source]]

to be added

Notes[[edit] | [edit source]]

  1. This is because the extension is very tricky for Fandom to maintain, especially if a lot of wikis use it. By stopping more wikis from installing the extension, Fandom is aimed to be able to better support wikis that already have it and have no current plans to remove the extension from any wikis

See also and further reading[[edit] | [edit source]]