This sounds great! A few thoughts:

- I assume this will lead to the deprecation of the current "sort" and "order" parameters?

- on that note, how can one specify the order of sorting, if more than one column is sorted? Or is the main "sort" parameter still needed for that?

- one other suggestion for a "printout parameter" would be "+ delim=" or "+ delimiter=", which would let you set the character that separates multiple values for this property, if there was more than one; with ", " as the default. This was just discussed in a previous thread, but as a query-wide parameter; it probably makes more sense as a printout parameter. (By the way, it could also be called "+ sep=", if that's not too confusing.)

-Yaron


On Wed, Nov 4, 2009 at 3:41 AM, Markus Krötzsch <markus@semantic-mediawiki.org> wrote:
Hi all,

a feature announcement: the next version of SMW will allow you to control the
appearance of printouts in queries in various new ways. Printouts are
statements of the form "?Property" (or similar) in #ask queries. In table
format, a printout leads to a new column.

One would often like to attach further parameters to printouts to control
their appearance, but #ask supported parameters only for the whole query so
far. This has changed, and it is now possible to add further parameters to a
printout by writing them in the form "|+ parameter=value" after the printout.
The following example illustrates the parameters supported so far:

{{#ask: [[Category:Country]]
|?name |+ limit=1
|?Category |+ order=ascending
|?population |+ align=right
|?president |+ index=1
}}

Here we have 4 printouts with one parameter each. The meaning is as follows:

* The parameter "limit" restricts the number of values that will be shown (a
country might have multiple alternative names, but we want to see only one
here).
* The parameter "order" causes the values to be orders. Possible values are
"ascending"/"asc" and "descending"/"desc". The default is unordered. Note that
this works also for category printouts.
* "align" is an example of a parameter that is specific to a format: when used
in tables, the respective column will be aligned as indicated. Possible values
are "left" (default), "right", and "center". This is useful here since numbers
are more readable when right-aligned.
* The parameter "index" is used to address single fields in multi-valued
properties. Imagine that "president" is a multi-valued property with entries
of the form "name; begin of office; end of office." We only want to see the
names here, and hence we state "index=1" ("index=2" would show only the begin
of office etc.).

The new feature is not perfect yet, and especially the parameters are not
supported by Special:Ask at the moment, so they are lost when clicking further
results. Moreover, "limit" is not always acting as desired: since the datatype
of the property that is used here is still some multi-valued type, many query
printers will not recognize the datatype of the selected component properly.
For example, you cannot have a timeline based on the second component of the
"president" property, since timeline looks for "Type:Date" and does not find
it in the property "president". "index" should still be a useful feature, e.g.
for templated formatting of multi-valued properties.

Cheers,

Markus

--
Markus Krötzsch  <markus@semantic-mediawiki.org>
* Personal page: http://korrekt.org
* Semantic MediaWiki: http://semantic-mediawiki.org
* Semantic Web textbook: http://semantic-web-book.org
--



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel