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 $REF, $, and $ROOT. $ will always be a valid JSON element as will the $ROOT.

The $ keywords are expanded as follows.

  • $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 CURSOR.

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 Path.

The CURSOR clause is used for paging. The arguments are the cursor ID and a starting position in a result set.

Friendly Example

WHERE EQ(name "Pete") FILTER NOT(GT(age 21) SELECT { "data": $ }

JSON Example

{ "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.

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.


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


{ "code": 161, "error": "Parse error." }