Working With MediaWiki
tables on user information. You just have to decide on which database will hold the information, and then add the following to LocalSettings.php:
$wgSharedDB = " main-database-name " ;
Though “shared DB” sounds like a big deal, by default only tables that have to do with user information are shared.
How SMW works: an example
Let’s say you have a wiki about wines. Now, you want to be able to see a list of all the Chardonnay wines grown in the South of France. On a typical wiki, whether it’s Wikipedia or anything else (even, for the most part, non-MediaWiki wikis), there are essentially two options: you can compile such a list manually on some wiki page, or you can tag all such pages (assuming there’s a page about every wine) with a category like “Chardonnay wines from the South of France”.
Both types of actions are done on Wikipedia all the time, and on many other wikis as well. However, they both have problems: the first option, manually compiling a list, takes a lot of work, and requires modifying each time a new wine page is added that would go that list, or when some error is discovered. In the second case, the list (on the category page) is generated automatically, but the information has to be added painstakingly to each page. And if you’re expecting users to do it, they need to be given precise instructions on how to add categories and what the categories should be named (should it be “the South of” or “Southern”?), and in general, what the ideal data structure should be. Should there be a “Chardonnay” category for each country covered in the wiki, even those with only one or two wines to their name? And, conversely, should countries, or regions, with many wines to their name be further split up, say by year? Or should the year be tagged with a separate category?
Semantic MediaWiki offers a solution to this problem. Instead of compiling lists, or having an overload of categories, you can define a single infobox template meant to be put on wine pages, that both displays the relevant information (region, variety, year, etc.) for each wine, and stores that information in a way that can be queried. So instead of having to manage a large and probably somewhat chaotic set of categories, you can keep the data structure simple, and move the complexity (such as there is) to the queries that display the data.
What about the infoboxes - isn’t it still difficult for users to learn how to add and populate those? For that, there’s the Semantic Forms extension, covered in the next chapter, that provides forms so that users don’t need to see the underlying wikitext syntax in order to create and change data.
Finally, SMW, in conjunction with some other SMW-based extensions, allows you to go one better than simply displaying information in lists or categories - you can show the information in tables, you can display wines on a map, you can aggregate wines by country, year, etc. to show their breakdown, and you can allow users to do faceted searches on all of those fields in order to find the wine(s) that interest them.
Semantic triples and properties
Semantic MediaWiki is built around data, and in Semantic MediaWiki every piece of data is represented as a “triple” — a semantic-webconcept that indicates a three-part structure: a subject, a predicate and an object. An example of a triple would be:
Canada Has capital Ottawa
“Canada” is the subject; “Has capital” is the predicate, or relationship between the two concepts; and “Ottawa” is the object.
In Semantic MediaWiki, the predicate is known as the “property”. And the subject is always the page on which the value is stored.
The easiest way to encode this specific triple would be to go to the page on the wiki named “Canada”, click on “edit”, and write the following:
[[Has capital::Ottawa]]
This looks similar to the MediaWiki syntax for encoding links, and for storing category information. The difference here compared to both of those is that there are two colons instead of one. "Has capital" here represents the predicate, or middle value, or property, of the triple.
What gets displayed on the page? It depends on the “type” of the property. If the property is defined as being of type “Page”, i.e. a link, then “Ottawa” shows up as a link. If it’s defined as being of type “String” or “Text”, then it shows up on the page as simply a string. (There are other property types, but
Weitere Kostenlose Bücher