SELECT ?code ?url WHERE { # lang-code api-endpoint instance-of language edition of wikinews [ wdt:P424 ?code; wdt:P6269 ?url ] wdt:P31 wd:Q20671729. } let's see if I can get that into RDF::Query, a perl module that should be able to do this. I'm copying basic snippets from https://metacpan.org/release/VOJ/App-wdq-0.4.4/source/script/wdq to learn the use. .. okay it turns out wikidata.org actually can _automatically generate perl code_. i can copy from its generated code. okay here's what I have: use LWP::Simple; use JSON; use Data::Dumper; # P424=language code; P6269=api url # P31=instance of Q20671729=wikinews language my $query = <<EOF; SELECT ?code ?url WHERE { [ wdt:P424 ?code; wdt:P6269 ?url ] wdt:P31 wd:Q20671729. } EOF $result_str = get "https://query.wikidata.org/sparql?format=json&query=${query}"; $result_list = decode_json($result_str)->{results}{bindings}; %code_urls = map { $_->{code}{value} => $_->{url}{value} } @$result_list; print Dumper \%code_urls; It outputs like this: $VAR1 = { 'uk' => 'https://uk.wikinews.org/w/api.php', 'pt' => 'https://pt.wikinews.org/w/api.php', 'tr' => 'https://tr.wikinews.org/w/api.php', 'es' => 'https://es.wikinews.org/w/api.php', 'ru' => 'https://ru.wikinews.org/w/api.php', 'no' => 'https://no.wikinews.org/w/api.php', 'fr' => 'https://fr.wikinews.org/w/api.php', 'ro' => 'https://ro.wikinews.org/w/api.php', yay ! i guess i need some error handling in there ... although the script to edit also had no error handling :S this seems really unfortunate as errors happen reliably in my world. maybe i'll leave it out for now.