Thanks Andy for the pointer!
I turned off that flag, and it got pushed to BGPs as expected.
Before that, I also tried rewrite the query, and I got same behavior like
turning off that flag.
The re-written query is:
SELECT ?s
WHERE
{
?o2 <http://foo/id> "some id" .
?s <http://foo/bar> ?o2 .
?s <http://foo/bar> ?o1 .
FILTER (?o1 != ?o2) .
}
Thanks,
Z
________________________________
From: Andy Seaborne <[email protected]>
Sent: Friday, June 3, 2016 6:03:02 PM
To: [email protected]
Subject: Re: optimize a query
On 03/06/16 18:28, Zen 98052 wrote:
> Hi,
>
> Is there a way to rewrite this Sparql query to run more efficiently?
>
>
> SELECT ?s
>
> WHERE
>
> {
>
> ?s <http://foo/bar> ?o1, ?o2 .
>
> ?o2 <http://foo/id> "some id" .
>
> FILTER (?o1 != ?o2) .
> }
>
>
> It seems to me this can be optimized, I am still trying to figure it out.
Yes - by the filter placement transform TransformFilterPlacement
There is no need to wait for ?o2 <http://foo/id> "some id" .
The filter can be executed after ?s <http://foo/bar> ?o1, ?o2 . as both
?o1 and ?o2 are bound.
BGPs are left alone if
context.isTrueOrUndef(ARQ.optFilterPlacementBGP) ;
See Optimize.rewrite
TDB turns it off by setting that context values on each dataset:
dsg.getContext().set(ARQ.optFilterPlacementBGP, false) ;
(then does it itself in "NodeId" space, not in "Node")
You can experiment using the command line tools:
arq.qparse --print=opt --query=YourQuery.rq
Andy
>
>
>
> Thanks,
>
> Z
>