Perl6 module to query the wikidata API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin Adds new binary Dec 2, 2017
lib/Wikidata Eliminates the non-working versions Nov 30, 2017
t Finishing tests Nov 30, 2017
.gitignore Finishing tests Nov 30, 2017
.travis.yml Gets path right Dec 3, 2017
LICENSE Initial commit Nov 30, 2017
META6.json Adds new binary Dec 2, 2017
README.md Adds conf file to readme Dec 2, 2017

README.md

Wikidata API in Perl 6

Build Status

Perl6 module to query the wikidata API. Install it the usual way

zef install Wikidata::API

Use it:

  use Wikidata::API;

  my $query = q:to/END/;
SELECT ?person ?personLabel WHERE {
  
    ?person wdt:P69 wd:Q1232180 . 
    ?person wdt:P21 wd:Q6581072 . 
  
    SERVICE wikibase:label { 
      bd:serviceParam wikibase:language "en" .
    }
} ORDER BY ?personLabel
END

  my $UGR-women = query( $query );

  my $to-file= q:to/END/;
SELECT ?person ?personLabel ?occupation ?occupationLabel WHERE {
  ?person wdt:P69 wd:Q1232180. 
  ?person wdt:P21 wd:Q6581072.
  ?person wdt:P106 ?occupation
  SERVICE wikibase:label {				
    bd:serviceParam wikibase:language "es" .
  }
}
END

  spurt "ugr-women-by-job.sparql", $to-file;
  say query-file( $to-file );

There are a few SPARQL queries you can try in this other repo

Download one query from that repo to test the command-line utility that will be installed too

wdq.p6 one-query-or-other.sparql

See also

This module is tested using the test-perl6 Docker container. Check out the Travis configuration file for usage.