This wiki has undergone a migration to Confluence found Here

Query Expression and Execution Technology

From HL7Wiki
Jump to navigation Jump to search

How does one query a RIM graph (memory or file) for pre-defined clinical criteria. Codes, values, ages, dates, AND, OR - the usual sort of things. There is a need for a query representation format, and then a tool to run those queries.

  • Ideally it would be:
    • Understandable by a non-developer or non-RIM expert. Some sort of query builder or parameter modifier may be needed that sits on top of one of the other query expression formats.
    • A standard of some sort
    • Possible get it working quickly, days rather than weeks



Grahame: OCL can be used directly. See [1] for discussion.

  • Rik: Constraint and the selection part of a query seem to be allied but different to me - I know I already lumped these together in the question but now I'm trying to tease out the differences. I imagine a set of OCL constraints annotating a model, but they could be too fragmented to constitute a query.
  • Does anyone imagine firing off OCL queries and getting result sets/graphs back?
    • Grahame: yes, an invariant is only a query that must have type boolean and is required to evaluate to true. In our own use we define a different binding called "query"
    • so instead of context T inv: [expression which is of type boolean] it's context T query: [expression which returns OclAny]. I have this working against CDA, but not in a general v3 context.


  • Pros: on paper seems the ideal fit. A standard. Use cases shown recently on DSS list look similar to mine.
  • Cons: hard to implement, no off the shelf tools I can integrate with my own code, not widely adopted.

Rik: Doesn’t add much over OCL, not that that is any easier, but we could just use that instead of the Gello subset.


  • Pros: runs on anything, implemented already, if I serialize the data (or DOM it).
  • Cons: Not RIM aware nor datatypes aware. Not ITS agnostic but that isn’t really an issue.

Rik: I see XQuery as a technology built mostly on XPath so would have some advantages if I was to make a lot of use of XPath but the same weaknesses (lack of model awareness, datatypes integration etc). Normally I tend to "query" using XSL and XPath so have not really looked into XQuery much. I expect it is a better way to do XPath-like queries properly.


  • Pros: a better XPath for HL7, an implementation exists (JavaSIG). HPath is a better language (than XPath), since it shares the same intent but is properly tied to v3 semantics.
  • Cons: not well documented, needs the JavaSIG code integrating, might be hard for a non-JavaSIG based project. The javasig implementation is not generally useable. No support for recent MIFs nor data types R2.


Query By example (QBE) - express queries as Acts etc with isCriterionInd set to true.

  • Pros: It’s HL7
  • Cons: Complicated to express queries. No way to execute queries without writing your own engine.
  • NCI (Jean Duteau) are implementing QBE right now.
  • Bob: Another I would throw into the consideration mix is HQMF [2], which makes heavy use of criteria (previously known as criterion mood). It kinda works like a Query By Example. One of the topics we're exploring with DSS in Cambridge is whether we should enable GELLO, ARDEN, etc in the <expression> field (e.g. where observation.value is data type EXPR_PQ).
  • Rene: Given the lack of constraint language tooling in SMD / Visio there is no way to predict what constraint language will prevail at some future point in time. My guess is that it'll be OCL. So right now the direction seems to be QBE + embedded OCL.

General Discussion

(from the 2010-03-11 Minutes)

  • Andrea: one of the main questions from end-users that needs to be answered is: how do I query a RIMBAA database? Their application will be able to deal with standard queries, but all end-users/customers have a need to do queries not covered by their standard application. Rene: so we need to show how the approach would work, i.e. a kind of "Crystal Report" approach for a RIMBAA database. Michael: And what about research queries? How do we get data from a RIMBAA database to e.g. SPSS.
    • Rene: I think this is a new issue, one that we could try and deal with once the Safe querying of a RIM-based data model-issue has been dealt with. We’ll create another Extracting data from a RIM-based object store issue (which will be a mostly empty page for now until the safe querying issue has been resolved).
  • Michael: Can we use StatML? I hear they use that to give data to researchers. E.g. with Parelsnoer. Only problem is that I cannot find the specifications of StatML, anybody??
  • Michael: Can we use eMeasure? We are trying this in a research project.