Hi!

Sorry for joining the discussion late. (Vacation season)

During the development of LiU EEE (https://github.com/LiU-IMT/EEE) we (in
addition to AQL-to-XQuery-translation) actually created a simple
XML-representation of the AQL parse-tree for initial debugging/analysis
purposes. I do not think we maintained this XML-debugging feature in the
later parts of application development so it is most likely buggy or
defunct. You may play around with the code in
https://github.com/LiU-IMT/EEE/blob/master/src/main/java/se/liu/imt/mi/eee/AQL_Parser/AqlParser.jj
and set the return type to XML instead of XQuery_EEE_0_1.

Be warned: messing around in JavaCC is error prone. ANTLR is probably nicer
and has good tooling support. It would be a good community contribution for
somebody to make an open source implementation of an ANTLR-based AQL
parse-tree generator and query language transformation engine :-)

Best regards,
Erik Sundvall

Ph.D. Medical Informatics. Information Architect. Tel: +46-72-524 54 55 (or
010-1036252 in Sweden)
Li?: erik.sundvall at regionostergotland.se (lio.se changing name 1 Jan 2015)
LiU: erik.sundvall at liu.se http://www.imt.liu.se/~erisu/

On Wed, Dec 17, 2014 at 9:52 PM, pablo pazos <pazospablo at hotmail.com> wrote:

> Great! Thanks for the info.
>
> --
> Kind regards,
> Eng. Pablo Pazos Guti?rrez
> http://cabolabs.com <http://cabolabs.com/es/home>
> <http://twitter.com/ppazos>
>
> ------------------------------
> Date: Wed, 17 Dec 2014 21:50:22 +0000
>
> Subject: Re: Does anyone implemented a transformation between AQL and XML?
> From: serefarikan at kurumsalteknoloji.com
> To: openehr-technical at lists.openehr.org
>
> Ok, I think I see what you mean now.
>
> AQL is not part of the official specification and there is not much other
> than the grammar for the implementers so you're right about not having a
> lot to work with.
> On the other hand, if you're going to do AQL, you're going to have to have
> a parser. Marand has kindly provided an ANTLR grammar here:
> https://openehr.atlassian.net/wiki/display/spec/AQL-+Archetype+Query+Language
>
> To use this grammar, you're going to have to invest into learning ANLTR
> and inevitably into parser generators. Not an easy topic if you're not
> familiar with it but I personally think it is worth it.
>
> due to way ANTLR works, Marand's grammar should get you really close to
> what you're asking without much effort. You'll probably have more of a
> challenge when trying to map the output of the parser to your query
> mechanism.
>
> So the obvious pointer is the ANTLR grammar, the rest depends on your
> efforts :)
>
> All the best
> Seref
>
>
> On Wed, Dec 17, 2014 at 8:31 PM, pablo pazos <pazospablo at hotmail.com>
> wrote:
>
> Hi Seref, what I asked here was if anyone did implemented that, so I don't
> have to :)
>
> As I said, my experience tells me it requires more hours-man to work with
> a syntax, a model and a parser than having XML and parse parts of it when
> required (so I can have 1. many ad-hoc parsers, 2. no model just ad-hoc
> data structures, 3. no API, 4. no parser e.g. it requires a lot of time to
> find a problem update the jj, generate the parser and test).
>
> Hope that clarifies my vision.
>
> Of course, I didn't started yet to do anything about AQL support, just
> trying to make the community aware that I'll do so and maybe generate some
> collaboration momentum. Maybe the syntax definition is very stable and
> there are a lot of good parsers for Java, but the syntax definition I found
> seems to be old (
> https://openehr.atlassian.net/wiki/display/spec/Archetype+Query+Language+Grammar
>  &
> https://openehr.atlassian.net/wiki/display/spec/AQL-+Archetype+Query+Language)
> and I don't know about AQL parsers for Java (just found this old
> discussion, no response about the parser:
> http://lists.openehr.org/pipermail/openehr-technical_lists.openehr.org/2009-March/004400.html
> ).
>
> I'm sure I need to do more research, but I doubt I can find the basic
> building blocks, even to start working with AQL directly.
>
> Please if you know where I can find stuff to help me, any pointers will be
> very welcome!
>
> --
> Kind regards,
> Eng. Pablo Pazos Guti?rrez
> http://cabolabs.com <http://cabolabs.com/es/home>
> <http://twitter.com/ppazos>
>
> ------------------------------
> Date: Wed, 17 Dec 2014 19:03:28 +0000
>
> Subject: Re: Does anyone implemented a transformation between AQL and XML?
> From: serefarikan at kurumsalteknoloji.com
> To: openehr-technical at lists.openehr.org
>
> Hi Pablo,
> Sorry but I still don't get it :) How are you going to do the following
> without an AQL parser?:
>
> AQL (syntax) <=(transformation)=> XML (syntax)
>
>
> If you have an xml form of AQL and use only that, you'd have to force your
> users write queries in the xml form of AQL which would defeat the whole
> purpose of the AQL.
>
> So I'm still not seeing how you're gaining anything with an XML form of
> AQL.
>
> Best regards
> Seref
>
>
> On Wed, Dec 17, 2014 at 4:17 PM, pablo pazos <pazospablo at hotmail.com>
> wrote:
>
> Hi Seref,
>
> Yes! Just need the transformation to have an AQL in XML syntax.
>
> What I was thinking is trying to add support to AQL in the EHRServer,
> doing something like this:
>
> AQL (syntax) <=(transformation)=> XML (syntax) <=(mapping)=> EHRServer
> Query Model (OO) <=(ORM)=> Query Storage
>
> I already have the part for Evaluating/Executing queries that are
> represented in the EHRServer Query Model.
>
> Having this I can import and export AQL, and I don't need to actualy
> "execute" AQL.
>
>
> This is in fact one way of implementing "The point of AQL is sending the
> same query to multiple implementations".
>
>
> Why not dealing with AQL directly?
>
> In my experience in implementing software with ADLs and OPTs, managing
> OPTs in XML is way simpler: I can write my own parsers for specific tasks
> without the need of parsing the whole structure and then deal with an
> object instance in memory (sometimes buggy, difficult to access specific
> data, APIs not so well defined, non implemented methods, etc). So it is a
> matter of risk management and cost reduction (since I'm the only one
> working on the EHRServer I need to search for the shortest path to do each
> task will a certain level of quality).
>
> So I have the same idea with AQL: not deal with AQL parsers or object
> instances, just the XML. The idea of this request is that I don't want to
> develop an XML syntax for XML: it would be great if someone else already
> have that done so I can reuse.
>
> This way I don't need to "have to deal with an AQL parser" :)
>
>
> Hope that helps!
>
> --
> Kind regards,
> Eng. Pablo Pazos Guti?rrez
> http://cabolabs.com <http://cabolabs.com/es/home>
> <http://twitter.com/ppazos>
>
> ------------------------------
> Date: Tue, 16 Dec 2014 17:42:51 +0000
> Subject: Re: Does anyone implemented a transformation between AQL and XML?
> From: serefarikan at kurumsalteknoloji.com
> To: openehr-technical at lists.openehr.org
>
>
> Hi Pablo,
> I'm a bit confused. What are you asking for? AQL does not have an object
> model that has been published, it has a grammar, so an XML representation
> of AQL would at best be AQL in XML syntax. If that is what you're after, I
> can't see how that could help? The point of AQL is sending the same query
> to multiple implementations, so its use means that you'd have to deal with
> an AQL parser.
>
> If you want to develop an XML syntax for AQL, you'd still have to use an
> AQL parser to import AQL as you've described in your OP. It sounds like
> you're trying to develop a mapping from AQL to your internal query
> execution, which is fine, but the XML syntax for AQL sounds redundant in
> that scenario.
>
> Care to explain a bit more?
>
> Regards
> Seref
>
>
> On Tue, Dec 16, 2014 at 5:34 PM, pablo pazos <pazospablo at hotmail.com>
> wrote:
>
> Hi Bert,
>
> I don't have any XML :D My question is about ADL, not it's
> interpretation/execution, that is already handled by the current querying
> component of the EHRServer.
>
> What I'm curious about is if someone has a transformation between AQL
> syntax and XML, in other words, a XML expression of an AQL query.
>
> An AQL query can be instantiated and executed over any database, while
> XQuery is already an instance of a query (because it uses XPaths not ADL
> paths) and can be executed only in XML databases (and relational that
> support XML columns). The EHRServer database is relational, without any XML
> columns.
>
> Also, what I need is a bidirectional transformation AQL <-> XML. I guess
> it would be difficult to generate AQL from an XQuery expression.
>
> --
> Kind regards,
> Eng. Pablo Pazos Guti?rrez
> http://cabolabs.com <http://cabolabs.com/es/home>
> <http://twitter.com/ppazos>
>
> ------------------------------
> Date: Tue, 16 Dec 2014 07:34:13 +0100
> Subject: Re: Does anyone implemented a transformation between AQL and XML?
> From: bert.verhees at rosa.nl
> To: openehr-technical at lists.openehr.org
>
>
> Depending on how your XML is constructed, it is very easy to convert AQL
> to XQuery, or ADL-path to XPath.
>
> Bert
>
> Op dinsdag 16 december 2014 heeft pablo pazos <pazospablo at hotmail.com>
> het volgende geschreven:
>
> Just curious :)
>
> I'm adding version control features to EHRServer (
> https://github.com/ppazos/cabolabs-ehrserver) and I want to add some kind
> of AQL support in the future. Right now we have an internal querying model
> that abstracts from the physical database and allows the creation of
> queries for openEHR data from a UI.
> My idea is to have some kind of transformation between the EHRServer query
> model and AQL, and instead of struggle with AQL parsers I would like to do
> some XML transformations to import and export AQL (I do not need to
> actually execute AQL, the execution of the internal query model is working
> ok).
>
> Comments and ideas are very welcome!
>
> --
> Kind regards,
> Eng. Pablo Pazos Guti?rrez
> http://cabolabs.com <http://cabolabs.com/es/home>
> <http://twitter.com/ppazos>
>
>
>
> --
>
> *This e-mail message is intended exclusively for the addressee(s). Please
> inform us immediately if you are not the addressee.*
>
>
> _______________________________________________ openEHR-technical mailing
> list openEHR-technical at lists.openehr.org
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
> _______________________________________________
> openEHR-technical mailing list
> openEHR-technical at lists.openehr.org
>
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
>
> _______________________________________________ openEHR-technical mailing
> list openEHR-technical at lists.openehr.org
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
> _______________________________________________
> openEHR-technical mailing list
> openEHR-technical at lists.openehr.org
>
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
>
> _______________________________________________ openEHR-technical mailing
> list openEHR-technical at lists.openehr.org
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
> _______________________________________________
> openEHR-technical mailing list
> openEHR-technical at lists.openehr.org
>
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
>
> _______________________________________________ openEHR-technical mailing
> list openEHR-technical at lists.openehr.org
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
> _______________________________________________
> openEHR-technical mailing list
> openEHR-technical at lists.openehr.org
>
> http://lists.openehr.org/mailman/listinfo/openehr-technical_lists.openehr.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.openehr.org/pipermail/openehr-technical_lists.openehr.org/attachments/20141228/902d35ed/attachment-0001.html>

Reply via email to