# Overview
Relational eXpression Map (**rxm**) is a terse database- and output-agnostic
query language for generating structured documents.
# Requirements
The software requirements include:
* [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) - Development environment
* [Gradle](http://gradle.org/) - Automated build process
# Quick Start
Download, compile, build, and parse the example using:
git clone https://bitbucket.org/djarvis/rxm.git
gradle -Dbeautify=true clean build javadoc run -Pargs=test/people.rxm
# Usage
This section describes how to invoke the Java API to generate documents.
## Basic
Generate an XML document using **rxm**. For example:
## Modules
A module is a set of **rxm** expressions that can be reused. For example:
# Syntax
This section describes the **rxm** syntax, which involves:
* a **Map**;
* a **Where** clause;
* namespace definitions; and
* module definitions.
## Map
An example map resembles:
The example mapping produces:
Any structured document format can be produced, including JSON.
### Pops
Stack pops (`^`) switch context to a previous element. Multiple consecutive
pop lines are permitted; extraneous pops are silently ignored: context never
traverses beyond the root node.
### Globs
A column demarcation followed by a Kleene star (`.*`) maps remaining columns
automatically. Each node name corresponds directly to the entity column name.
## Where
Example **rxm** expressions for SQL WHERE clauses include:
Additionally, the `&&` and `||` tokens perform logical **and** and **or**
operations, respectively.
## Namespace
Namespace syntax resembles:
root > people(html, http://www.w3.org/TR/html4/),
person > html:person,
person.id > people:id( people, http://www.people.com ),
## Module
Modules are defined using the *module* keyword. For example:
Modules are referenced using the *import* keyword. For example:
Modules may not contain a root element.
# Rationale
The reasons for **rxm** include:
* Eliminate repetitious code.
* Decouple SQL statements from document output format.
* Few databases are fully compliant with SQL/XML:2006.
* Provide a database-agnostic mechanism to generate structured documents.
* XQuery has limited open-source implementations for major RDBMS software.
# Addendum
Review the [JDBC documentation](http://docs.oracle.com/javase/tutorial/jdbc/basics/connecting.html) to understand how database connections are established.