W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > January to March 2005

Problems with WITH and FROM

From: Bob MacGregor <bmacgregor@siderean.com>
Date: Sun, 20 Feb 2005 15:00:02 -0800
Message-ID: <42191672.3040709@siderean.com>
To: public-rdf-dawg@w3.org

The WITH and FROM constructs embody some unfortunate choices.

Background graphs represent the most common case, while named
graphs are going to see less use.  The FROM keyword in SQL will
seem most familiar to programmers, and its natural that it would
refer to background graphs.  The current language spec reverses this
commonsense idea, teaming the less used keyword WITH with the
more used type of graphs.

Suppose an unsuspecting programmer writes the following

FROM my:g
WHERE (?a my:foo my:b)

The FROM clause will either be ignored or an error message might
be thrown, but its not going to give the "expected" results.  Substituting
WITH for FROM fixes the problem, but it would be much better
if we didn't design a propensity for human error right into the language.

The FROM clause inherently defines a disjunction (the poorly-
named UNION construct).  However, by masking the fact that
it defines a disjunction, it also masks a lack of generality.  Consider
the following query, which either is legal or should be (modulo my
ignorance of SPARQL syntax):

   Graph ?g1 {...}
   Graph ?g2 {...}
     {{?g1 = my:a} UNION {?g1 = my:b}
    {{?g2 = my:c} UNION {?g2 = my:d}}

This query is not expressible using the FROM clause.  This example shows
that the FROM clause is superfluous (or should be), and non-general.

Best would be to eliminate it entirely, and rename "WITH' to 'FROM'.

If you really want convenience, which is what FROM seems to be all
about, try adding an 'IN' operator, e.g.,  something like

     ?g1 IN {my:a, my:b}
     ?g2 IN {my:c, my:dJ}

Cheers, Bob
Received on Sunday, 20 February 2005 23:00:35 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:00:46 UTC