It seems the semantics for CONTAINS in AQL is to select a child or descendant.
I think the spec needs to clarify this. The only place that the relationship involved in CONTAINS is mentioned seems to be here:
http://www.openehr.org/releases/QUERY/latest/docs/AQL/AQL.html Section 3.10.2:
"Since archetypes are in hierarchical structure, AQL has a containment constraint which specifies the hierarchical relationships between parent and child data items."
Only mentions parent-child, that can be interpreted as direct child. It would be good to add the semantics of CONTAINS explicitly as parent to child-or-descendant.
Also on section 3.10.2: "using keyword CONTAINS between two class expressions. Left class expression is the the parent object of the right class expression"
I think "parent" should be "ancestor".
"descendant" or "ancestor" are not mentioned in the current spec.