Wednesday, September 29, 2004

Not is no more

The operation still exists but it's now called "exclude". After spending too much time explaining to people how our "not" is not SQL's "not" but another type of "not" that inverts constraint values combined with the implementer occassionally getting confused between the syntax and the semantics, it lead to this new name. "Not" isn't what it used to be but then again maybe it never was.

From what I can tell so far, "exclude" and subqueries will allow you to perform set difference operations, whether it's clear is another problem. Similarly, you can do OPTIONAL queries using only subqueries but once you get to a few layers of subqueries your head explodes. In these cases it's probably better to have syntactic sugar for certain operations - how users express something and what the machinery underneath does to perform it shouldn't be so tightly coupled.

I made a mistake for the allValuesFrom restriction, here's the corrected version:

select $s $p $x subquery (
select $instance $t $x subquery (
select
from <...#testexclude>
where exclude($instance $t $x))
from <...#testexclude>
where $s $p $instance and $t <tucana:#is> <rdf:type>
and exclude($instance $t $x))
from <...#testexclude>
where $r <rdf:type> <owl:Restriction>
and $r <owl:onProperty> $p
and $r <owl:allValuesFrom> $x
and $s $p $o2
order by $s ;


I also recently read a paper, "OWL Lite- Reasoning with Rules", which clears up the difference between range and allValuesFrom: "[it] takes into account not only the property but also the domain of the statement. For example, you can say that Stefan manages Wolf, and Wolf is of type Student entails that Stefan is of class Advisor." That's also missing from the query but that's an intentional omission. :-)

No comments: