Uploaded image for project: 'Blazegraph (by SYSTAP)'
  1. Blazegraph (by SYSTAP)
  2. BLZG-1483

Nested SELECT query does not perform

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Affects Version/s: BLAZEGRAPH_2_1_4
    • Fix Version/s: None
    • Component/s: Wikidata Query Service
    • Labels:
      None

      Description

      If I run this query on query.wikidata.org:

      prefix psv: <http://www.wikidata.org/prop/statement/value/>
      PREFIX wd: <http://www.wikidata.org/entity/>
      PREFIX wdt: <http://www.wikidata.org/prop/direct/>
      PREFIX wikibase: <http://wikiba.se/ontology#>
      PREFIX p: <http://www.wikidata.org/prop/>
      PREFIX v: <http://www.wikidata.org/prop/statement/>
      PREFIX q: <http://www.wikidata.org/prop/qualifier/>
      PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>  
      SELECT ?birth_date ?death_date (COUNT(*) AS ?count) WHERE {
             ?a wdt:P31 wd:Q5 .
             ?a wdt:P27 wd:Q41 . 
      
             ?a p:P569 ?birth_date_statement .
             ?birth_date_statement psv:P569 ?birth_date_node .
             ?birth_date_node wikibase:timeValue ?birth_date .
             ?birth_date_node wikibase:timePrecision "11"^^xsd:integer .
      
             ?a p:P570 ?death_date_statement .
             ?death_date_statement psv:P570 ?death_date_node .
             ?death_date_node wikibase:timeValue ?death_date.
             ?death_date_node wikibase:timePrecision "11"^^xsd:integer .
      
          } 
          GROUP BY ?birth_date ?death_date
          HAVING (?count > 1)
      

      I get results in 350 ms and they are:

      1913-03-13T00:00:00Z	1985-06-28T00:00:00Z	2
      

      Then if I run this query:

      PREFIX wdt: <http://www.wikidata.org/prop/direct/>
      SELECT * WHERE {
       ?q wdt:P569 "1913-03-13T00:00:00Z"^^xsd:dateTime
      }
      LIMIT 40
      

      It finished in 148 ms and produces 40 results, as expected. However, if I try to combine them:

      PREFIX wd: <http://www.wikidata.org/entity/>
      PREFIX wdt: <http://www.wikidata.org/prop/direct/>
      PREFIX wikibase: <http://wikiba.se/ontology#>
      PREFIX p: <http://www.wikidata.org/prop/>
      PREFIX v: <http://www.wikidata.org/prop/statement/>
      PREFIX q: <http://www.wikidata.org/prop/qualifier/>
      PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      PREFIX ps: <http://www.wikidata.org/prop/statement/>
      PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
      
      SELECT ?q ?birth_date ?death_date ?count WHERE {
        {
          SELECT ?birth_date ?death_date (COUNT(*) AS ?count) WHERE {
             ?a wdt:P31 wd:Q5 .
             ?a wdt:P27 wd:Q41 . 
      
             ?a p:P569 ?birth_date_statement .
             ?birth_date_statement psv:P569 ?birth_date_node .
             ?birth_date_node wikibase:timeValue ?birth_date .
             ?birth_date_node wikibase:timePrecision "11"^^xsd:integer .
      
             ?a p:P570 ?death_date_statement .
             ?death_date_statement psv:P570 ?death_date_node .
             ?death_date_node wikibase:timeValue ?death_date.
             ?death_date_node wikibase:timePrecision "11"^^xsd:integer .
      
          } 
          GROUP BY ?birth_date ?death_date
          HAVING (?count > 1)
        }
        ?q wdt:P569 ?birth_date .
      }
      LIMIT 40
      

      The query times out.

        Attachments

          Activity

            People

            Assignee:
            michaelschmidt michaelschmidt
            Reporter:
            stasmalyshev stasmalyshev
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated: