W3C home > Mailing lists > Public > public-rdf-dawg@w3.org > October to December 2010

Re: BIND, FILTERs and BGPs

From: Axel Polleres <axel.polleres@deri.org>
Date: Thu, 14 Oct 2010 07:09:26 -0300
Cc: SPARQL Working Group <public-rdf-dawg@w3.org>
Message-Id: <CA91F5AF-AB6B-41AE-983E-2AF6633CDD09@deri.org>
To: Lee Feigenbaum <lee@thefigtrees.net>, Andy Seaborne <andy.seaborne@epimorphics.com>
Just to get that right:

> > 1/ BIND terminates the current BGP
> > 2/ FILTER goes after BIND in the BGP

Sorry, I am a bit confused about what the "FILTER goes after BIND in the BGP" part 
means... Do I understand part 2/ of this proposal correctly as follows?

For Query1:

  ASK { FILTER(?two = 2) . BIND(2 AS ?two) . }
   =:=
  ASK { BIND(2 AS ?two) . FILTER(?two = 2) }

this means 

Answer: yes?

But for Query2:

ASK { FILTER(?two = 2) . BIND("foo" AS ?bar) . BIND(2 AS ?two) . }

would this mean

Answer: no?

(since the first bind terminates the BGP, ?two wouldn't yet be bound?!?)

Would - alternatively "2/ BIND goes after FILTER in the BGP" also be an option?
(might be seen more intuitive from the viewpoint that Query1 and Query2 would behave 
the same?)

Thanks for clarification,
Axel





On 12 Oct 2010, at 16:43, Lee Feigenbaum wrote:

> On 10/12/2010 3:36 PM, Andy Seaborne wrote:
> >>  { P1 KW(Expr AS ?Var)  P2}
> >> =:=
> >> { { SELECT * Expr AS ?Var { P1} } P2 }
> >
> > Does BIND end a BGP?
> > What happens to FILTERs?
> >
> >
> > { FILTER(expr) ?x ns:p ?v . ?x ns:q ?w }
> >
> > is the algebra:
> >
> > (filter expr
> > (bgp (triple ?x ns:p ?v)
> > (triple ?x ns:q ?w)
> > ))
> >
> > or written after FILTER motion:
> >
> > { ?x ns:p ?v . ?x ns:q ?w FILTER(expr) }
> >
> >
> > But if we insert BIND(2*?v AS ?two) into that:
> >
> > { FILTER(expr) ?x ns:p ?v . BIND(2*?v AS ?two) . ?x ns:q ?w }
> >
> > There is a similar issue with bNode syntax label scopes.
> >
> > I propose that:
> >
> > 1/ BIND terminates the current BGP
> > 2/ FILTER goes after BIND in the BGP
> 
> I understand the question & agree with this proposal.
> 
> Lee
> 
> >
> > so its:
> >
> > (join
> > (filter expr
> > (extend (2*?v AS ?two)
> > (bgp (triple ?x ns:p ?v))
> > ))
> > (bgp (triple ?x ns:q ?w))
> > )
> >
> > or
> >
> > { { ?x ns:p ?v . BIND(2*?v AS ?two) . FILTER(expr)} ?x ns:q ?w }
> >
> > Logically it's
> > BGP - BIND - FILTER
> >
> > Doing this keep entailment a matter of BGPs only. Without motion of
> > BIND, it would need more work to come up with a design (if it exists)
> > that keeps entailment on a conjuction of triple patterns and have the
> > variable scoping + new variable rule.
> >
> > Lee's example:
> >
> > { ?x ns:p ?v . BIND(2*?v AS ?two) ?x ns:q ?two }
> >
> > will work and naturally falls out if BIND happens where it's mentioned.
> >
> > (join
> > (extend (2*?v AS ?two)
> > (bgp (triple ?x ns:p ?v)))
> > (bgp (triple ?x ns:q ?two))
> > )
> >
> > Andy
> >
> >
> 
> 
Received on Thursday, 14 October 2010 10:10:12 GMT

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