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

Prune taxonomy for ontology alignment (as a grep) #22

Closed ppKrauss closed 6 years ago

ppKrauss commented 7 years ago

The "grep external ontology" have many applications, see one example here.

The problem of simple grep is with intermediate branches... Example of wdtaxonomy -m P1709 Q732577 | grep schema.org:

╞══news article (Q5707594) •4 ×15727 ↑ … = http://schema.org/NewsArticle
│  │  ├──atlas (Q162827) •70 ×51 ↑ = http://schema.org/Atlas
├──report (Q10870555) •30 ×7908 = http://schema.org/Report

The real branch for atlas is not news article:

├──educational material (Q6006020) •2 ×7
   ├──reference work (Q13136) •31 ×191 ↑↑
        ├──atlas (Q162827) •70 ×51 ↑ = http://schema.org/Atlas
nichtich commented 6 years ago

The taxonomy could be pruned to all nodes having a mapping or a transitive child with mapping with aditional option --prune-mappings. I'll first do #26, then this feature request.

nichtich commented 6 years ago

Implemented in 0.6.3:

wdtaxonomy -m P1709 Q732577 --prune mappings

This also comes with an (undocumented) tool to extract all mappings with a given URI namespace:

wdmappings http://schema.org/