Details

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

      Description

      The query below (from Wikidata) counts the number of items in a class and its subclasses.

      If the identifier for the top-level class is put directly in the path assertion, the query executes in about 3.2 seconds. However if, as below, the identifier is bound to a variable for readability, using BIND, then the query times out.

      PREFIX wd: <http://www.wikidata.org/entity/>
      PREFIX wdt: <http://www.wikidata.org/prop/direct/>
      PREFIX wikibase: <http://wikiba.se/ontology#>
      PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      
      #  Query to count the number of items in a class and its subclasses
      
          SELECT (COUNT(DISTINCT ?a) AS ?count) WHERE {
             BIND (wd:Q3305213 AS ?class) .    # paintings
             ?a wdt:P31/wdt:P279* ?class .
          } 
      

      Here is a link to the explain report

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stasmalyshev stasmalyshev
              Reporter:
              Jheald James Heald
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: