The Semantic Puzzle

Thomas Schandl

Short Semantic MediaWiki Tutorial (with link to sandbox)

On the occasion of the recent publication of our book, Social Semantic Web, we have created an accompanying wiki for you to explore the contents of the book and obtain information about its authors. Staying true to the motto “Eat your own dog food”, the Semantic Web CompanyThe Semantic Web Company (SWC), based in Vienna, provides companies, institutions and organizations with professional services related to the Semantic Web, semantic technologies and Social Software has used a semantic wiki for that purpose.

We opted for Semantic MediaWiki (SMW) and the extensions Semantic Forms and Semantic Drilldown. In this blog post we’ll take a look at the handy features you get with these. This short tutorial is based on my SMW demonstration at the Web of Data Practitioners’ Days in ViennaVienna is the capital and largest city of Austria, and one of the nine states of Austria. Vienna is Austria's primary city, with a population of about 1.731 million (2.4 million within the metropolitan area, more than 20% of Austria's population), and is by far the largest city in Austria, as ... two weeks ago.

As the book is in German, the wiki is set up in German, too, but that shouldn’t be a problem for understanding the demonstrated features. For the following examples, we have created a mirror of our productive wiki, so don’t hesitate to edit and play with this mirror wiki (we might refresh it occasionally, so don’t write any data into the wiki that you don’t also have stored elsewhere). This tutorial is going to take you through the following SMW features:

  • Automatically created lists
  • Faceted search
  • Semantic queries
  • Entering data via forms
  • RDF export

So let’s see what these features hold for us.

  • Automatically created lists

A common problem in wikis like Wikipedia is the (amount of) effort it requires to create and maintain various lists like the list of the EU’s largest cities. It’s an equally laborious and error-prone activity to keep such lists up to date; as a result, there are a lot of useful Wikipedia lists we can imagine that don’t exist at all, like a list of the world’s largest corporations with a CEO younger than 35.

In SMW it is easy to create all kinds of lists with queries. This page for the book’s table of contents is an example. View its source to see the inline queries used to generate the page (click to enlarge or view the source on the wiki):

Semantic Media Wiki Query

As a result, the list is generated afresh any time the table of contents page is called up. If the data on an article’s page has changed, it will also be updated in that list – while in regular MediaWikis one has to manually update the data in both places (the article, and the list), which, apart from the extra work, also makes errors and inconsistencies much more likely.

  • Faceted search

Take at look at the list of articles page… it uses Semantic Drilldown, so you can narrow the displayed articles down by author (“geschrieben von” = “written by”) or by topic (“Schlagwort”): For instance, select a topic from the tagcloud style list and you’ll be presented with a list of articles covering the subject in question. You can add another topic (which makes the set of results larger) or additionally specify an author (which further narrows it down).

  • Semantic queries

A straightforward approach to exploring the values of a semantic property is to just look at the property’s wiki page. E. g. view a list of everyone’s blog URLs on this page: Property:Weblog.

More sophisticated queries can be made on the Special:Ask page.
To display all organisations located in Vienna or GrazGraz is the second-largest city in Austria after Vienna and the capital of the federal state of Styria. It has a population of 291,890 as of 2010 (of which 258.605 have principal residence status). Graz has a long tradition as a student city: its six universities have more than 44,000 students. ... just copy paste

[[Category:Organisation]][[Hat Sitz in::Wien||Graz]]

into the left hand box (“Hat Sitz in” = “is based in”).

Now go a step further and ask for the name and email address of all persons that work for a organisation located in Vienna or Graz and print their e-mail addresses. Again, copy and paste

[[Category:Person]][[arbeitet bei::<q>[[Category:Organisation]][[Hat Sitz in::Wien||Graz]]</q>]]

into the query box and copy and paste

Email

into the box for additional printouts

What is also very useful is that you can save any query on its own page, so users don’t have to know or remember the syntax. Here is the query page for people living in Vienna or Graz: Concept:Persons_working_in_Vienna_or_Graz,

  • Entering data via forms

This feature is one of the essential advantages that SMW holds over a regular MediaWiki: Most of the content of our wiki is automatically generated from data which have comfortably been entered by filling in forms. This means a regular user doesn’t have to edit any wiki text to be able to contribute content.

See for yourself:

Log in with testuser and testuserpw, go to the page Form:Person and enter a name (e.g. your own name; click to enlarge).

Data Form

When you fill in the fields “Works for”, “Friends” and “Topics” you will notice that an autocomplete feature assists you by suggesting pages that are already in the wiki. This helps to avoid multiple wiki pages for a single entity.

Before you submit the form, copy this line and paste it into the “free text” box – it’s the line that calls up the appropriate template, in this case for a person:

{{Template:Person_additional}}

In combination with the data you entered, this will generate the actual wiki page.

There is one thing you need to observe: You will probably find that your information is missing in some of the page’s paragraphs. If that happens just click on “edit” and save the page again, after which the page content will be updated properly.

In this way, a properly set up SMW with Semantic Forms enables the users to enter data without knowing how to write wiki syntax, and assists him or her in the data entering process.

  • RDF export

To top it off, SMW enables you to link your data into the LOD cloud and to reuse properties and classes from external ontologies. Take a look at this exported RDF/XML containing data about the author Andreas Blumauer. You’ll see a lot of foaf terms reused and also an owl:sameAsService that helps to find co-references between different data sets. (http://sameas.org) pointing to his personal URI.

This sums up the introductory tutorial – if you want to learn more about SMW, then check out the wiki document for the complete tutorial or see SMW’s own documentation.

Author: Thomas SchandlThomas Schandl studied business administration at Vienna University of Economics and Business Administration, where he was also employed at the Dept. for Advertising and Marketing Research. In the course of his studies, he specialised in Business Informatics, writing his diploma thesis on ..., SWCThe Semantic Web Company (SWC), based in Vienna, provides companies, institutions and organizations with professional services related to the Semantic Web, semantic technologies and Social Software

Reblog this post [with Zemanta]