From Wikipedia, the free encyclopedia
Jump to: navigation, search
Template documentation[view] [edit] [history] [purge]

Template to be used to encode Semantic wikilinks (SWL). For example, both Berlin and Europe link to Germany indicating a relationship, but no knowledge of the nature of that relationship is specified. Using this template, one could put on the Berlin page a link to Germany using this syntax: {{SWL|target=Germany|type=capital of}}. More details on why one would want to encode the semantic nature of links can be found at http://semantic-mediawiki.org/wiki/Help:Introduction_to_Semantic_MediaWiki and Semantic MediaWiki.

And for more context as far as rationale, yes, this is an effort to allow Wikipedia to encode semantic links prior to official adoption of a specific solution (like Semantic MediaWiki).

All pages that use this template can be found at Category:SWL.


| target = 
| label = 
| type = 

Parameter explanations[edit]


  • This field indicates the target page linked by the wikilink. This is typically the only (or first) parameter in a typical wikilink.


  • This field indicates the display label for a wikilink. This is typically the second parameter in a typical wikilink.


  • This field is the hidden semantic type of the relationship. Its only practical effect within the context of Wikipedia is to add a sub-category to the article. For example, if you use the relation type 'phosphorylated by' in a SWL, then the category Category:SWL/phosphorylated_by is created if it does not already exist and added to the article. (Note you should try to re-use existing relationship types if possible.) Aside from that, the relationship type has no practical effect on the current Wikipedia. It exists to provide semantic meaning for the wikilink for use in other systems which use Wikipedia content, or in a later version of Wikipedia which does account for semantic meaning.

Usage example[edit]

The protein encoded by this gene is found as a pentamer and is a major substrate for the cAMP-dependent 
protein kinase ({{SWL|type=substrate_for|target=protein kinase A|label=PKA}}) in cardiac muscle.

renders as:

The protein encoded by this gene is found as a pentamer and is a major substrate for the cAMP-dependent protein kinase ( PKA ) in cardiac muscle.

Understanding the template code[edit]

The code checks for the presence of the special type value "equivalent" and changes the link to be external (as equivalence links are often pointed towards other databases). In either case, if a label is specified, it is used in both the title text and the link display. Equivalent links do not have the category memberships applied. The formatted version of the code is shown here:

{{ #ifeq: {{{type|}}} | equivalent
   | <span class="swl">
       <span class={{{type}}}> 
          [{{{target}}} <span title="{{FULLPAGENAME}} {{{type}}} to {{#if:{{{label|}}}|{{{label}}}|{{{target}}}}}" 
           style="border-bottom:1px dotted orange">{{#if:{{{label|}}}|{{{label}}}|{{{target}}}}}</span>]
   | <span class="swl">
       <span class={{{type}}}>
          [[{{{target}}}|<span title="{{FULLPAGENAME}} {{{type}}} {{#if:{{{label|}}}|{{{label}}}|{{{target}}}}}" 
           style="border-bottom:1px dotted orange">{{#if:{{{label|}}}|{{{label}}}|{{{target}}}}}</span>]]
     </span> [[Category:SWL/{{{type}}}]] [[Category:SWL]] 


It has been run through a function that removes newlines and tab characters so that the template displays inline.