Lucas_Werkmeister_WMDE created this task.
Lucas_Werkmeister_WMDE added projects: Wikidata, Wikidata-Query-Service.
Herald added a subscriber: Aklapper.
Herald added a project: Discovery.

TASK DESCRIPTION

Reduced query (not meaningful):

SELECT ?x WITH {
  SELECT ?x (COUNT(*) AS ?count) WHERE {
    ?x a schema:Dataset.
  }
  GROUP BY ?x
  HAVING(?count > 0)
} AS %x WHERE {
  INCLUDE %x.
}

(link)

java.lang.IllegalArgumentException: Non-aggregate variable in select _expression_: x

If you remove the HAVING clause, the query is accepted.

Phrased as a non-named subquery, this works without problems:

SELECT ?x WHERE {
  {
    SELECT ?x (COUNT(*) AS ?count) WHERE {
      ?x a schema:Dataset.
    }
    GROUP BY ?x
    HAVING(?count > 0)
  }
}

(link)

It seems the subquery has to specify a triple to trigger the bug; I was unable to reproduce it with a VALUES clause instead. (The triple can also be ?x ?y ?z to make the query completely independent of the database, but then you’ll want a LIMIT on the subquery.)

Here’s the original query where I found the bug:

# works with most citations
# runtime: 25-45 s
SELECT ?work ?workLabel ?count WITH {
  SELECT ?work (COUNT(*) AS ?count) WHERE {
    ?work wdt:P2860 [].
  }
  GROUP BY ?work
  HAVING(?count > 100)
  ORDER BY DESC(?count)
  LIMIT 100
} AS %works WHERE {
  INCLUDE %works.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
ORDER BY DESC(?count)

(link)

This is probably an upstream issue, but BlazeGraph’s Jira seems to be down right now and I don’t have an account there anyways.


TASK DETAIL
https://phabricator.wikimedia.org/T165559

EMAIL PREFERENCES
https://phabricator.wikimedia.org/settings/panel/emailpreferences/

To: Lucas_Werkmeister_WMDE
Cc: Aklapper, Smalyshev, Lucas_Werkmeister_WMDE, GoranSMilovanovic, QZanden, EBjune, merbst, Avner, debt, Gehel, Jonas, FloNight, Xmlizer, Izno, jkroll, Wikidata-bugs, Jdouglas, aude, Deskana, Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to