W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > December 2007

Simple example of need for negation operator

From: Bob MacGregor <bob.macgregor@gmail.com>
Date: Mon, 10 Dec 2007 16:18:42 -0800
Message-ID: <a0d0f8f70712101618q698f0940w558ddd83848407e8@mail.gmail.com>
To: public-rdf-dawg-comments@w3.org
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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:14:52 GMT