Hi Thomas,
It depends on what you mean with "specialise". I do not wish to create a new archetype but I rather would like to query existing instances of the openEHR-EHR-CLUSTER.laboratory_test_analyte.v1 archetype. From those instances I would like to query only this with specific attributes. One constraint I am able to define is to constrain the analyte name:

SELECT e
FROM EHR e CONTAINS CLUSTER a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]
WHERE a/items[at0024]/value/value = 'Calcium'

But how can I manage to as well constrain the value ? The path openEHR-EHR-CLUSTER.laboratory_test_analyte.v1/items[at0001] is of the type ELEMENT, which has a DATA_VALUE for its field "value". The concrete instances of the analytes do have decendents of the DATA_VALUE type in the place for ELEMENT[at0001]/value, e.g. DV_QUANTITY. Is it possible to use paths to those concrete value types in the WHERE-paths, such like:

SELECT e
FROM EHR e CONTAINS CLUSTER a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1] WHERE a/items[at0024]/value/value = 'Calcium' AND a/items[at0001]/value/magnitude > 100

From a type checking point of view, this is not allowed, because the data type at the path a/items[at0001]/value (which is DATA_VALUE) does not contain a field "magnitude". To make this work I would have to bind the value to the concrete type, with something like:

SELECT e
FROM EHR e CONTAINS CLUSTER a[openEHR-EHR-CLUSTER.laboratory_test_analyte.v1]
CONTAINS DV_QUANTITY b
WHERE a/items[at0024]/value/value = 'Calcium' AND a/items[at0001]/value = b and b/magnitude > 100

but I don't think this is allowed in AQL. I am not yet that fluent in AQL, so I could need a little help in this.
Greetings
Georg

--
---------------------------------------------------------------------
Dipl.-Inf. Georg Fette      Raum: B001
Universität Würzburg        Tel.: +49-(0)931-31-85516
Am Hubland                  Fax.: +49-(0)931-31-86732
97074 Würzburg              mail: georg.fe...@uni-wuerzburg.de
---------------------------------------------------------------------


_______________________________________________
openEHR-technical mailing list
openEHR-technical@lists.openehr.org
http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org

Reply via email to