[tmql-wg] Proposed new requirement: Ability to produce textual
output
Robert Barta
rho@bigpond.net.au
Sun, 06 Jul 2003 19:59:02 +1000
On Thu, Jul 03, 2003 at 05:51:53PM +0200, Lars Marius Garshol wrote:
> | I would expect - depending on the query - that both, matching and
> | navigation features should be in the language. SQL has it, XQuery
> | has it, some RDF-query languages have it to a certain extent.
>
> Robert, could you expand on this a little? I'm not sure I understand
> what you mean.
Let's look at XQuery (SQL is such a ... mature language):
{
for $b in doc("http://www.bn.com/bib.xml")//book[editor]
return
<reference>
{ $b/title }
{$b/editor/affiliation}
</reference>
}
In the first for-loop the results is narrowed-in: books with editors.
Some results can be directly used from this match like the title. For
other some more navigation is done ($b/...go..somewhere../...).
After the navigation phase these results again could be subjected a
search or used to build a new search:
<result>
{
for $u in doc("users.xml")//user_tuple
order by $u/name
return
<user>
{ $u/name }
{
for $b in distinct-values(doc("bids.xml")//bid_tuple
[userid = $u/userid]/itemno)
for $i in doc("items.xml")//item_tuple[itemno = $b]
let $descr := $i/description/text()
order by $descr
return
<bid_on_item>{ $descr }</bid_on_item>
}
</user>
}
</result>
> | Hosting navigational aspects in your abstract model seems to be a
> | bit difficult. Also, there is more complication if we allow content
> | to be generated conditionally: Where do I host the condition?
>
> That is a good question. TMTL solves this by having conditional
> features in the output language itself, but if there is only a query
> result and then a rendering of that this may be difficult.
Right, so I simply assume that there should be an 'if' in the query
language.
\rho