https://bugzilla.wikimedia.org/show_bug.cgi?id=24337

Markus Krötzsch <mar...@semantic-mediawiki.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Markus Krötzsch <mar...@semantic-mediawiki.org> 2010-08-29 
19:47:19 UTC ---
It turns out that there is a minor issue here but that the main problem is
actually not a bug: what the above template does is to construct a malformed
query when some of the parameters are not given. Namely, the parameters are
simply replaced by nothing (empty strings). So you get a query like, say,

{{#ask:
[[Category:Cities]]
[[City::]]
[[Has a river::]]
|?Population
|?Mayor
|?Size
|?Twinned with
|?Has a river
}}

This query, whether created by a template or not, will cause an error message
from SMW since the conditions cannot be parsed. The minor issue is that SMW
assumes that property condition values are of length at least one. So the first
"]" is taken to belong to a value, which thus extends until the next closing
pair of "]]" after the following condition. This makes the error somewhat hard
to read. But the query would not work without errors either way.

If you want to have optional query conditions in a template, then you should
use the ParserFunctions extension with its #if parser function to test for
emptiness. The whole query part (from [[ to ]]( should then be omitted if no
parameter is given for it. Alternatively, the template could use some relevant
default (syntax: {{{1|default}}}) instead of an empty string. Using "_" there
will at least make the error more readable.

In particular, queries do work properly with template parameters, and this bug
can be closed.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to