Skip to content

Data Model

Paula Gearon edited this page Oct 9, 2018 · 2 revisions

Graphs

Naga operates exclusively on graph databases (such as Datomic, Asami, or RDF/SPARQL databases). When non-graph data is provided it must be converted into a graph for processing. To work with more general data, Naga provides an API for importing and exporting JSON.

Without the support of a more advanced rule language, an understanding of the imported data structures is needed to write Naga rules.

The following shows data converted into graph structures. Also, rules written in Pabu take the form of Horn clauses with binary predicates, so this format is also shown.

JSON

Naga imports JSON into a graph format using a structure that can be round-tripped back into the original data. Imported JSON arrives in the form of an array of objects.

The graph format is based on allocating a node identifier for each object, and then generating triples of that ID with attribute/value pairs corresponding to each attribute within a JSON object.

The JSON array of top-level objects given to the Naga API is not guaranteed to be returned in identical order, unless the underlying storage provides this facility. Asami does provide this, which means that JSON stored in Asami is guaranteed to be returned in the original entity order when retrieved.

Examples

Clone this wiki locally