Details

      Description

      When using query like this:

      #  Query to find the most common values for the property ?prop
       #  on items either in the class ?class or a first-level subclass of it
       #  when ?class = Q3305213 and ?prop = P136
       #  Query generated by [[Template:TopListDepth2]]
       
      SELECT ?value ?valueLabel ?count WHERE {
        {
          SELECT ?value (COUNT(DISTINCT ?a) AS ?count) WHERE {
             ?a ?prop ?value . 
             ?a wdt:P31/wdt:P279? ?class .
             BIND (wdt:P136 AS ?prop) .
             BIND (wd:Q3305213 AS ?class) .
          } GROUP BY ?value
        } . 
        SERVICE wikibase:label {
          bd:serviceParam wikibase:language "en" . 
        }
      }
      # HAVING (?count > 1)        ### use this to show only repeated values
      ORDER BY DESC(?count) ?valueLabel
      LIMIT 200
      

      it takes about 12-13 seconds to run. However, if we manually substitute constants, like this:

      #  Query to find the most common values for the property ?prop
       #  on items either in the class ?class or a first-level subclass of it
       #  when ?class = Q3305213 and ?prop = P136
       #  Query generated by [[Template:TopListDepth2]]
       
      SELECT ?value ?valueLabel ?count WHERE {
        {
          SELECT ?value (COUNT(DISTINCT ?a) AS ?count) WHERE {
             ?a wdt:P136 ?value . 
             ?a wdt:P31/wdt:P279? wd:Q3305213 .
          } GROUP BY ?value
        } . 
        SERVICE wikibase:label {
          bd:serviceParam wikibase:language "en" . 
        }
      }
      # HAVING (?count > 1)        ### use this to show only repeated values
      ORDER BY DESC(?count) ?valueLabel
      LIMIT 200
      

      It runs in between 1 and 2 seconds. Looks like the query engine fails to propagate the constant values, may be part of BLZG-1141.

        Issue Links

          Activity

          Hide
          michaelschmidt michaelschmidt added a comment -

          Proposed fix in https://github.com/SYSTAP/bigdata/pull/466, running through CI now.

          Show
          michaelschmidt michaelschmidt added a comment - Proposed fix in https://github.com/SYSTAP/bigdata/pull/466 , running through CI now.
          Hide
          michaelschmidt michaelschmidt added a comment -

          Some test cases were failing due to the fact that the ALP node did not support the case of constant-variable hybrids. Implemented support for that case, re-running CI now.

          Show
          michaelschmidt michaelschmidt added a comment - Some test cases were failing due to the fact that the ALP node did not support the case of constant-variable hybrids. Implemented support for that case, re-running CI now.
          Hide
          michaelschmidt michaelschmidt added a comment - - edited

          This should go into 2.1.3 as well Brad Bebee (once CI is green).

          Show
          michaelschmidt michaelschmidt added a comment - - edited This should go into 2.1.3 as well Brad Bebee (once CI is green).
          Hide
          michaelschmidt michaelschmidt added a comment -

          CI is green, this is ready for code review. bryanthompson

          Show
          michaelschmidt michaelschmidt added a comment - CI is green, this is ready for code review. bryanthompson

            People

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

              Dates

              • Created:
                Updated:
                Resolved: