Difference between revisions of "Template:Condition"

From DBpedia Mappings
Jump to: navigation, search
Line 38: Line 38:
 
<pre>
 
<pre>
 
{{Condition
 
{{Condition
| otherwise
+
| operator = otherwise
 
| mapping  =
 
| mapping  =
 
}}
 
}}
Line 46: Line 46:
  
 
* '''templateProperty''': Define for which template property the condition has to apply.
 
* '''templateProperty''': Define for which template property the condition has to apply.
* '''operator''': Possible values: ''isSet'', ''equals'', ''contains''.
+
* '''operator''': Possible values: ''isSet'', ''equals'', ''contains'', ''otherwise''. ''otherwise'' is 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.
 
** ''isSet'': Condition applies if template property is set (contains any value).
 
** ''isSet'': Condition applies if template property is set (contains any value).
 
** ''equals'': Condition applies if template property equals ''value''.
 
** ''equals'': Condition applies if template property equals ''value''.
Line 52: Line 52:
 
* '''value''': If the operator value is ''equals'' or ''contains'', define the template property value here.
 
* '''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.  
 
* '''mapping''': If the condition applies, the TemplateMapping defined here are applied.  
* '''otherwise''': otherwise is 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.
 
  
 
=== Example ===
 
=== Example ===
Line 72: Line 71:
 
<pre>
 
<pre>
 
{{Condition
 
{{Condition
| otherwise
+
| operator = otherwise
 
| mapping =  
 
| mapping =  
 
   {{TemplateMapping
 
   {{TemplateMapping

Revision as of 17:18, 10 May 2010

{{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. otherwise is 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.
    • 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.
  • 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
  }}
}}