Skip to content

Instantly share code, notes, and snippets.

@athalhammer
Last active April 19, 2024 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save athalhammer/9cdfae45e4a776592d33b146bc51045b to your computer and use it in GitHub Desktop.
Save athalhammer/9cdfae45e4a776592d33b146bc51045b to your computer and use it in GitHub Desktop.
uberank
git clone https://github.com/athalhammer/wikidata-rank-hdt.git
cd wikidata-rank-hdt
wget https://danker.s3.amazonaws.com/uberank.hdt.bz2
bunzip2 uberank.hdt.bz2
mv uberank.hdt rank.hdt
docker-compose up
# call http://localhost:80
##### EXAMPLE QUERY #####
# Rankings of castles in Switzerland
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX vrank: <http://purl.org/voc/vrank#>
SELECT * WHERE {
SERVICE <https://query.wikidata.org/sparql> {
SELECT DISTINCT ?castle ?castleLabel WHERE {
?castle wdt:P17/wdt:P279* wd:Q39.
?castle wdt:P31/wdt:P279* wd:Q23413.
SERVICE wikibase:label {
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en".
}
}
}
?castle vrank:pagerank ?pagerank .
?castle vrank:qrank ?qrank .
?castle vrank:sitelinkcount ?sitelinkcount .
}
ORDER BY DESC(?pagerank)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment