User:Bongolium500/Beginners Guide to Semantic MediaWiki

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.

Demonstrating the extension in action
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
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.

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, 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:

Adding information to pages in the first place
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 (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
to be added

See also and further reading

 * This wiki's help page on Semantic MediaWiki
 * Semantic MediaWiki's website
 * Semantic MediaWiki's user manual
 * The Semantic MediaWiki test wiki on Fandom