Hello,

Thanks for your answer

>         (conditional
>           (bgp
>             (triple ?loc :locatedInWork ex:Work1)
>             (triple ?loc :startVolume ?startvol)
>           )
>           (bgp (triple ?loc :endVolume ?endvol)))))))

Am I right in understanding that in that case ?loc is bound in the
second part (the part with :endVolume)? If so then the slow
performance must come from somewhere else, I'll investigate further.

I found another way of writing the query which is much more complex
but a little bit more satisfying in the sense that it makes the
binding of ?loc very clear:

  ?loc :workLocationVolume ?bvol .?loc :locatedInWork ex:Work1 ;
       :startVolume ?startvol .
  FILTER ((?bvol = ?volnum && NOT EXISTS {?loc :workLocationEndVolume
?evol}) || (?bvol <= ?volnum  && EXISTS {?loc :workLocationEndVolume
?evol FILTER (?evol <= ?volnum)}))

In terms of logic is should be equivalent to the previous query,
should there be a performance difference? My experiments show that
this version is quite consistently twice as fast as the OPTIONAL
version.

Best,
-- 
Elie

Reply via email to