Querying composer's identifiers for where condition

Hi all.

Does anyone know how to query a value that’s inside an Array List?
In my case, I would like to get the value of id, type, issuer, and assigner. Here is the sniped composer data:

What can I achieve so far is this query below:

SELECT c0, c0/composer/identifiers 
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1] 
...
WHERE ...

With that query, I can only capture the value as an object, which is an array list.
It will be easier if that composer has something like archetype_node_id, but sadly, it does not have it.

The reason why I need this is that I want to use one of that values as one of the Where conditions once I know how to capture the value(s).

Thanks for any advice!
Ardi

I think it depends on the implementation. Some implementations have the IN/matches operator which allows you to filter a list in the WHERE, though I don’t know if it’s possible to filter a list of structured data instead of a list of atomic data like List.

Can you provide a data set and the expected result for the data retrieval from that data set?

Hi @pablo

Sorry for late replying.
here’s the data when we get that:


        "<tempalteNameHere>/composer|name": "some_random_name",
        "<tempalteNameHere>/composer|id": "cc12aaf6-7e94-455d-9352-e322b32db8c0",
        "<tempalteNameHere>/composer|id_namespace": "SOME_VALUE",
        "<tempalteNameHere>/composer|id_scheme": "UUID",
...
        "<tempalteNameHere>/composer/_identifier:0|id": "cc12aaf6-7e94-455d-9352-e322b32db8c0",
        "<tempalteNameHere>/composer/_identifier:0|issuer": "some_issuer",
        "<tempalteNameHere>/composer/_identifier:0|assigner": "SOME_VALUE",
        "<tempalteNameHere>/composer/_identifier:0|type": "SOME_VALUE",

please let me know if I need to provide more data here.

thanks,
Ardi

Hi @ardihikaru, it really depends on the actual implementation of AQL engien. However, it is worth of trying the following AQL statements.
If the criteria is on the identifiers:

SELECT c0, c0/composer/identifiers
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1]

WHERE EXISTS c0/composer/identifiers[id=‘xxx’]

If you just want to retrieve the particular identifier with a particular type, you can do the following:
SELECT c0, c0/composer/identifiers[type=‘xxx’]/id, c0/composer/identifiers[type=‘xxx’]/issuer
FROM COMPOSITION c0[openEHR-EHR-COMPOSITION.encounter.v1]

Hope it helps.
Regards,
Chunlan

2 Likes