Giter Club home page Giter Club logo

cql-module's Introduction

Corpus Query Language module for eXist-db

Build Status Java 8+ License Download

This is an XQuery Function Extension Module for eXist-db. The module provides a CQL (Corpus Query Language) to XML parser based on exquery/corpusql-parser.

Compiling

Requirements: Java 8, Maven 3.

  1. git clone https://github.com/bcdh/cql-module.git

  2. cd cql-module

  3. mvn package

Installation into eXist-db

You can install the module into 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)

EXPath Package Installation into eXist-db (.xar)

  1. If you have compiled yourself (see above), you can take the cql-module/target/cql-module-1.4.0-SNAPSHOT.xar file and upload it via eXist's EXPath Package Manager app in its Dashboard

  2. Otherwise, the latest release version will also be available from the eXist's EXPath Package Manager app in its Dashboard

Direct Installation into eXist-db (.jar)

  1. If you have compiled yourself (see above), copy cql-module/target/cql-module-1.4.0-SNAPSHOT-exist.jar to $EXIST_HOME/lib, or download cql-module-1.3.0-exist.jar from Maven Central to $EXIST_HOME/lib

  2. Edit $EXIST_HOME/etc/conf.xml and add the following to the <builtin-modules>:

    <module uri="http://humanistika.org/ns/exist/module/cql" class="org.humanistika.exist.module.cqlmodule.CQLModule"/>
  3. Edit $EXIST_HOME/etc/startup.xml and add the following to the <dependencies>:

      <dependency>
        <groupId>org.humanistika.exist.module</groupId>
        <artifactId>cql-module</artifactId>
        <version>1.4.0-SNAPSHOT</version> <!-- modify to the version you are using -->
        <relativePath>cql-module-1.4.0-SNAPSHOT-exist.jar</relativePath> <!-- this should reflect the exact filename in lib folder -->
      </dependency>
  1. Restart eXist-db

Usage

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' &amp; 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

cql-module's People

Contributors

adamretter avatar marmoure avatar ttasovac avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

evolvedbinary

cql-module's Issues

question

This module turns a cql string into an xml equivalent, does it also enable searching material in existdb using cql?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.