[tmql-wg] Negation in the different TMQL candidates

Rani Pinchuk Rani.Pinchuk@spaceapplications.com
Tue, 30 Mar 2004 13:53:25 +0200


Dear all,

I would like to ask how the different candidate TMQL languages deal
with negations similar to 5.2.2.04 in the use-cases.

Robert Barta wrote already about it:

>  If you have
>
>      in-location->container.id != 'case'
>
>   does this now mean that you select all assocs of type 'in-location'
>   which have a 'container' role and check whether all players of this
>   role are NOT 'case'? Is it a
>
>     "not some roles satisfy it"
>     "there is one which does not satisfy it"
>
>   How can I control the two cases? We have cases
>
>     "not one satisfies it"  (the same as "all do not satisfy it")
>     "at least one satisfies it"
>     "all satisfy it"

For explaining my question let's assume a very simple topic map
with two very simple associations:


      id:1 type:is-author              id:2 type:is-author
     ----------------------           ----------------------
       /                                /           
      /author                          /author      
     /                                /             
    /                                /              
steve-pepper                      holger-rath       

And another extra topic, bla, that doesn't play any role in any
association. 

Finally, in the selects I ignore the topics 'author' and 'is-author'. 

In toma, when we have the following select:

select $player where is-author->author = $player;

we get:

  $player
------------
steve-pepper
holger-rath

We can ask to see the association object ids:

select $player, %is-author where is-author->author = $player;

we get:

  $player   | %is-author
------------+------------
steve-pepper|     1
holger-rath |     2

Till here it is quite clear. The question is how the negation of the
above will work. In toma the following:

select $player, %is-author where is-author->author != $player;

Could give:

  $player   | %is-author
------------+------------
bla         |     1
bla         |     2

Because the topic 'bla' indeed doesn't play the author role in an
association of type is-author. But actually the more correct result
is: 


  $player   | %is-author
------------+------------
steve-pepper|     2
holger-rath |     1
bla         |     1
bla         |     2

Because the topic 'steve-pepper' doesn't play the role author in the
association object 2, and the topic 'holger-rath' doesn't play the
role author in the association object 1. And in toma the expression
is-author->author represents the topics that play the role author in
the associations of type is-author.

I have some vague ideas of how to solve this ambiguity in toma. One
way might be to write it as:

select $player, %is-author where $player not in is-author->author;

However, the first thing I did was to go and look at 5.2.2.04
solutions of the other candidate languages. But it is not totally
clear to me how the other languages avoid the problem from the
solutions to this use case. I know that in tolog for example, the
negation is like a filter - so it removes ALL the matches in the
association. But I wonder if/how it is possible to have the second
possibility in tolog.

I am not sure how TMPath and AsTMa? deal with this problem. 

So my question is if you can explain how the different languages deal
with the above two possibilities. 

Thanks,

Rani



-- 
Rani Pinchuk
Software Engineer
Space Applications Services
Leuvensesteenweg, 325
B-1932 Zaventem
Belgium

Tel.: + 32 2 721 54 84
Fax.: + 32 2 721 54 44

http://www.spaceapplications.com