Named subquery slow in Wikidata Query Service

151 Views Asked by At

I am wondering why the following SPARQL query with a named subquery is slow on Blazegraph instance Wikidata Query Service. Taking out the subquery and executing that alone completes in around a second on the Wikidata Query Service, while the one with the entire query times out. Adding anything after the INCLUDE line does not seem to help. Removing DISTINCT does not help.

SELECT
  ?author
WITH {
  SELECT
    DISTINCT ?author
  {
    [] wdt:P50 ?author .
    FILTER EXISTS { [] wdt:P921 ?author }
    FILTER EXISTS { ?author wdt:P31 wd:Q5 }
  }
  LIMIT 1
} AS %authors
WHERE {
  INCLUDE %authors .
}

Might some combination of query hints help? I have been glancing through the Blazegraph query hints at https://github.com/blazegraph/database/wiki/QueryHints, but have not come up with the hint combination that solves the time out.

When the named subquery is executed alone LIMIT can even be increased to 10000 on the Wikidata Query Service without running into a timeout.

0

There are 0 best solutions below