Using matches operator in AQL

To date, the use of the matches operator in AQL has been limited to:

  • primitive value matching
  • URI matching
  • special functions like TERMINOLOGY()

However, we could use AQL matching in a generalised ADL mode, which pretty much replicates what GraphQL does, but better.

Here’s an example that I can parse with my current EL parser. We can ignore the val := at the start, it’s just for testing. The baby_weight and age are assumed to be bound to archetype paths. So the part coming after val := could be an AQL WHERE condition.

val := baby_weight ∈ {
           DV_QUANTITY ∈ {
               [units, magnitude] ∈ {
                   [{"kg"}, {|<1.2|}],
                   [{"g"}, {|<1200|}],
                   [{"lb"}, {|<2.5|}],
                   [{"oz"}, {|<40|}]
               }
           }
       }
       OR
       age ∈ {|<-P2M|}

There are some differences from strict ADL, mainly that node identifiers need to be optional.

See here for the Antlr grammar for cADL matcher objects (allowing optional node ids).

Here is where it connects into the EL grammar.

1 Like

Cool. It makes me dream about trial inclusion and exclusion criteria expressed and published as AQL statements.

1 Like