Dear All,

I'm looking for a way to produce matrices out of relations between arbitrary types of objects/pages in SMW. Simple example would be a 'traceability matrix' between pages within such categories as 'Business Requirement' and 'System Requirement'. Constructed matrix would have business requirements and system requirements as row and column headers respectively, while actual elements would be either emply (no traceability) or flagged (traceability exists).

Good example is provided in the Wikipedia article:
http://en.wikipedia.org/wiki/Traceability_matrix

More complex example (one that I have in mind) would be based not on a simple relationship, but on internal objects representing relationships among various objects with additional scalar properties. In this case, cell content would be more flexible and somehow derived from the properties, e.g. color, icons, formatting, etc.

Next, I'm able to produce such matrices using a moderately complex incantation based on obscure things like arrays and loops, but it's O(NxM), needs to be tailored for a particular type of matrix, and look awful in general.

I believe that general-purpose matrix/pivot style result formatter for inline queries would be good for SMW. Moreover, I'd like to try to blow the dust from my PHP skills and actually produce one. What I'm looking for is some informed advice on how to approach this one.

My initial idea is to create an extension that introduces a {{#pivot...}} instruction that actually does underlying query and formatting. Does it make sense? Or it is something that can't be built outside the SMW core?
 
--
Best regards,
Igor Lobanov