I discovered this nice thread now (and refenced it in RFI: Datalake combined with openEHR CDRs - combined data dictionaries etc - #5 by erik.sundvall).
@yampeku, way back during my PhD thesis work with LiU-EEE wa actually did embed AQL inside XQuery and used XQuery to transform results into e.g. HTML pages or KML (Google Earth placemarks), see e.g.