# AQL queries **Category:** [Technical (archive)](https://discourse.openehr.org/c/technical-archive/156) **Created:** 2008-10-01 12:31 UTC **Views:** 1 **Replies:** 2 **URL:** https://discourse.openehr.org/t/aql-queries/14829 --- ## Post #1 by @Greg_Caulton I still think it is unfortunate that none of the existing tools nor the web based CKM show the appropriate AQL path for each data element\. It is near impossible to manually build \.\.\. WHERE openEHR\-EHR\-OBSERVATION\.blood\_pressure\.v1/data\[at0001\]/events\[at0006\]/data\[at0003\]/items\[at0004\]/value/value > = 140 the only way I can do it is to write code to parse the ADL and build the path but I have nothing to validate that my implementation was correct it would be nice to have a set of illustrative AQL queries that one could validate against\. --- ## Post #2 by @thomas.beale Greg Caulton wrote: > I still think it is unfortunate that none of the existing tools nor > the web based CKM show the appropriate AQL path for each data element\. > > It is near impossible to manually build > > \.\.\. > WHERE openEHR\-EHR\-OBSERVATION\.blood\_pressure\.v1/data\[at0001\]/events\[at0006\]/data\[at0003\]/items\[at0004\]/value/value >   Currently you can get the paths from the Archetype workbench \- path view\. See http://www.openehr.org/svn/ref_impl_eiffel/TRUNK/apps/doc/adl_workbench_help.htm \- thomas beale --- ## Post #3 by @system Hi Greg, Thank you for raising your issue\. Sorry that I don't really understand what you want to do? Do you want a path for an archetype node or do you want to use AQL to retrieve EHR data? The AQL where clause stated in your previous email is not quite correct\. It should always starts with a variable which is defined in the AQL from clause, such as: Select bp > From EHR e CONTAINS Composition anyComposition CONTAINS Observation bp\[openEHR\-EHR\-OBSERVATION\.blood\_pressure\.v1\] Where bp/data\[at0001\]/events\[at0006\]/data\[at0003\]/items\[at0004\]/value/magnitude>=1 40 In this query, anyComposition and bp are variables\. This path "/data\[at0001\]/events\[at0006\]/data\[at0003\]/items\[at0004\]/value" points to the systolic element\.value \- DV\_QUANTITY This path "/data\[at0001\]/events\[at0006\]/data\[at0003\]/items\[at0004\]/value/magnitude" points to the systolic element value magnitude \- double\. In future, we do need AQL validations, I agree\. Ocean Template Designer has AQL builder prototype\. However, it is only a prototype, only about three weeks work\. However, it can be used to create simple AQL queries\. We are in the process of building a new AQL builder\. AQL specifications is on openEHR wiki\. Any comments or criticisms are welcome\. Cheers, Chunlan --- **Canonical:** https://discourse.openehr.org/t/aql-queries/14829 **Original content:** https://discourse.openehr.org/t/aql-queries/14829