<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://www.suws.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Help%3AService_links</id>
	<title>Help:Service links - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.suws.org.uk/wiki/index.php?action=history&amp;feed=atom&amp;title=Help%3AService_links"/>
	<link rel="alternate" type="text/html" href="https://www.suws.org.uk/wiki/index.php?title=Help:Service_links&amp;action=history"/>
	<updated>2026-04-30T01:34:02Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://www.suws.org.uk/wiki/index.php?title=Help:Service_links&amp;diff=140&amp;oldid=prev</id>
		<title>DavidNewman: Added help page</title>
		<link rel="alternate" type="text/html" href="https://www.suws.org.uk/wiki/index.php?title=Help:Service_links&amp;diff=140&amp;oldid=prev"/>
		<updated>2011-09-11T20:18:35Z</updated>

		<summary type="html">&lt;p&gt;Added help page&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Semantic MediaWiki can provide &amp;#039;&amp;#039;&amp;#039;links to online services&amp;#039;&amp;#039;&amp;#039; when printing certain data in the factbox and in property pages. For example, when an article contains a geographic coordinate, it is useful to provide links to online mapping services so that users can retrieve a map of that location with one click. Another example is to provide a link to an online currency converter for financial amounts. This page explains how you can add such features to a semantic wiki (without writing PHP code to support a new datatype).&lt;br /&gt;
&lt;br /&gt;
== Service links for properties==&lt;br /&gt;
&lt;br /&gt;
The information for additional links to online services in the factbox is associated with the [[Help:Properties_and_types|property]] used. For example, this wiki&amp;#039;s [[Property:Coordinates]] will show various links to online maps when it appears in the factbox, whereas other properties that also use [[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.&lt;br /&gt;
&lt;br /&gt;
To make a property display service links, add the special property [[Property:Provides service|provides service]] on its page. For example, the article Property:Coordinates might include the annotation&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;[[provides service::online maps]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here, &amp;quot;online maps&amp;quot; is the name of a set of service links provided by the wiki. The next section explains how you specify these service links.&lt;br /&gt;
&lt;br /&gt;
After you specify that a property provides service links, its property values in the factbox and on the property&amp;#039;s own page will show an icon [[Image:Service links icon.png]] that displays the service links when clicked.&lt;br /&gt;
&lt;br /&gt;
== Providing service links ==&lt;br /&gt;
In a nutshell, a wiki administrator puts the text specifying the appearance of service links in a special message article in the &amp;quot;MediaWiki&amp;quot; namespace named &amp;lt;tt&amp;gt;MediaWiki:Smw service &amp;#039;&amp;#039;service name&amp;#039;&amp;#039;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
Continuing our example for [[Property:Coordinates|coordinates]], the text for &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[[provides service::online maps]]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
is in the message article [[MediaWiki:Smw service online maps]].&lt;br /&gt;
&lt;br /&gt;
Normally only users that have &amp;#039;&amp;#039;sysop&amp;#039;&amp;#039; (administrator) privileges in the wiki can add or edit pages in the MediaWiki namespace, hence only they can modify service links.&lt;br /&gt;
This is a reasonable restriction for most wikis: since service links may appear in thousands of factboxes, they need to be trusted. &lt;br /&gt;
Adding or modifying services should usually be discussed among many users before an administrator puts the change into practice.&lt;br /&gt;
&lt;br /&gt;
All users, however, are free to associate properties with available services as described above.&lt;br /&gt;
&lt;br /&gt;
=== The Mediawiki:Smw_service_&amp;#039;&amp;#039;service_name&amp;#039;&amp;#039; format ===&lt;br /&gt;
&lt;br /&gt;
If you look at [[MediaWiki:Smw service online maps]], though the message might be hard to read due to the long lines, its format essentially is as follows:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
 label|http://someurl.com&lt;br /&gt;
 label text2|http://anotherurl.org&lt;br /&gt;
 ...&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every line contains one service link. The &amp;#039;&amp;#039;label&amp;#039;&amp;#039; is the text that users will see in the service link pop-up. After the pipe symbol &amp;#039;|&amp;#039; is the &amp;#039;&amp;#039;URL&amp;#039;&amp;#039; that the link will lead to.&lt;br /&gt;
&lt;br /&gt;
In most cases, you want to provide information from the property value in the link.  For example, a link to an online map service has to include the coordinates to display, and a link to a movie web site will have to include the ID of the movie.  Since the exact data values are not known in advance, you use placeholders of the form &amp;#039;&amp;#039;$1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;$2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;$3&amp;#039;&amp;#039;, &amp;amp;hellip; in the URL.  For example, the message text for a service link to IMDb could be:&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;IMDb|http://www.imdb.com/title/tt$1/&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
When SMW displays the service links for a property value, it substitutes the property value&amp;#039;s information for these placeholders.  In this IMDB example, a movie ID of Type:Number will replace $1 with the numeric value, and voilà, the service link for a movie links to its information on IMDB!&lt;br /&gt;
&lt;br /&gt;
Since service links are typically perceived as &amp;quot;trusted resources,&amp;quot; administrators must take care when formulating links, keeping in mind that users can accidentally or maliciously pass arbitrary URL-encoded strings to service link URLs in the place holders.&lt;br /&gt;
&lt;br /&gt;
=== Information passed for each placeholder ===&lt;br /&gt;
&lt;br /&gt;
The number and contents of the parameters that replace &amp;#039;&amp;#039;$1&amp;#039;&amp;#039;, &amp;#039;&amp;#039;$2&amp;#039;&amp;#039;, &amp;#039;&amp;#039;$3&amp;#039;&amp;#039;, &amp;amp;hellip; depend on the [[Help:Properties_and_types#Datatypes|datatype]] of the property.&lt;br /&gt;
For instance, a simple integer property replaces $1 with its value, whereas a geographic coordinate provides parameters for latitude, longitude, direction, and much more. In most cases, $1 is the most relevant parameter that just provides a URL-safe string version of the property value.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!-- these from the comments in the PHP source code for each DataValue&amp;#039;s getServiceLinkParams() --&amp;gt;&lt;br /&gt;
; [[Type:Page]]&lt;br /&gt;
: $1: URL-encoded article name (no namespace), with underscores replaced by spaces&lt;br /&gt;
&lt;br /&gt;
; [[Type:Number]] (and types with custom units)&lt;br /&gt;
: $1: numerical value in English punctuation&lt;br /&gt;
: $2: integer version of value, in English punctuation&lt;br /&gt;
: $3: &amp;#039;&amp;#039;From SMW version 1.1 onwards&amp;#039;&amp;#039; unit, if any.&lt;br /&gt;
&lt;br /&gt;
; [[Type:String]] (but not [[Type:Text]])&lt;br /&gt;
: $1: URL-encoded string&lt;br /&gt;
&lt;br /&gt;
; [[Type:URL]]&lt;br /&gt;
: $1: URL-encoded value of the URL(includes &amp;lt;tt&amp;gt;mailto:&amp;lt;/tt&amp;gt; for [[Type:Email]])&lt;br /&gt;
&lt;br /&gt;
; [[Type:Geographic coordinate]]&lt;br /&gt;
: $1: latitude integer degrees&lt;br /&gt;
: $2: longitude integer degrees&lt;br /&gt;
: $3: latitude integer minutes&lt;br /&gt;
: $4: longitude integer minutes&lt;br /&gt;
: $5: latitude integer seconds&lt;br /&gt;
: $6: longitude integer seconds,&lt;br /&gt;
: $7: latitude direction string (N or S)&lt;br /&gt;
: $8: longitude direction string (W or E)&lt;br /&gt;
: $9: latitude in decimal degrees&lt;br /&gt;
: $10: longitude in decimal degrees&lt;br /&gt;
: $11: sign (- if south) for latitude&lt;br /&gt;
: $12: sign (- if west) for longitude&lt;br /&gt;
&lt;br /&gt;
Since geographic coordinates are so complicated, SMW includes a default message for [[MediaWiki:Smw service online maps]] &amp;amp;mdash; just add &amp;lt;nowiki&amp;gt;[[Provides service:online maps]]&amp;lt;/nowiki&amp;gt; to any properties you have of [[Type:Geographic coordinate]].&lt;br /&gt;
&lt;br /&gt;
The other datatypes do not support service links.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Display of Property:Provides_service ===&lt;br /&gt;
&lt;br /&gt;
When adding a service links to a property with the special property &amp;quot;[[Property:provides service|provides service]]&amp;quot;, the property page&amp;#039;s factbox should display a link to the message article for the service.  &amp;#039;&amp;#039;However, this feature is not working in SMW 1.0 (bug 12438).&amp;#039;&amp;#039;&lt;/div&gt;</summary>
		<author><name>DavidNewman</name></author>
	</entry>
</feed>