https://github.com/bcdh/cql-module
Corpus Query Language Module for eXist-db
https://github.com/bcdh/cql-module
Last synced: 9 months ago
JSON representation
Corpus Query Language Module for eXist-db
- Host: GitHub
- URL: https://github.com/bcdh/cql-module
- Owner: BCDH
- License: gpl-2.0
- Created: 2016-09-02T00:47:25.000Z (almost 10 years ago)
- Default Branch: main
- Last Pushed: 2023-11-22T15:31:13.000Z (over 2 years ago)
- Last Synced: 2024-04-24T12:26:46.761Z (about 2 years ago)
- Language: Java
- Size: 39.1 KB
- Stars: 4
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Corpus Query Language module for Elemental or eXist-db
[](https://github.com/BCDH/cql-module/actions/workflows/ci.yml)
[](http://java.oracle.com)
[](https://www.gnu.org/licenses/gpl-2.0.html)
[](https://search.maven.org/search?q=g:org.humanistika.exist.module)
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](https://github.com/exquery/corpusql-parser).
## Installation into Elemental or eXist-db
You can install the module into Elemental or eXist-db in either one of two ways:
1. As an EXPath Package (.xar file)
2. Directly as a XQuery Java Extension Module (.jar file)
### Easy Option - EXPath Package Installation into eXist-db (.xar)
1. Download the latest XAR file from the releases here: https://github.com/BCDH/cql-module/releases/
* or if you have [compiled](#compiling) the code yourself you can find the `cql-module-1.6.0-SNAPSHOT.xar` file in the `target` subfolder.
2. You can take the .xar file and upload it via Elemental or eXist-db's EXPath Package Manager app from its Dashboard
3. Restart Elemental (or eXist-db)
### Advanced Option - Direct Installation into eXist-db (.jar)
1. Download the latest Jar file from the releases here: https://github.com/BCDH/cql-module/releases/
* or if you have [compiled](#compiling) the code yourself you can find the `cql-module-1.6.0-SNAPSHOT-exist.jar` file in the `target` subfolder.
2. Copy the .jar file to either `$ELEMENTAL_HOME/lib` (or substitute `$EXIST_HOME` instead of `$ELEMENTAL_HOME` for eXist-db).
3. Edit `$ELEMENTAL_HOME/etc/conf.xml` and add the following to the ``:
```xml
```
4. Edit `$ELEMENTAL_HOME/etc/startup.xml` and add the following to the ``:
```xml
org.humanistika.exist.module
cql-module
1.6.0-SNAPSHOT
cql-module-1.6.0-SNAPSHOT-exist.jar
```
5. Restart Elemental (or eXist-db)
## Usage
The module exports a single function for use in your XQuery(s), for example:
```xquery
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:
```xml
bob
x
```
For further examples of the XML that will be produced see [CorpusQLXMLVisitorTest](https://github.com/BCDH/cql-module/blob/master/src/test/java/org/humanistika/exist/module/cqlmodule/CorpusQLXMLVisitorTest.java#L42)
## Compiling
Requirements: Java 8, Maven 3.
1. `git clone https://github.com/bcdh/cql-module.git`
2. `cd cql-module`
3. `mvn package`