Writing result printers/Aggregatable printers
Result printer that supports the distribution parameter, and related parameters. It allows the user to choose between regular behaviour or getting a distribution of values.
For example, this result set: "foo bar baz foo bar bar ohi" will be turned into
- bar (3)
- foo (2)
- baz (1)
- ohi (1)
Such formats inherit from the class SMWAggregatablePrinter, which in turn derives from SMWResultPrinter. In most cases they should not implement getResultText, which is handled by SMWAggregatablePrinter. Instead they should implement the getFormatOutput method. It has a similar function as getResultText, since it is also responsible for constructing the formats output and returning it. However, it does not get handled a query result object, but rather an array with already processed data depending on the values of the distribution-related parameters. This data is an associative array where each array key is a label, and their corresponding value is a number.