More actions
- You may be looking for this wikis help page on 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.
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 }}
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:
Another great example of this template and SMW in action is with writer:
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]]
- ↑ 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