Query information stored in a link

Dear all,

I want to retrieve the target item stored in a link.

Using the following AQL query: SELECT c/links FROM EHR e CONTAINS COMPOSITION c

I could output the list of links (containing one link only):

  [
    [
      {
        "meaning": {
          "_type": "DV_TEXT",
          "value": "MeaningParent com.example.restservice.zib.compositions.burgerlijkestaatcomposition.BurgerlijkeStaatComposition"
        },
        "target": {
          "value": "ehr://TargetParent"
        },
        "type": {
          "_type": "DV_TEXT",
          "value": "TypeParent alcohol_gebruik"
        }
      }
    ]
]

I’ve tried to retrieve the first item of the list using c/links[0] with no successes.
Is it something possible to achieve with AQL?

Thanks for your help!

Array-indexes are not supported AFAIK. Certainly dos not work on Better’s CDR.

You would have to do something like this

SELECT c/links as clinks
 FROM EHR e 
 CONTAINS COMPOSITION c
 OFFSET 0 LIMIT 1

or

SELECT TOP 1 c/links as clinks
 FROM EHR e 
 CONTAINS COMPOSITION c

Though TOP is being deprecated

It’s possibly not a great idea to filter on array position though as my understanding is that the order of each row is essentially indeterminate, and you may not get back what you think of as the ‘first row’

2 Likes