[tmql-wg] aliases

Rani Pinchuk Rani.Pinchuk@spaceapplications.com
Thu, 26 Feb 2004 10:46:33 +0100


Hi Lars,

Two comments/questions:

1. Variants can be placed one inside the other. I am not sure if 

select $TOPIC from
    { value($TN, "cpu") |
      value($VN, "cpu"), variant-name($TN, $VN) },
    topic-name($TOPIC, $TN)?

covers that, but I might be wrong (?).

2. It seems to me that in many applications it is necessary to find a
topic only by its name (for example question/answering systems), and if
so, the alias command can become quite popular. 
On the other hand, macros/functions/inference rules usually suffer in
performance compared to a built in feature (especially here, if you take
into account the recursive nature of the variant). 

I am not against having a mechanism to extend the language like
inference rules, but I think that because of performance issues, the
popular functions should be built in. Isn't alias popular enough?

Rani

On Wed, 2004-02-25 at 23:03, Lars Marius Garshol wrote:
> * Rani Pinchuk
> | 
> | I would like to ask you about your opinion over an operator called
> | "alias" or "al" for short. The idea is that many topics might have
> | different basenames some in different scopes, but some are just
> | aliases.
> 
> Are they not all aliases, in the sense that they are different names
> for the same thing?
>  
> | Probably, all those strings will be located in the baseName node -
> | some as baseNameString and some as resourceData of a variant.
> 
> Yep.
>  
> | When looking for the processor topic, one might search it using
> | other terms then 'processor'. If the query should define a search in
> | the baseName + the resourceData of the variants (of maybe more then
> | one level), the query can become quite big. Instead the alias
> | operator can be used as follows:
> | 
> |  select $topic where $topic.alias = 'cpu';
> 
> Hmmmm. We actually support this in tolog as follows:
> 
>   select $TOPIC from
>     { value($TN, "cpu") |
>       value($VN, "cpu"), variant-name($TN, $VN) },
>     topic-name($TOPIC, $TN)?
> 
> As you say the alias bit is kind of awkward, but you could solve that
> by making an inference rule as follows:
> 
>   alias($TOPIC, $NAME) :- { 
>     value($TN, $NAME) |
>     value($VN, $NAME), variant-name($TN, $VN)
>   }, topic-name($TOPIC, $TN).
> 
> Now doing this sort of query is suddenly trivial:
> 
>   alias($TOPIC, "cpu")?
> 
> In my opinion this kind of operation is not sufficiently fundamental
> that it belongs in the QL itself, but that we should have some kind of
> modularization feature that allows this to be encapsulated and reused
> by the language user. AsTMa? has this in the form of function
> definitions, tolog in the form of inference rules, and it's our goal
> that TMQL will also have this in some form.