Simple example of need for negation operator

Once upon a time, there was speculation that the the combination of SPARQL's
OPTIONAL and UNBOUND
operators are adequate to emulate a negation-as-failure operator.
Previously, we produced examples
that contradicted that claim.   Here is another such example, which is
relatively simple, of a query that
(I believe) one cannot express in SPARQL.  It comes out of a real
application we are implementing for a client, i.e.,
its a use case.

The application involves attaching tags to resources that specify the time
of first use.  In other words,
until the time specified has passed, the resource should not be
retrievable.  In the application, updates
are distributed across triple stores, and the tags serve to insure that
newly updated resources will be visible
at the same time across the distributed stores.  It can happen that a
resource is tagged more
than once (since it may be updated more than once).  Below is a query that
retrieves only Articles
such that none of their time tags has a newer time than the present (phrased
in a SPARQL-like
syntax):

SELECT ?a
FROM model
WHERE
     (?a rdf:type ft:Article) AND
     UNSAID ((?a ex:timetag ?time) AND
                   (?time > $NOW))

This query can also be phrased without difficulty in SQL.  If anyone knows
how to
express this in SPARQL, I'd like to see the solution.

- Bob

Received on Tuesday, 11 December 2007 00:18:50 UTC