Blank nodes and variables (was Re: Definition: Graph Pattern Matching)

On Tue, 24 Aug 2004 11:58:00 -0500, Dan Connolly <connolly@w3.org> wrote:
> I see some nice work on the core terms in the spec in
> sections 2.2 and 2.3
> http://www.w3.org/2001/sw/DataAccess/rq23/#GraphPatterns

...

> I consider bNodes to be variables, so I'd rather:
> 
>  let V be the set of universal variables
>  let B be the set of existential variables
> 
> since RDF mt "effectively treats all blank nodes as having the same
> meaning as existentially quantified variables in the RDF graph in which
> they occur"

...

I'd like to try to focus on one point here - variables and blank
nodes.  We should take care with our terminology to keep the
distinction between these clear.  If we start calling blank nodes
(existentially quantified) variables, we will get into confusion with
talking about the kinds of variables we have in SELECT.  These things
should be clearly kept apart, I'll try to explain a couple of places
this could happen.

At present it is not proposed that you can use blank nodes as
literals in the SELECT/WHERE parts of the query (after RDQL imposing
similar restriction) so blank nodes can only appears as bound
variable values.

It is possible that we may not allow these to be returned in the
variable bindings; this is yet to be decided.  But we do need to
discuss the variable name and it's value, which could be bound to a
blank node in the query graph.

graph
  _:a ex:foo "blah" .

query
  SELECT ?x
  WHERE (?x ex:foo ?y)
  USING
    ex FOR <http://example.org/#>

result set
  ?x
  _:a

or maybe something like
  ?x
  NULL

So we need to be able to talk about variables ?x, ?y and bnode name
_:a (could be considered a existentially quantified variable) in the
query graph, also in the result set.  Discusing variable ?x's value
as being a variable would be confusing.


Let's assume further that we carry on with providing the CONSTRUCT
functionality, which lets you create a graph of triples as the result
of a query, aka a simple rule or transform.  You arguably should be
able to make *any* legal RDF graph, so that includes blank nodes.

So when forming a CONSTRUCT set of triples from some variable
bindings we may have a mixture of constant URIs, Literals, blank
nodes and variable values which can be URIs, Literals and possibly
blank nodes.

graph
  _:a ex:foo "blah" .

query
  SELECT ?x
  WHERE (?x ex:foo ?y)
  CONSTRUCT (?x ex:bar :_b)
  USING
   ex FOR <http://example.org/#>

result graph
  _:a <http://example.org/#bar> _:b .

We need to be able to talk about ?x, _:a and _:b easily.  Even
to discard or restrict some of these ideas.

Another possibility is forbidding bnode from CONSTRUCT triples.


As a final thought, CONSTRUCT could be a new RDF syntax.
Here's a BRQL possibility that just makes a graph with one triple.

query
  CONSTRUCT
    ( _:a ex:foo "blah" )
  USING
    ex FOR <http://example.org/#>

result graph
  _:a <http://example.org/#foo> "blah" .


Dave

Received on Friday, 27 August 2004 10:19:36 UTC