nichtich / wikidata-taxonomy

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

refactor as node module to be used in other projects #6

Closed nichtich closed 6 years ago

nichtich commented 8 years ago

The command line script should be a wrapper to a module

nichtich commented 8 years ago

Partly implemented in 0.2.6 but needs a stable JSON format before documentation or thoughts about how to use promises. There should be a simple function to be exported:

var wdtaxonomy = require('wikidata-taxonomy').taxonomy
var serialize = require('wikidata-taxonomy').serialize

var taxonomy = wdtaxonomy('Q123', options)
process.stdout.write(serialize(taxonomy, format))

This should better be documented.

kevincfz commented 6 years ago

Can you give some examples to use queryTaxonomy as a module? In README you said

const { queryTaxonomy } = require('wikidata-taxonomy');

Is the following correct to use it?

queryTaxonomy('Q123', options)

If so, a few questions

  1. what format is options?
  2. does the above line return a promise?
nichtich commented 6 years ago

Thanks for asking. I extended the documentation.