W3C home > Mailing lists > Public > public-rdf-dawg-comments@w3.org > February 2005

Re: Problems with WITH and FROM

From: Seaborne, Andy <andy.seaborne@hp.com>
Date: Wed, 23 Feb 2005 14:55:29 +0000
Message-ID: <421C9961.8020905@hp.com>
To: Bob MacGregor <bmacgregor@siderean.com>
Cc: public-rdf-dawg-comments@w3.org

Bob MacGregor wrote:
> 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.

The working group has had a long debate about these keywords - in a strawpoll,
people found it marginally clearer if FROM kept the name and WITH didn't.  I
agree that it can confuse and better suggestions are welcome.

> 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):
> SELECT ...
>    Graph ?g1 {...}
>    Graph ?g2 {...}
>    AND
>      {{?g1 = my:a} UNION {?g1 = my:b}
>    AND
>     {{?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.

I'm not complete clear as to what RDF dataset your trying to build here - could
you describe it some more?  What is the "="? assignment, equality test or
owl:sameAs (N3 style).

Is it trying to form the RDF merge of two graphs into new,  named one?  If so,
than the expectation is that union is formed outside the query environment (c.f.
creating the inference closure of a graph).

The WITH/FROM combination isn't the only way to assign a dataset to a query -
indeed, I don't expect it to be the usual way for systems of any size where I
expect the dataset to be passed to the query engine

We did discuss the fact that association of the dataset to the query execution
is a protocol issue, but sometimes there is no "protocol" to peform this (e.g.
local query).  This will work out as we publish the protocol.

WITH/FORM are most useful in small scale use (including the testing) where 
creation of graphs just for the life of the query is not an undue burden.

See also:
for some examples of datasets

> 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}

Could you explain that example a bit further?  I find myself guessing as to it
meaning but I think it is creating the RDF merge of my:a and my:b and assigning
it to ?g1 (etc).  What name does it get?  Some system defined out?

If the query says: "SELECT ?g1" what gets returned for ?g1 ?

> Cheers, Bob
	Thanks for the comments
Received on Wednesday, 23 February 2005 14:55:42 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 20:52:05 UTC