OpO FAST Triple Store, Web Server, and JSON Database

A select operation is defined by a SELECT clause. The select clause value describes the structure of the return JSON. Specific keywords or symbols define what value will be included. The select, with replaced keywords must for a valid JSON element. The keywords are $RID, $REF, $, and $ROOT. $ will always be a valid JSON element as will the $ROOT.

The $ keywords are expanded as follows.

  • $RID- The RID of the query.
  • $REF- The reference number of the matching node.
  • $- The matching node and children as JSON.
  • $ROOT- The root of the matching node. This is the top most parent of the matching node.

A WHERE clause is required to specify what will be returned. A WHERE value thats either a number or a string is treated as a reference number for a specific node and will return either a single match or none. A WHERE clause that is an expression will return all expression matches except those filter by any FILTER expression.

Additional options exist to modify the return list from a SELECT. Those options are LIMIT, SORT, and UNIQUE.

The LIMIT clause limits the number of returned items to the values specified.

The SORT clause sorts the out returned items according to the provided TPath.

The UNIQUE clause limits the number of items returned for the values at the specified path to be only one for each value.

The PAGE clause sets up paging with two arguments. The first is the page size. The second is the page number with zero as the first page.

Friendly Example

RID "request-3" WHERE EQ(name, "Pete") FILTER NOT(GT(age, 21) SELECT { "rid": $RID "data": $ }

JSON Example

{ "rid": "request-3", "where": [ "EQ", "name", "'Pete" ], "filter": [ "NOT", [ "GT", "age", 21 ]], "select": { "id": "$ref", "data": "$", } }

The return from an SELECT is a JSON Object. The contents of the result Object will be different depending on the success or failure of the evaluation. In all cases a code member will be present. A code value of zero indicates success. Any other value indicates an error.

If an RID was specified in the query then a rid member will also be included in the result Object.

On success the JSON object result will include a results member that is an array of the expanded JSON in the SELECT clause for each matching record.

If an error occurs during statement processing or the statement is not valid the JSON object result will include a error member describing the error.


{ "rid": "request-3", "code": 0, "results": [ { "id": 12299, "data": { "kind": "User", "name": "Pete" } } ] }


{ "rid": "request-3", "code": 161, "error": "Parse error." }