The HFQL SQL syntax is designed to feel natural to users who are familiar with standard SQL.
A simple example is shown below:
SELECT name.family as family, name.given as given, birthDate, identifier.where(system='http://hl7.org/fhir/sid/us-ssn').first().value as SSN FROM Patient WHERE active = true LIMIT 10
This example selects all resources of type Patient from the repository with an active value of true. This is equivalent to performing the following REST query:
This query returns four columns, containing the first family and given name, the birthDate, and the first identifier with a specific
HFQL is inspired by the Firely Query Language, although it also has significant differences. Our original intention was to implement the same FQL syntax, but once the JDBC driver was created it became apparent during testing that JDBC-compliant tools became very fussy about the differences between FQL and SQL such as:
In the end, we decided that the intended use cases for HFQL are different enough that a different syntax that was closer to raw SQL was justified.
See the following pages to learn more about the HFQL SQL syntax: