Help:Service links

MyWikiBiz, Author Your Legacy — Saturday December 28, 2024
Revision as of 21:28, 19 December 2006 by Centiare (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Semantic MediaWiki can provide links to online services when printing certain data in the factbox. For example, when a geographic coordinate is entered into an article, it makes sense to provide links to online mapping services, so that users can retrieve a map of the specified area with one click. This page explains how such features can be added to the semantic wiki.

Note: To suggest new service links for this wiki, please use the discussion page of that article.

Service links for attributes

The information which additional links to online services should appear in the factbox is attached to the attributes used. For example, the Attribute:Coordinates will always show various links to online maps when printed in the factbox, whereas other attributes that also use the Type:Geographic coordinate might not show this. This is crucial in many applications, since the datatype alone usually does not say much about the type of link. For example an attribute "IMDb number" might be used for a movie's id number at IMDb – but surely not every attribute of Type:Integer should display a link to IMDb.

In order to attach some services to an attribute, the special property provides service is used in the article of the attribute that should show the additional service links. For example, the article Attribute:Coordinates might include the annotation

[[provides service:=online maps]].

Here, "online maps" is the name of a set of service links provided by the wiki. The next section explains how such services can be provided. In the above case, the service "online maps" is already known to the wiki, and every appearance of the attribute "Coordinates" within the factbox will now show the according set of links.

Providing services

Attributes can only use services that are available in the wiki. Since service links may appear in thousands of factboxes, it should be ensured that they can be trusted. For this reason, only users that have sysop (administrator) privileges in the wiki can normally add or modify services. All other users, however, are free to use or not use those services in their attributes as described above. In any case, adding or modifying services should usually be discussed among many users before an admin is asked to put the change into practice.

When adding a service with the special property "provides service", the factbox of the given article will display a link that is labeled like the given service. For example, the factbox of the above attribute "Coordinates" would display the link "online maps." Following this link leads you to a message article, in this case MediaWiki:Smw service online maps, that lists the links that are provided by this service. Though the message might be hard to read due to the long lines, its format essentially is as follows:

 label|http://someurl.org
 label2|http://anotherurl.org
 ...

Every line contains one link that should be shown in the factbox. The label is the text that users will see in the factbox (e.g. "IMDB" if ou link to this service). After the "|" it is followed by a URL that the link will lead to. In most cases, the URL will need to contain certain information about the attribute value for which the service eventually is provided. For example, a link to an online map surely must include the coordinates that the map will show, and a link to IMDb will have to include the ID of the movie that is referred to.

Since the exact data values are not known in advance, the URLs in the above messages only contain place holders of the form $1, $2, $3, … For example, a link to IMDb could look as follows:

IMDb|http://www.imdb.com/title/tt$1/

The placeholder "$1" indicates the position that the attribute should later insert its value into in order to create the actual link in the factbox. The number and contents of the parameters depends on the attribute that uses the service, and especially on its datatype. For instance, a simple integer attribute might merely replace $1 by its value, whereas a geographic coordinate provides much more parameters for latitude, longitude, direction, and much more. In most cases, $1 will be the most relevant parameter that just provides a URL-save string version of the attribute value.

Since service links are typically perceived as "trusted resources," administrators must take some care when formulating links, keeping in mind that users might insert almost arbitrary URL-encoded strings for the place holders.

Extended example

To illustrate the whole process of creating and using a new service, we provide an extended example. Articles about Semantic Web vocabularies such as FOAF contain information about this vocabularies "namespace" and the online service Swoogle allows users to search for background information on such namespaces. Our goal thus is to add a new "Swoogle service" to the Attribute:Namespace that is used on the vocabularies articles.

As a first step, we edit the article Attribute:Namespace and add the line

As an additional service, this attribute provides a 
[[provides service:=Swoogle lookup]] of the entered namespace.

After saving, the factbox shows a link to the (still non-existing) service Swoogle lookup. Clicking this link, an administrator gets a new edit field, into which she enters

Swoogle lookup|http://swoogle.umbc.edu/index.php?option=com_frontpage&service=digest&queryType=digest_ns&searchString=$1

The link was retrieved by using Swoogle and replacing the search string (at the end of the link) with the parameter "$1".

After those changes are saved, the new service is fully functional, and each page that uses Attribute:Namespace will show a suitable link to Swoogle. Some articles will still show the old version, if they are retrieved from cache, but after the next edit or purge, all articles will display the links as expected.