One of the first thing I wanted to clarify is the situation of current-date() and now() function still mentioned, not described in the specs. Does any of the AQL implementation supports anything like this?
Somewhere (forgot where) I saw a comment about function being supported as current_date(), as the dash - sign might be tricky to be allowed, easily confused with the minus - operator.
I’m adding these kinds of things to the Base Types spec, since we need them in many places - AQL is just one.
In the end, we need just one Expression Language (EL) for everything. There can be more than one syntax flavour, but the point of the EL spec is to standardise one language semantics for the whole of openEHR. AQL only needs a very small subset of this. Those class definitions in Base just add specific pre-defined types and functions that may be used in EL expressions.
Thanks, the base functions are good ones, I think it makes sense and they are useful to have in AQL
current_date()
current_time()
current_date_time()
time_zone() => is it an idea to name this as current_timezone() as usually timezone() is used to convert a given time according to a timezone
primary_language() => usually this is named using ‘locale’ or ‘lc’, but explicit ‘primary’ is oalso ok IMO
sum, min, ‘max’ we already have; mean is avg(); mode we don’t have it yet on our AQL aggregation functions; count is missing on that interface, but I guess it is conceptually the one on the container itself
I’m still hoping for more feedback from AQL implementers.
Maybe this one needs discussion - I’m not sure what the best name is, or if we need more functions. I would think we need a function to return the default language of the locale, but we might also need a way to set and retrieve a language that acts as the primary for the current environment. E.g. in Catalonia, Spain, a system could have Catalan as its default language, or (at least in principle) Spanish as the default, even thought Catalan is probably the default for the region in a generic geographical sense.
select
current-state(ac) as OldFunction,
ac/runtime_properties/state/value as NewRuntimeProperty
from composition c contains instruction i contains activity ac where ac/runtime_properties/state/value = 'active'
Will it be a (big) problem for your implementation if we change the use of dash with underscore in function names?
So instead of current-date() will use current_date(), instead of xx-yy() will use xx_yy(). This would be needed to align with other QL languages, but also to avoid matching the - operator (diff).