Summary: A new feature in SMW allows you to write queries that return plain
unformatted values, useful when results are not directly displayed but further
Many innovative (and sometimes quite hacky ;) applications of SMW use the
results of a query for further processing, e.g. to calculate with returned
numbers, to manipulate strings in the result, or to further process page names
In all of these cases, it is desirable that outputs are not fancily formatted
for the user's eye, but rather returned in a plain simple format that is easy
to process. However, numbers so far were always returned in forms like
"1,234,567", properties would sometimes show tooltips, and links could only be
turned off globally for all query outputs.
A new feature is provided to address this problem in the next release
(currently available in SVN). By specifying "-" or "" (empty string) as an
output format in queries, outputs are returned in plain, unformatted form.
will return a table of four columns, all of which have an explicit output
format (the content after #). The first column are simply the countries, the
second is their area converted to "km²" as usual. The third one is their
population as a plain string (caveat: when numbers get large, scientific
notation is used; fixes for preventing this are welcome). The fourth column is
their capital, again as a plain (unlinked) string. Empty format strings and
"-" mean the same. Spaces are ignored.
For switching off all links (even in the first column), one can set the
parameter "link=none" or replace the first standard column with a new version
by adding the parameter "mainlabel=-" (hide first column) and the new printout
"?#" (display main column, with empty formatting string). I note that
currently there is a difference between "link=none" and the empty format: the
former simply avoids linking and tooltips, while the latter switches off all
formatting. Also, the new feature provides much better control since it can be
selected individually for each printout.
I hope the syntax is acceptable (it is an extension of the current syntax, but
the absence of readable keywords may render it somewhat technical; the
advantage is that it is pretty international).
Developers of own datatypes can extend their datatype implementations to act
appropriately when a datavalue's field "m_outformat" is set to "-" (this is
the only case you need to care about, empty strings won't appear at this
level). Currently, most SMW datatypes make their output as plain as possible
with this formatting switch: page names and URLs are unlinked, dates are in
ISO format, numbers are simple strings.
Semantic MediaWiki http://semantic-mediawiki.orghttp://korrekt.org markus@...