AQL VersionedObject Grammar

Hi dear All

I confuse to make a AQL query using versioned_object or Version,

Does anyone know some example of using versioned_object and version?

Thanks in advance

Mahdi Asgari

Hi Mahdi,

SELECT v/commit_audit/committer/name,
v/commit_audit/time_committed/value, v/data/uid, v/data/time_created,
c
FROM EHR e [ehr_id/value = 'ecfe6e6e-8868-4fc6-8db8-def71cb8a250']
CONTAINS VERSION v
CONTAINS COMPOSITION c[openEHR-EHR-COMPOSITION.encounter.v1]

should return commit _audit and versioned_object attributes for all
Encounter compositions.

Ian

Dr Ian McNicoll
office +44 (0)1536 414 994
fax +44 (0)1536 516317
mobile +44 (0)775 209 7859
skype ianmcnicoll
ian.mcnicoll@oceaninformatics.com

Clinical Modelling Consultant, Ocean Informatics, UK
openEHR Clinical Knowledge Editor www.openehr.org/knowledge
Honorary Senior Research Associate, CHIME, UCL
BCS Primary Health Care www.phcsg.org

Thanks Ian

Is the bellow EQL query correct for query in all versions of a composition ?

SELECT v/commit_audit/committer/name, v/commit_audit/time_committed/value,
v/data/uid, v/data/time_created, c FROM EHR e [ehr_id/value =
'ecfe6e6e-8868-4fc6-8db8-def71cb8a250'] CONTAINS VERSIONED_OBJECT vo
CONTAINS VERSION v [all_versions] CONTAINS COMPOSITION
c[openEHR-EHR-COMPOSITION.encounter.v1]
Where c/uid = '<hierobjectid>'

Wow
You are hot!
Sam

Yes, from memory this be about right, but the VERSIONED_OBJECT part is
redundant as it is not used anywhere in the query.

I notice you are specifying a HIER_OBJECT_ID as the COMPOSITION.uid
criteria. Although it is not a specified and not a hard rule, it is
recommended that a OBJECT_VERSION_ID is used in the COMPOSITION.uid
otherwise you have no way of getting the exact version of a composition when
the composition is separated from the VERSION object.

Heath