nichtich / wikidata-taxonomy

command-line tool to extract taxonomies from Wikidata
https://www.npmjs.org/package/wikidata-taxonomy
MIT License
124 stars 11 forks source link

Add option to include the URL #28

Closed pmackay closed 6 years ago

pmackay commented 6 years ago

This is a commandline tool but with iTerm its possible to Cmd-click on a URL and it open in a browser. This would be very handy when scanning a taxonomy list and needing to open a few items in the list quickly.

Is there any current means to achieve something like this?

nichtich commented 6 years ago

Do you want to open the Wikidata entity URL? Have a look at wikidata-cli, does this work for you?

pmackay commented 6 years ago

That is certainly helpful but it requires either typing or copying the item ID into a separate command. What I'm suggesting is that a new option would print the URL, which might either be like this (replace the ID):

planet (https://www.wikidata.org/wiki/Q634) •202 ×5 ↑

or add an extra line, similar to description:

planet (Q634) •202 ×5 ↑
│ celestial body orbiting a star or stellar remnant
│ https://www.wikidata.org/wiki/Q634

Another alternative would be to have a filtered properties feature like this in wikidata-cli. But that is a bigger change.

nichtich commented 6 years ago

Good idea but this feature only applies to tree output format. I think showing both the full URL and the short ID does rarely make sense, so how output like

planet (http://www.wikidata.org/entity/Q634) •202 ×5 ↑

under a different format name, e.g.

wdtaxonomy Q634 -f itree

I am open for good a format name (itree, utree, ...?)

pmackay commented 6 years ago

It could potentially apply in a similar way to the csv format - could the id col be replaced with a url col? Or add the url col?

nichtich commented 6 years ago

Ok, a general option --uris to prefer showing full URIs instead of short ids in all ouput formats (tree and csv) makes sense. One letter equivalent could be -I -U.

nichtich commented 6 years ago

try version 0.5.4

pmackay commented 6 years ago

Great! Thanks for the rapid response :)

I've noticed that it works fine for the tree view but for CSV it breaks because the URL is considered to include some of the other text on the line. Didnt consider that. But anyway its a handy addition IMHO.