/* This grammar has been created from the "url" generic one (see copyright below) for supporting URI/URLs inside the MATCHES clause of openEHR AQL queries. This grammar should be imported by the general AQL one. Modifications have been performed by Luis Marco-Ruiz (luis.marco-ruiz@plri.de) for the HiGHmed project (www.highmed.org) at Hannover Medical School. Examples of URLs to be parsed are: (explicit ValueSet) terminology://system=http://snomed.info/sct/3250621000036107?system_version=20130531?valueset=http://highmed.org/fhirvs/23?vs_version=2.1 (implicit ValueSet) terminology://system=http://snomed.info/sct/3250621000036107?system_version=20130531?valueset=http://snomed.info/sct?fhir_vs=isa/398652114 More information about the intended use can be found at: https://openehr.atlassian.net/wiki/spaces/spec/pages/378830853/Terminology+in+AQL https://openehrspecs.slack.com/messages/C2CD84RUL/ */ /* BSD License Copyright (c) 2016, Tom Everett All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of Tom Everett nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ grammar terminologyurl; terminologyaql : terminologysection; terminologysection : terminology '://' systemsection '?' valuesetsection; terminology : string ; systemsection : system '=' schema '://'? host ('/' path)? ('?' systemversion)?; systemversion : 'system_version' '=' (DIGITS | string); valuesetsection : (explicitvs | implicitvs); explicitvs : valueset '=' schema '://'? host ('/' path)? ('?' vsversion)?; implicitvs : valueset '=' schema '://'? host ('/' path)? ('?' intensionaldef)?; vsversion : 'vs_version' '='(DIGITS | string); intensionaldef : (DIGITS | string) (('_' | '=' | '/') (DIGITS | string))*; path : (DIGITS | string) ('/' (DIGITS | string))*; valueset : string; system : string; schema : string; host : string ('.' string)*; string : STRING; DIGITS : [0-9] +; HEX : ('%' [a-fA-F0-9] [a-fA-F0-9]) +; STRING : DIGITS? (DIGITS | [a-zA-Z0-9] | HEX) (DIGITS | [a-zA-Z0-9.-] | HEX)*; WS : [ \t\r\n]+ -> skip ;