nichtich/wikidata-taxonomy

Prune taxonomy for ontology alignment (as a grep)

ppKrauss opened this issue · 2 comments

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

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.

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/