Catman...kidata(3pm)

πŸ“¦
version 0.06 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– 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/or title
  • 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 selected site ⚠️. 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ß πŸ‘‘

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