User:TweetsFactsAndQueries/Queries/most common domains for “full work available at” URLs

Originally posted on Twitter and on Mastodon.

# most common domains for “full work available at” URLs
SELECT ?domain (COUNT(?work) AS ?count) WHERE {
  ?work wdt:P953 ?url.
  BIND(REPLACE(STR(?url), "^.*?://([^/]*).*", "$1") AS ?domain)
}
GROUP BY ?domain
ORDER BY DESC(?count)
Try it!

This is already very close to a timeout, but I can’t think of a way to optimize it further, short of changing the entire data model.