tmlab / tmql

Automatically exported from code.google.com/p/tmql
1 stars 0 forks source link

Support Naming Resultcolumns #21

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if you can add something like

Select $t as "type". Same for Flwr.

In addition it should be possible to retireve the list of names so it can be 
used in a UI.

Original issue reported on code.google.com by h.niederhausen@googlemail.com on 14 Dec 2010 at 11:15

GoogleCodeExporter commented 9 years ago
And also for path. :)
It would be also easier to pass the output through mustache and other libs.

Original comment by b...@topicmapslab.de on 14 Dec 2010 at 11:43

GoogleCodeExporter commented 9 years ago
In path the named result columns are confusing.

Do you mean in projection or for path at all? How do you think the syntax looks 
like?

path-expression ::= navigation AS element

ex: topic >> instances AS "name"

Original comment by Sven.Kro...@googlemail.com on 4 Jan 2011 at 10:27

GoogleCodeExporter commented 9 years ago

Original comment by Sven.Kro...@googlemail.com on 4 Jan 2011 at 10:28

GoogleCodeExporter commented 9 years ago
Initially I thought about projections only and I'm not sure if it useful when 
not using projections. When going through the grammar from projection-postfix, 
I think I'd put it in tuple-expression, after asc/desc. But as this is used 
elsewhere, I'm not sure if this is a good place.

Original comment by bnjmn...@gmail.com on 4 Jan 2011 at 11:31

GoogleCodeExporter commented 9 years ago
Yes it is, I added a new production called alias

alias ::= AS literal

and added them at the end of a value-expression like

tuple-expression ::= < alias-value-expression >
alias-value-expression ::= value-expression [ alias ]

In this way, the grammar and syntax is the same for select, flwr and path 
projection which all uses tuple-expressions

Original comment by Sven.Kro...@googlemail.com on 4 Jan 2011 at 11:35

GoogleCodeExporter commented 9 years ago
The feature is implemented in current SNAPSHOT.

The alias can be used after a simple navigation, within a projection, the 
select clause and the return clause.. The syntax is similar two tokens at the 
end of value-expression:

AS string-literal

The result and resultset classes are extended with getter using the column 
alias instead the numerical index.

Original comment by Sven.Kro...@googlemail.com on 5 Jan 2011 at 11:15