I forgot to mention something important - in ADL 1.4-based systems (currently most vendors today), the query engine can work out if there is data from specialised archetypes just by searching on the top archetype id with any extended form of the concept part of the id, i.e. if the parent is
openEHR-EHR-CLUSTER.exam.v1
in ADL 1.4, children are named like
openEHR-EHR-CLUSTER.exam-palpation.v1
and
openEHR-EHR-CLUSTER.exam-palpation-cervix.v1
So the query engine just has to know to search for openEHR-EHR-CLUSTER.exam%.v1
or similar (maybe there is something smarter you can do - need to check with SQL experts) - no need to have access to archetype repository.