6 ms·
From https://bitbucket.org/djarvis/rxm/src/master/ https://bitbucket.org/djarvis/rxm/src/master/ : root > people, # "root" keyword
by thangalin 4y ago
From https://bitbucket.org/djarvis/rxm/src/master/ https://bitbucket.org/djarvis/rxm/src/master/ :
root > people, # "root" keyword starts the document
person > person, # maps table context to a node
.age > @age, # @ maps a column to an attribute node
.first_name > name/first, # maps a column to a node
.last_name > .../last, # ... reuses the previous node's path
account.person_id +> person.person_id, # +> performs an INNER JOIN
account > account, # context is now "account" node
.id > @id, # account id attribute
^, # pop stack to previous table context
address > address, # switch context to "address" node
.*, # glob remaining columns
; # Denotes optional WHERE clause
The query produces:
<people>
<person age="42">
<name>
<first>Charles</first>
<last>Goldfarb</last>
</name>
<account id="123"/>
<address>
<id>456</id>
<street>123 Query Lane</street>
<city>San Francisco</city>
</address>
</person>
</people>
It wouldn't take much to make that a JSON document.