Mbaroudi / puelia-php

Automatically exported from code.google.com/p/puelia-php
0 stars 0 forks source link

OPTIONAL queries are selecting too much, causing timeout #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using the attached configuration, the URI:

  http://localhost/transport/doc/nptg-district/059

ends up with a timeout error. Looking at the query, the problem is with the 
SPARQL that gets 
generated, which looks like:

construct 
 {   
    ...
     <http://transport.data.gov.uk/id/nptg-district/059> 
<http://transport.data.gov.uk/def/naptan/nptgLocality> ?v_6 . 

     ?v_6 <http://www.w3.org/2004/02/skos/core#prefLabel> ?v_7 . 

 } 
 where 
 { 
   ... 
     OPTIONAL{ <http://transport.data.gov.uk/id/nptg-district/059> 
<http://transport.data.gov.uk/def/naptan/nptgLocality> ?v_6 . } 

     OPTIONAL{ ?v_6 <http://www.w3.org/2004/02/skos/core#prefLabel> ?v_7 . } 

 }

The district itself doesn't have a nptgLocality property, but there are lots of 
things that have a 
prefLabel, and that get selected due to the second OPTIONAL statement above. 
This causes the 
timeout.

To make sure it doesn't happen, the second OPTIONAL should be nested within the 
first:

  OPTIONAL{
    <http://transport.data.gov.uk/id/nptg-district/059> 
<http://transport.data.gov.uk/def/naptan/nptgLocality> ?v_6 . 
    OPTIONAL{ ?v_6 <http://www.w3.org/2004/02/skos/core#prefLabel> ?v_7 . }
  }

The same is true for any property chain. 

Original issue reported on code.google.com by jeni.ten...@gmail.com on 31 May 2010 at 8:19

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by jeni.ten...@gmail.com on 4 Jun 2010 at 12:04

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r84.

Original comment by K.J.W.Al...@gmail.com on 7 Jun 2010 at 3:41