Smalyshev closed this task as "Resolved".
Smalyshev added a comment.

This works now:

SELECT DISTINCT ?city WHERE {
  ?city wdt:P31/wdt:P279* wd:Q515 . # find instances of subclasses of city
  ?city wdt:P131* wd:Q1202 .
  hint:Prior hint:gearing "forward" .
}

See also https://wiki.blazegraph.com/wiki/index.php/QueryHints
Basically what is going on is that query optimizer doesn't always knows which way it should traverse the path queries, especially if there are many clauses. Playing with gearing hint allows to tell it the right way.

If the query doesn't work with any direction, please add it here and I'll take a look, but for now I think this resolves the task. The optimizer may be improved, but I imagine there will always be cases where we need to give some hints.


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

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

To: Smalyshev
Cc: abian, Nikki, Jheald, Aklapper, daniel, QZanden, EBjune, merbst, Avner, debt, Gehel, D3r1ck01, Jonas, FloNight, Xmlizer, Izno, jkroll, Smalyshev, Wikidata-bugs, Jdouglas, aude, Deskana, Manybubbles, Mbch331
_______________________________________________
Wikidata-bugs mailing list
Wikidata-bugs@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-bugs

Reply via email to