W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > April to June 2006

Comments on 2.6 "Multiple Matches" (CR 6 Apr 2006)

From: Fred Zemke <fred.zemke@oracle.com>
Date: Fri, 09 Jun 2006 00:03:11 +0000
Message-ID: <4488BA86.5040103@oracle.com>
To: public-rdf-dawg@w3.org




2.6 Multiple matches
First sentence: "The results of a query is the set of all pattern
solutions that match the query pattern, giving all the ways a query
can match the graph queried."  But sets eliminate duplicates,
and we have the DISTINCT operator as an optional syntactic choice
about whether to eliminate duplicates.  Instead, this should say
that the result of a query is a sequence of solutions.  See
section 10.1 "Solution sequences and result forms".


2.6 Multiple matches
The semantics of the empty graph pattern has not been defined.
I think the following queries are instructive:

a) SELECT ?a
   FROM graph
   WHERE { }

b) SELECT ?a ?b
   FROM graph
   WHERE { }

c) SELECT ?a ?b
   FROM graph
   WHERE { ?a foaf:verb foaf:noun }

d) SELECT ?a ?b
   FROM graph
   WHERE { ?a foaf:verb foaf:noun .
   OPTIONAL { ?a foaf:verb2 ?b } }

One's initial impulse is that query a) should result in the set of
all mappings of { ?a } to the scoping set (not the set of all
total mappings of V to the scoping set; see related comment).
Or equivalently, the user might view the result as an enumeration
of the scoping set of the graph.

Then query b) would result in the set of all mappings of { ?a, ?b }
to the scoping set, or, naively, the cross product of the scoping
set with itself. 

However, I believe that c) and d) should result in a subset of the
result of b).  Now in the case of d) in particular, OPTIONAL is
intended to allow for a result which is a partial binding, ie, one
that binds ?a but does not bind ?b.  If it happens that there is
no binding for ?b, then the result would not be a subset of the
cross product of the scoping set with itself.

My conclusion is that in order to support OPTIONAL and UNION, we
have to permit a result that is a partial mapping.

Coming back to query b), in order for it to contain query d) as a
subset, the result of b) must be all partial functions from {?a, ?b}
to the scoping set.  Alterantively, a naive view might
imagine augmenting the scoping set with a single "missing" element,
distinct from all other elements, in which case the result of b)
is the cross product of the augmented scoping set.

And as for a), it seems the result must be the set of all partial
functions of { ?a } to the scoping set, or equivalently, an
enumeration of the augmented scoping set.

As a different approach to this issue, consider these two queries:

a1) SELECT ?a
    FROM graph
    WHERE { BOUND (?a) }

a2) SELECT ?a
    FROM graph
    WHERE { !BOUND (?a) }

I believe the following things:
-- the result of a) should be the union of the result of a1) and a2)
-- the result of a1 should be an enumeration of the scoping set,
-- the result of a2 should be a single solution, in which ?a is
not bound. 

Fred
Received on Friday, 9 June 2006 05:40:16 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 16:15:26 GMT