[sc34wg3] TMQL: Operators "Not equal"

Lars Marius Garshol larsga at garshol.priv.no
Tue Oct 30 06:14:57 EDT 2007


* Robert Barta
>
> '==' has 'exists semantics' as it is operating on sequences! So
>
>   select $p / name
>   where
>      $p isa person
>   &  $p / homepage != "http://myspace.com/"
>
> might not really signal what is going on. If I read the above quickly,
> then I would select all persons which have not a homepage at MySpace.

The essential problem here is that the notation "glosses over" the  
possibility of $p / homepage producing more than one value.

In tolog

   select $p from
     instance-of($p, person),
     homepage($p, $url),
     $url /= "http://myspace.com/"?

and

   select $p from
     instance-of($p, person),
     homepage($p, $url),
     not($url = "http://myspace.com/")?

actually mean exactly the same. The last line of both queries remove  
all matches (binding sets in TMQL terminology) where $url is "http:// 
myspace.com/".

> But what it means is
>
>   not ($p / homepage == "http://myspace.com/")
>
> So I'm actually asking for all persons where it is
>
>   "not true, that there is at least one MySpace homepage"
>
> The proposed notation
>
>   $p / homepage != "http://myspace.com/"
>
> would more indicate
>
>   "no homepage is on MySpace"
>
> This is also the reason to prefer '==' over '=', because the query
> author should keep that in mind.

So, you are saying that in your opinion '!=' should be left out  
because its semantics are counter-intuitive?

Actually, the

   "not true, that there is at least one MySpace homepage"

semantics seem pretty much like what is wanted and expected to me. Or  
at least no further off target than the semantics for '==', which are  
also not entirely intuitive.

--Lars M.


More information about the sc34wg3 mailing list