From: [email protected]
[mailto:openehr-technical-bounces at openehr.org] On Behalf Of Randolph Neall
Sent: Tuesday, November 06, 2007 3:35 AM
To: For openEHR technical discussions
Subject: Re: OpenEHR queries

 

As a developer from the US who sometimes tries to follow discussions here, I
have a question probably well answered if I took more time myself to find
the answer. Against what do your archetype queries run? Against the DB
itself or some representation of the data in memory? I ask because a few
months ago, someone from openEHR said in one of the discussions that a DB
schema is not part of openEHR, that some private participant in openEHR had
one for sale, and Ocean, maybe, but that was it. So, again against what do
these queries (see example in Chunlan Ma's message below) run? 

 

That's good question. You've noticed that I didn't mention anything about
the data store here. In general, query languages are designed specifically
for a type of data store. For instance, SQL is run against relational
databases. XQuery is run against XML structured data. Object Oriented Query
Language need to be run against Object oriented database management systems
etc. These types of query language are data query languages, i.e. they query
at the data level. You have to know DB schema when you write a SQL query
statement.

 

Archetype Query Language is different from the general query languages. It's
a semantic query language, i.e. it queries data at semantic level. It's
neutral to  persistence layer and system design. We only need to use
archetype path and openEHR reference model to construct AQL statement. You
can have whatever persistence layer as long as it can get expected results
back based on the AQL statement.  That's why AQL queries can be shared
across systems and enterprise boundaries. Sharing AQL is one of the key
solution to achieve semantic interoperability. 

 

Cheers,

Chunlan

 

 

Thanks,

 

Randy Neall

Veriqant, L.L.C.



 

On 11/4/07, Chunlan Ma <chunlan.ma at oceaninformatics.com> wrote: 

Hi Greg,

Rong has indicated there is a paper about archetype query language. Thanks
Rong. That paper introduced basic query syntax. It was written at the 
beginning of this year. The query syntax has been enriched recently in order
to support more complicated queries. I've already started to write the
specifications, but need to resolve some known issues before release. 

Anyway, I handcrafted the following queries for you (I cannot build my query
builder at the moment because of some integration issues).

The query statement below shows that all observation instances with 
respiratory rate greater than n will be returned.

SELECT o
FROM EHR e[ehr_id/value=$ehrId] CONTAINS COMPOSITION CONTAINS OBSERVATION
o[openEHR-EHR-OBSERVATION.respiration.v1.adl]
WHERE o/data/events[at0002]/data[at0003]/items[at0004]/value/magnitude>n AND

o/data/events[at0002]/data[at0003]/items[at0004]/value/units = '/min'

If you want the respiratory quantity object been returned, the query would
look like:

SELECT o/data/events[at0002]/data[at0003]/items[at0004]/value 
FROM EHR e[ehr_id/value=$ehrId] CONTAINS COMPOSITION CONTAINS OBSERVATION
o[openEHR-EHR-OBSERVATION.respiration.v1.adl]
WHERE o/data/events[at0002]/data[at0003]/items[at0004]/value/magnitude>n AND
o/data/events[at0002]/data[at0003]/items[at0004]/value/units = '/min' 

Just for your information, the single letter 'o' is the observation class
variable name, "/data/events[at0002]/data[at0003]/items[at0004]/value" is
the archetype path to respiratory quantity node. If you have the archetype 
workbench running, you can identify this path there. '$ehrId' is the
parameter name which can be substituted with real EHR ehr_id value at run
time. The query language supports parameterization.

Some archetype query statements would be very long if the query criteria are

complicated. In fact, we don't need to write the above queries by hand.
Ocean Informatics has implemented a tool - Archetype Query Builder, which
can be used to create/edit queries easily. Additionally, Ocean has also 
implemented a query parser and query engine as well.

The above query statements are consistent to the query syntax introduced by
the MedInfo paper. The current query tools also support this query syntax.
However, as I have said that we have enriched the query syntax and all the
enhancements can be found from the query specifications.

Hope this helps.

Regards,
Chunlan

-----Original Message-----
From: [email protected]
[mailto:openehr-technical-bounces at openehr.org] On Behalf Of Greg Caulton 
Sent: Monday, November 05, 2007 6:48 AM
To: openEHR-technical at openehr.org
Subject: OpenEHR queries

Hi,

Somewhere I recall reading that there was an OpenEHR query that 
theoretically an OpenEHR compliant system could execute a return
results for.

Is there a spec somewhere, preferably with a simple example.

So if someone knew my patient and queried for all instances of 
Respiratory Rate greater than n?

openEHR-EHR-OBSERVATION.respiration.v1.adl

Rate  at0004 > n
Units /min (is that a default or are the units passed in the query)

Or is this future functionality? 

thanks

Greg

http://www.patientos.org
_______________________________________________
openEHR-technical mailing list
openEHR-technical at openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical
_______________________________________________ 
openEHR-technical mailing list
openEHR-technical at openehr.org
http://lists.chime.ucl.ac.uk/mailman/listinfo/openehr-technical 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.openehr.org/mailman/private/openehr-technical_lists.openehr.org/attachments/20071106/2c20a5e9/attachment.html>

Reply via email to