This is an XQuery Function Extension Module for Elemental or eXist-db. The module provides a CQL (Corpus Query Language) to XML parser based on exquery/corpusql-parser.
You can install the module into Elemental or eXist-db in either one of two ways:
- As an EXPath Package (.xar file)
 - Directly as a XQuery Java Extension Module (.jar file)
 
- 
Download the latest XAR file from the releases here: https://github.com/BCDH/cql-module/releases/
- or if you have compiled the code yourself you can find the 
cql-module-1.6.0-SNAPSHOT.xarfile in thetargetsubfolder. 
 - or if you have compiled the code yourself you can find the 
 - 
You can take the .xar file and upload it via Elemental or eXist-db's EXPath Package Manager app from its Dashboard
 - 
Restart Elemental (or eXist-db)
 
- 
Download the latest Jar file from the releases here: https://github.com/BCDH/cql-module/releases/
- or if you have compiled the code yourself you can find the 
cql-module-1.6.0-SNAPSHOT-exist.jarfile in thetargetsubfolder. 
 - or if you have compiled the code yourself you can find the 
 - 
Copy the .jar file to either
$ELEMENTAL_HOME/lib(or substitute$EXIST_HOMEinstead of$ELEMENTAL_HOMEfor eXist-db). - 
Edit
$ELEMENTAL_HOME/etc/conf.xmland add the following to the<builtin-modules>:<module uri="http://humanistika.org/ns/exist/module/cql" class="org.humanistika.exist.module.cqlmodule.CQLModule"/>
 - 
Edit
$ELEMENTAL_HOME/etc/startup.xmland add the following to the<dependencies>:<dependency> <groupId>org.humanistika.exist.module</groupId> <artifactId>cql-module</artifactId> <version>1.6.0-SNAPSHOT</version> <!-- NOTE: Modify this to the version you are using --> <relativePath>cql-module-1.6.0-SNAPSHOT-exist.jar</relativePath> <!-- NOTE: this should reflect the exact filename in lib folder that you copied earlier --> </dependency>
 - 
Restart Elemental (or eXist-db)
 
The module exports a single function for use in your XQuery(s), for example:
xquery version "3.1";
import module namespace cql = "http://humanistika.org/ns/exist/module/cql";
cql:parse("[lemma='bob' & ana='x']")would produce the output:
<cql:query xmlns:cql="http://humanistika.org/ns/exist/module/cql">
    <cql:position>
        <cql:and>
            <cql:attribute name="lemma">bob</cql:attribute>
            <cql:attribute name="ana">x</cql:attribute>
        </cql:and>
    </cql:position>
</cql:query>For further examples of the XML that will be produced see CorpusQLXMLVisitorTest
Requirements: Java 8, Maven 3.
- 
git clone https://github.com/bcdh/cql-module.git - 
cd cql-module - 
mvn package