Catman...kidata(3pm)
π Catmandu::Importer::Wikidata π
okay bestie, so this is the Catmandu::Importer::Wikidata page from the User Contributed Perl Documentation β it's a manpage from the 3pm manual section and it is genuinely so iconic. Anyway. Let's get into it π
β¨ NAME β¨
Catmandu::Importer::Wikidata β literally just "Import from Wikidata", that's the whole vibe π¦
β¨ VERSION β¨
version 0.06 β baby numbers, but she slays π
β¨ SYNOPSIS β¨
bestie just look at her:
catmandu convert Wikidata --ids Q1,P227
catmandu convert Wikidata --site dewiki --title Wahnsinn
echo Q1 | catmandu convert Wikidata
echo Wahnsinn | catmandu convert Wikidata --site dewiki
echo dewiki:Wahnsinn | catmandu convert Wikidata
echo Q1 | catmandu convert Wikidata --fix 'retain_field("labels")'
like?? the piping?? the --fix?? main character energy honestly π
β¨ DESCRIPTION β¨
So what she does: this Catmandu::Importer goes and queries Wikidata for entities, and you can ask for them either by their Wikidata identifier (the "Q..." kind, the "P..." kind) or by a title in some known Wikidata site, like the English Wikipedia ("enwiki").
Where do the entities come from? Two ways, and you can mix:
- as options β
ids,site, and/ortitle - or as line-separated input values fed in from the input stream β¨
By default you get the raw JSON structure of each Wikidata entity, one after another. No cap. π«Ά
And if an entity isn't found? She doesn't ghost you, she hands it back with the missing property set to 1, exactly like this:
{ "id": "Q7", "missing": "1" }
To further process that JSON structure, Catmandu::Wikidata contains several Catmandu fixes, e.g. ones that only retain a selected language. Obsessed. π
β¨ CONFIGURATION β¨
This importer extends Catmandu::Importer::getJSON, so it can be configured with the options agent, timeout, headers, proxy, and dry. π
Additional options include:
apiβ the Wikidata API base URL. Default is"http://www.wikidata.org/w/api.php". That's the house she lives in πidsβ a list of Wikidata entity/property ids, such as"Q42"and"P19". Use comma, vertical bar, or space as separator. If you specify neither ids nor titles, she reads them from the input stream instead. πΈsiteβ the wiki site key, for when you wanna refer to Wikidata entities by title. Default is"enwiki"for English Wikipedia. A list of supported site keys can be queried as part of <https://www.wikidata.org/w/api.php?action=paraminfo&modules=wbgetentities> (unless <https://bugzilla.wikimedia.org/show_bug.cgi?id=58200> is fixed). iykyk πtitleβ the title of a page, for referring to Wikidata entities. Heads up bestie: a title is only unique within a selectedsiteβ οΈ. You can also prepend the site key to a title separated by a colon, e.g."enwiki:anarchy"for the entity that is titled"anarchy"in the English Wikipedia. And again β if you specify no titles and no ids, she reads them from the input stream. π
β¨ AUTHOR β¨
Jakob VoΓ π
β¨ COPYRIGHT AND LICENSE β¨
This software is copyright (c) 2014 by Jakob VoΓ.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. so generous, so iconic π«Ά
okay that's the whole page, bestie!! thanks for coming to my ted talk π this was perl v5.40.1, dated 2025-08-15, and it's giving "go import some Wikidata entities" πβ¨ bye ily π
π¦ where this page comes from
- ubuntu resolute: libcatmandu-wikidata-perl 0.06-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-wikidata-perl 0.06-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms