[tmql-wg] aliases

Lars Marius Garshol larsga@ontopia.net
Wed, 25 Feb 2004 23:03:38 +0100

* 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.

| 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.

Lars Marius Garshol, Ontopian         <URL: http://www.ontopia.net >
GSM: +47 98 21 55 50                  <URL: http://www.garshol.priv.no >