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

RE: Unbound vars as blank nodes

From: Geoff Chappell <geoff@sover.net>
Date: Thu, 24 Mar 2005 12:07:50 -0500
To: <andy.seaborne@hp.com>
Cc: <public-rdf-dawg-comments@w3.org>
Message-ID: <007b01c53094$03378370$6401a8c0@gsclaptop>



> -----Original Message-----
> From: Geoff Chappell [mailto:geoff@sover.net]
> Sent: Thursday, March 24, 2005 9:25 AM
> To: 'andy.seaborne@hp.com'
> Cc: 'public-rdf-dawg-comments@w3.org'
> Subject: RE: Unbound vars as blank nodes
> One additional modification is necessary so that meaningless solutions
> aren't returned -- possible values should only be introduced for variables
> that are constrained elsewhere in the query.
> 

A more appealing way of looking at it - rather than introducing all
possibilities and filtering by constraints, instead just introduce any
constraints that mention the naf variables into the naf term of the optional
factor - e.g:

Instead of:

	{ ?x foaf:mbox ?mbox} or 
	{
		{{?x ?a1 ?b1} or {?a1 ?x ?b1} or {?a1 ?b1 ?x}}
		{{?mbox ?a2 ?b2} or {?a2 ?mbox ?b2} or {?a2 ?b2 ?mbox}}
		not { ?x foaf:mbox ?mbox}
	}

This will have the same results:

	{ ?x foaf:mbox ?mbox} or 
	(
		{?x foaf:name  ?name_}
		and {?y_ foaf:mbox ?mbox}
		and not { ?x foaf:mbox ?mbox}
	)


For query:

Query::
 PREFIX foaf: <http://xmlns.com/foaf/0.1/>
 SELECT ?name ?mbox
 WHERE
    { ?x foaf:name  ?name .
      OPTIONAL { ?x foaf:mbox ?mbox } .
      ?y foaf:mbox ?mbox .
    }

Note that this drives the behavior you're defining anyway - an optimizing
query processor would likely decide to evaluate the constraint last, but
it's doing so because it decides that's the cheapest path not because it has
to do it that way to achieve the right answer (i.e. you end up with a
declarative semantics that drives the procedural approach you've suggested
as the one that yields correct results).

Just to be clear, I'm not suggesting that you specify that to evaluate an
optional a processor must gather together all of the constraints that
mention any variables in the optional and execute them first (that amounts
to specifying and evaluation order). Instead, say that the rhs of the
optional factor needs to evaluate to a fixed set, regardless of where in the
order it is evaluated, and that that fixed set all of the possible
combinations of variable bindings filtered by any relevant constraints on
their values. Also, you'll have to be wary of introducing anything that
makes the domain infinite (e.g. assignment of function results to
variables).


- Geoff
Received on Thursday, 24 March 2005 17:08:07 GMT

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