OpO FAST Triple Store, Web Server, and JSON Database

An insert operation is defined by an INSERT clause. The value of the insert clause must be a JSON object or a JSON array. The JSON element will be inserted unless a WHERE or FILTER clause is included in the statement. If a WHERE or FILTER clause is included in the statement they must appear before the INSERT clause. A FILTER is only allowed if there is also a WHERE clause.

A WHERE in an INSERT statement provides a means to block an insert if a record already exists, A match in a WHERE clause that also passes any FILTER clause will cause the INSERT to fail.

Statements are evaluated asynchronously allowing multiple outstanding queries to be active. To support this an RID clause is allowed in the INSERT statement. The value for the RID clause must be a string. The RID value is passed back in the query result.

Friendly Example

WHERE EQ(name, "Pete") FILTER NOT(GT(age 21) INSERT { "name": "Pete", "age": 63, "sports": [ "mountain biking", "swimming" ] }

JSON Example

{ "where": [ "EQ", "name", "'Pete" ], "filter": [ "NOT", [ "GT", 21 ]], "insert": { "name": "Pete", "age": 63, "sports": [ "mountain biking", "swimming" ] } }

The return from an INSERT 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 ref member that is the reference to the top of the inserted JSON 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, "ref": 19979 }


{ "code": 17, "error": "Already exists." }