in reply to tree-oriented query against table-oriented data
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: tree-oriented query against table-oriented data
by dimar (Curate) on Jul 04, 2006 at 15:36 UTC | |
i guess, this will not exist, because it is actually a combination of querying data from a database and displaying the result. That is one way of evaluating the problem, however it is possible to 'rethink' the situation if you strip away pre-existing paradigms, methodologies, and ask the following: Given this:
What can I use to transform it into this?:
The key consideration here is a simple question of transforming the flat 'row-based' representation into a 'nested representation'. This does not necessarily involve a database at all. Nor does it necessarily involve 'displaying' anything (unless you count using Data::Dumper to show the output for illustrative purposes only).
=oQDlNWYsBHI5JXZ2VGIulGIlJXYgQkUPxEIlhGdgY2bgMXZ5VGIlhGV
| [reply] [d/l] [select] |
by BrowserUk (Patriarch) on Jul 04, 2006 at 22:57 UTC | |
Try this:
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
by dimar (Curate) on Jul 05, 2006 at 15:11 UTC | |
Just to refocus on the OP, the question was, (given the example 'one-off' solution that BrowserUk illustrated for this specific example, and considering the similarly-coded 'one-off' solutions by the OP in the past) where does there exist a "general purpose" mechanism to further abstract the process of doing this kind of transformation, such that there is no need to modify the 'one-off' code every time someone wants a different 'pivot' of the data structure. The question is now mostly academic, since the humble aspirant has gone on to code a solution himself, absent a preexisting and obvious choice out there. It is called 'vpath_pivot', named after the 'pivot table' feature found in spreadsheet software. It generates arbitrarily-nested tree structures using perl data variables, constructed from queries like:
NOTE: the above is not SQL, it just looks similar for readability. NOTE: the main approach here is to give the user the ability to 'slice and dice' the 'flat' data into different 'tree structures' all within a simple syntax (i.e., no need to re-edit the perl code). tyvm for the replies
=oQDlNWYsBHI5JXZ2VGIulGIlJXYgQkUPxEIlhGdgY2bgMXZ5VGIlhGV
| [reply] [d/l] |