Ontology: make feature retrieval more robust
Ontologies: fix text if a classification graph realizes ontology feature path

Neither the simple nor the complex implementation of this test checked whether
the class (i.e. the type) of the parent graph component is the correct. This
is no problem until the first child nodes of different ontologies are different.
But if a sub-tree is reused in different ontologies, this breaks down. This
commit fixes this problem.