OpO FAST Web Server and Database
OpO

Trees can created or imported one at a time with option of naming the tree or can be imported in bulk with multiple trees defined in the uploaded data. The format of the tree can be either JSON, TURTLE, or the Opo Graph format (OG). Each create or import can also have a names space or graph associated with it.

Three formats are supported for create and import, JSON, TURTLE, and OG. OG is the Opo Graph format.

For un-named imports an HTTP POST is used. A POST can also be used for creating a named create. This allows a form to be used to create a new instance using Javascript. Normally to create a named tree a PUT would be used though.

To create a named tree an HTTP PUT is used. Optionally a POST can be used. The option of using a POST allows Javascript and forms to be used to create a new tree more easily from forms.

Parameters are used to supply a graph if desired. Parameters can also be used to specify the format and the name in the case of a POST create. Parameters are 'graph', 'name', and 'format'.

The mime types supported are application/x-www-form-urlencoded, multipart/form-data, text/plain, text/turtle, and application/json. The mime type of application/og although non-standard is also allowed. If a mime type is included in the HTTP request it is honored as the means to pick the import format. In the case of form data the format is assumed to be similar to JSON in that the names of the fields should match the JSON paths to the value. A best attempt is made to convert the form data to a native type.

Lacking any other hints an attempt is made to guess the format of the import. If the import data begins with a '{' or '[' character a JSON import is attempted. If the first character is an '@' then TURTLE is assumed. A comment at the start of the import marked by a '#' and followed by the format is also an acceptable format suggestion.

Create with PUT

A PUT is the normal method for creating a new named tree. The URL path should be of the form /tree/name where 'name' is the name of the tree to import.

The payload of the HTTP PUT request should be one tree described according to the specified format.

Examples of a PUT URL for importing are:

http://www.example.com/tree/my-tree?format=json&graph=graph1 http://www.example.com/tree/my-tree

Query parameter options are:

OptionValues
formatjson | turtle | og
graph<string>
Import with POST

Like a PUT, a POST can be used to create a new tree. It can also be used to import one or more un-named trees. When using any of the form formats only one tree can be created or imported at a time.

A POST is the efficient way to import multiple un-named trees using the HTTP API.

Examples of a POST URL for importing are:

http://www.example.com/tree?name=my-tree&format=json&graph=graph1 http://www.example.com/tree?name=my-tree http://www.example.com/tree

Query parameter options are:

OptionValues
formatjson | turtle | og
name<string>
graph<string>