Hi Regis,
Thanks for the report.  I've entered this as an issue in JIRA [1].
-Stephen
[1] https://issues.apache.org/jira/browse/JENA-180


2011/12/18 Regis Pires Magalhães <[email protected]>:
> Hi, Stephen.
> There is no problem with using one of the alternate queries.
> I was just trying to figure out why that was happening and maybe suggest a
> query optimization improvement to Jena.
> So, thank you for the explanation.
>
> Regards,
> Regis.
>
>
> On Sat, Dec 17, 2011 at 2:50 AM, Stephen Allen <[email protected]> wrote:
>
>> Hi Regis,
>>
>> The issue with the first query is that the optimizer is not able to see
>> that transforming it into bindings as you've done in your alternate queries
>> would be more efficient [1].  Instead it is performing a cross product on
>> the two BGPs and then filtering the results.
>>
>> The fix would be to improve the optimizer to look for this case (it's a
>> rather special case of || where the operands contain equality filters on
>> the same variables).
>>
>> But in the mean time, is there an problem with using one of the alternate
>> queries?
>>
>> -Stephen
>>
>> [1] In the alternate query with the UNIONs the optimizer is able to
>> identify equality filters and turn them into BINDINGS, which is why it is
>> fast.
>>
>>
>> 2011/12/16 Regis Pires Magalhães <[email protected]>
>>
>> > I have imported DBLP RDF dump (http://dblp.l3s.de/dblp.rdf.gz) to Jena
>> TDB
>> > which can be accessed through Fuseki.
>> > The SPARQL Endpoint is: http://dblp.mooo.com/dblp/sparql
>> >
>> > I am executing some queries only to test alternatives to SPARQL 1.1.
>> > BINDINGS.
>> > The execution of the following query is slow compared with some
>> equivalent
>> > queries that yields the same results:
>> >
>> > *Original Query: FILTER + ||*
>> >
>> > prefix dc:   <http://purl.org/dc/elements/1.1/>
>> >
>> > SELECT  * WHERE {
>> >  ?publication dc:creator ?dblp_researcher .
>> >  ?publication dc:title ?pub_title
>> >  FILTER (
>> >    ( ?dblp_researcher = <
>> > http://dblp.l3s.de/d2r/resource/authors/Marco_A._Casanova> &&
>> ?publication
>> > = <
>> http://dblp.l3s.de/d2r/resource/publications/journals/jcss/CasanovaFP84
>> > >
>> > ) ||
>> >    ( ?dblp_researcher = <
>> > http://dblp.l3s.de/d2r/resource/authors/V%C3%A2nia_Maria_Ponte_Vidal> &&
>> > ?publication = <
>> > http://dblp.l3s.de/d2r/resource/publications/conf/pods/CasanovaV83> ) ||
>> >    ( ?dblp_researcher = <
>> >
>> >
>> http://dblp.l3s.de/d2r/resource/authors/Jos%C3%A9_Ant%C3%B4nio_Fernandes_de_Mac%C3%AAdo
>> > >
>> > && ?publication = <
>> > http://dblp.l3s.de/d2r/resource/publications/journals/ijbdcn/VidalMPCP11
>> >
>> > )
>> >  )
>> > }
>> >
>> > 10 Executions Min Time: *24635 *ms Average Time: *25683.7 *ms Max Time:
>> > *26574
>> > *ms
>> >
>> > *
>> > *
>> > *The same query over D2R SPARQL Endpoint (**
>> > http://dblp.l3s.de/d2r/sparql
>> > **
>> > ) is much faster as seen below:
>> > *
>> > 100 Executions
>> > Min Time: *438* ms
>> > Average Time: *513.14* ms
>> > Max Time: *3464* ms
>> >
>> > *Alternative queries:*
>> >
>> > *1. FILTER + UNION*
>> >
>> > prefix dc:   <http://purl.org/dc/elements/1.1/>
>> >
>> > SELECT  * WHERE {
>> >  { ?publication dc:creator ?dblp_researcher .
>> >    ?publication dc:title ?pub_title
>> >    FILTER ( ?dblp_researcher = <
>> > http://dblp.l3s.de/d2r/resource/authors/Marco_A._Casanova> &&
>> ?publication
>> > = <
>> http://dblp.l3s.de/d2r/resource/publications/journals/jcss/CasanovaFP84
>> > >
>> > )
>> >  }
>> >  UNION
>> >  { ?publication dc:creator ?dblp_researcher .
>> >    ?publication dc:title ?pub_title
>> >    FILTER ( ?dblp_researcher = <
>> > http://dblp.l3s.de/d2r/resource/authors/V%C3%A2nia_Maria_Ponte_Vidal> &&
>> > ?publication = <
>> > http://dblp.l3s.de/d2r/resource/publications/conf/pods/CasanovaV83> )
>> >  }
>> >  UNION
>> >  { ?publication dc:creator ?dblp_researcher .
>> >    ?publication dc:title ?pub_title
>> >    FILTER ( ?dblp_researcher = <
>> >
>> >
>> http://dblp.l3s.de/d2r/resource/authors/Jos%C3%A9_Ant%C3%B4nio_Fernandes_de_Mac%C3%AAdo
>> > >
>> > && ?publication = <
>> > http://dblp.l3s.de/d2r/resource/publications/journals/ijbdcn/VidalMPCP11
>> >
>> > )
>> >  }
>> > }
>> >
>> > 100 Executions
>> > Min Time: 39ms
>> > Average Time: 79.17ms
>> > Max Time: 276ms
>> >
>> >
>> > *2. BINDINGS*
>> > *
>> > *
>> > prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>> > prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
>> > prefix owl:  <http://www.w3.org/2002/07/owl#>
>> > prefix foaf: <http://xmlns.com/foaf/0.1/>
>> > prefix dc:   <http://purl.org/dc/elements/1.1/>
>> >
>> > SELECT  * WHERE {
>> >  ?publication dc:creator ?dblp_researcher .
>> >  ?publication dc:title ?pub_title
>> > }
>> > BINDINGS ?dblp_researcher ?publication {
>> >    ( <http://dblp.l3s.de/d2r/resource/authors/Marco_A._Casanova>  <
>> > http://dblp.l3s.de/d2r/resource/publications/journals/jcss/CasanovaFP84>
>> )
>> >    ( <
>> http://dblp.l3s.de/d2r/resource/authors/V%C3%A2nia_Maria_Ponte_Vidal
>> > >
>> > <http://dblp.l3s.de/d2r/resource/publications/conf/pods/CasanovaV83> )
>> >    ( <
>> >
>> >
>> http://dblp.l3s.de/d2r/resource/authors/Jos%C3%A9_Ant%C3%B4nio_Fernandes_de_Mac%C3%AAdo
>> > >
>> > <
>> http://dblp.l3s.de/d2r/resource/publications/journals/ijbdcn/VidalMPCP11>
>> > )
>> > }
>> >
>> > 100 Executions
>> > Min Time: 33ms Average Time: 46.88ms Max Time: 90ms
>> >
>> >
>> > What can be done to improve the speed of the first query when I use
>> Fuseki
>> > (
>> > *Fuseki-0.2.1*-incubating-SNAPSHOT)?
>> >
>> > Best Regards,
>> > Regis.
>> >
>>

Reply via email to