| | produce structured documents. |
| | |
| | -The syntax examples show how to produce an XML document, but the same |
| | -mapping could produce any structured format, including JSON. |
| | +While the examples show how to produce an XML document, the same |
| | +mapping could be used to produce any structured format, including JSON. |
| | |
| | # Syntax |
| | |
| | -This section describes the **rxm** language syntax. The syntax entails a map |
| | -and a where clause. |
| | +This section describes the **rxm** language syntax. The syntax entails: |
| | + |
| | +* a **Map**; |
| | +* a **Where** clause; and |
| | +* namespace definitions. |
| | |
| | ## Map |
| | |
| | -The element mapping consists primarily of a database entity on the left |
| | +Each line in the mapping consists primarily of a database entity on the left |
| | and a simple XPath expression on the right. |
| | |
 |
| | ``` |
| | |
| | -This would produce a document structure similar to the following: |
| | +This would produce a document similar to the following: |
| | |
| | ``` |
 |
| | ``` |
| | |
| | -Note: Multiple stack pops (`^`) are allowed per line; if a pop would otherwise |
| | -exceed the root context, the context remains at the root. |
| | +The database entity can be a *table name*, a *column name*, or a *table and |
| | +column name*. The XPath expression is either a node or an attribute. |
| | + |
| | +Exceptions to the line format take the form of pops and globs. |
| | + |
| | +### Pops |
| | + |
| | +Stack pops (`^`) are necessary to switch context to a previous element. |
| | +Multiple stack pops (`^`) are allowed per line; if a pop would |
| | +otherwise exceed the root context, the context remains at the root. |
| | + |
| | +### Globs |
| | + |
| | +The kleene star with the column demarcation (`.`) indicates that all columns |
| | +should be included. Each node name corresponds directly to the entity column |
| | +name. Spaces in column names are replaced with underscores. |
| | |
| | ## Where |
| | + |
| | +Example where clauses include: |
| | |
| | ``` |
| | account.id = $id # $ starts a named parameter |
| | account.id <> $id # inequality parameter comparison |
| | -account.id = {$id, 1} # IN set |
| | -account.id <> {$id, 1} # NOT IN set |
| | +account.id = {$id, 1} # becomes IN set |
| | +account.id <> {$id, 1} # becomes NOT IN set |
| | account.id = null # becomes IS NULL |
| | account.id <> null # becomes IS NOT NULL |
| | account.id = 'text' # string equality comparison |
| | account.id = -42 # numeric equality comparison |
| | account.id < 42 # numeric less than comparison |
| | account.id > 42 # numeric greater than comparison |
| | account.id <= 42 # numeric less than or equal to comparison |
| | account.id >= 42 # numeric greater than or equal to comparison |
| | ``` |
| | + |
| | +The clauses are straightforward and correlate with SQL where clauses as |
| | +expected. |
| | + |
| | +### Variables |
| | + |
| | +Variable parameters start with `$`. |
| | + |
| | +### Logical Operators |
| | + |
| | +The `&&` and `||` operators indicate logical **and** and **or** expressions, |
| | +respectively. |
| | |
| | ## Namespace |
 |
| | |
| | * [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html) |
| | -* [BNF Converter](http://bnfc.digitalgrammars.com/) (see the [BNFC documentation](https://bnfc.readthedocs.org/en/latest/lbnf.html) for details) |
| | +* [BNF Converter](http://bnfc.digitalgrammars.com/) (see its [documentation](https://bnfc.readthedocs.org/en/latest/lbnf.html) for details) |
| | |
| | # Rationale |
| | |
| | -The reasons to create **rxm** include: |
| | +The reasons for **rxm** include: |
| | |
| | -* Decouple SQL statements from document output format. |
| | * 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 |
| | (currently based on SQL/XML). |
| | -* Few databases are fully compliant with SQL/XML:2006. |
| | * XQuery has limited open-source implementations for major RDBMS software. |
| | |