Template:Condition: Difference between revisions

From DBpedia Mappings
Jump to navigationJump to search
(Created page with '<includeonly>{|class="wikitable" ! style="text-align:left" colspan="2" | Condition <small>(<span style="cursor:help;">help</span>)</small> |} <h2>Mappings...')
 
No edit summary
 
(25 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>{|class="wikitable"
<includeonly><table class="wikitable">
! style="text-align:left" colspan="2" | Condition <small>([[Template:Condition|<span style="cursor:help;">help</span>]])</small>
<tr><th style="text-align:left" colspan="2"> Condition <small>([[Template:Condition|<span style="cursor:help;">help</span>]])</small>
|}
</th></tr>
{{#ifeq:{{{operator}}}|otherwise|
<tr>
<td width="150px">otherwise</td>
</tr>
|
<tr>
<td width="150px">template property</td>
<td width="400px">{{#if:{{{templateProperty|}}}|{{{templateProperty}}}|<span style="color:red">please define a template property</span>}}</td>
</tr>
<tr>
<td>operator</td>
<td>{{#if:{{{operator|}}}|{{{operator}}}|<span style="color:red">please define an operator (one of: ''isSet'', ''equals'', ''contains'', ''otherwise'')</span>}}</td>
</tr>
{{#ifeq:{{{operator|}}}|isSet| |
<tr>
<td>value</td>
<td>{{#if:{{{value|}}}|{{{value}}}|<span style="color:red">please define a value</span>}}</td>
</tr>
}}
}}
</table><blockquote>{{#if:{{{mapping|}}}|{{{mapping}}}}}</blockquote></includeonly>
<noinclude>'''<nowiki>{{Condition}}</nowiki>'''s are cases of a [[Template:ConditionalMapping|ConditionalMapping]]. They define the template property conditions and their result on the template mapping.


<h2>Mappings</h2><blockquote>
=== Usage ===
{{#if:{{{mappings|}}}|{{{mappings}}}}}</blockquote></includeonly>
 
<pre>
{{Condition
| templateProperty =
| operator        =
| value            =
| mapping          =
}}
</pre>
 
<pre>
{{Condition
| operator = otherwise
| mapping  =
}}
</pre>
 
=== Meanings ===
 
* '''templateProperty''': Define for which template property the condition has to apply.
* '''operator''': Possible values: ''isSet'', ''equals'', ''contains'', ''otherwise''.
** ''isSet'': Condition applies if template property is set (contains any value).
** ''equals'': Condition applies if template property equals ''value''.
** ''contains'': Condition applies if template property contains ''value''.
** ''otherwise'': Only to be used for the last condition of a ConditionalMapping. It equals the else case and defines the template mapping if none of the conditions defined before apply.
* '''value''': If the operator value is ''equals'' or ''contains'', define the template property value here.
* '''mapping''': If the condition applies, the TemplateMapping defined here are applied.
 
=== Example ===
 
A condition which maps a template to the ontology class ''River'' if the template property ''type'' equals ''River'':
<pre>
{{Condition
| templateProperty = type
| operator        = equals
| value            = River
| mapping          =
  {{TemplateMapping
  | mapToClass = River
  }}
}}
</pre>
 
A condition which maps a template to the ontology class ''Island'' if the conditions defined before don't apply:
<pre>
{{Condition
| operator = otherwise
| mapping =
  {{TemplateMapping
  | mapToClass = Island
  }}
}}
</pre>
</noinclude>

Latest revision as of 18:08, 22 December 2014

{{Condition}}s are cases of a ConditionalMapping. They define the template property conditions and their result on the template mapping.

Usage

{{Condition
| templateProperty =
| operator         =
| value            =
| mapping          =
}}
{{Condition
| operator = otherwise
| mapping  =
}}

Meanings

  • templateProperty: Define for which template property the condition has to apply.
  • operator: Possible values: isSet, equals, contains, otherwise.
    • isSet: Condition applies if template property is set (contains any value).
    • equals: Condition applies if template property equals value.
    • contains: Condition applies if template property contains value.
    • otherwise: Only to be used for the last condition of a ConditionalMapping. It equals the else case and defines the template mapping if none of the conditions defined before apply.
  • value: If the operator value is equals or contains, define the template property value here.
  • mapping: If the condition applies, the TemplateMapping defined here are applied.

Example

A condition which maps a template to the ontology class River if the template property type equals River:

{{Condition
| templateProperty = type
| operator         = equals
| value            = River
| mapping          = 
  {{TemplateMapping
  | mapToClass = River
  }}
}}

A condition which maps a template to the ontology class Island if the conditions defined before don't apply:

{{Condition
| operator = otherwise
| mapping = 
  {{TemplateMapping
  | mapToClass = Island
  }}
}}