I am setting up some templates for a Semantic Mediawiki implementation. Template params are being fed into annotations. However, the values are optional; there's not always going to be a value in every field. This causes trouble with some data types. Specifically, if I have
{{#set:
| Has phone={{{phone}}}
}}
I will get an error of the form URIs of the form *** are not allowed
where *** is either {{{phone}}}
or whatever default value I try to drop in there. It seems impossible for datatypes like phone or email to be empty. I cannot figure out how to support empty values for these fields in my templates. What is the correct pattern to use for null values in SMW annotations?
You can use the default-value feature of template parameters, but give it a blank default value:
{{#set:
| Has phone={{{phone|}}}
}}
(Updated:) Or if you need to prevent it setting anything at all, wrap it in a conditional:
{{#if: {{{phone|}}}
| {{#set: Has phone={{{phone}}} }}
}}