Developer Deep Dive

ArangoDB stores graphs and documents as JSON objects that can be organized in collections and databases. As defined by ArangoDB:
Databases
Databases allow isolating sets of collections from one to another. Graph databases organize and store data using a graph-like structure, where data entities are represented as nodes and their relationships as edges (also called links).
Figure 1.


Collections
Collections store documents, similar to how files are stored in folders. You can use them to group records of similar kinds together. Collection types include:
Document collection
The documents in these collections are represented as nodes in the schema shown above.
Edge collection
Edge collections are used to store connections between documents. The documents in these collections are represented as edges/links in the schema shown above.
Documents
Documents are referred to the JSON objects store.

Following this structure, in Altair IoT Studio, each Space will have its own database in AnythingDB and the data will be separated from other Spaces.

Each database will have the following Collections (please note Collections cannot be removed and new ones cannot be created).

Type document:
  • Categories: store documents about the Categories defined
  • Models: store documents about the Models defined
  • Versions: store documents about the Versions of the different Models defined
  • Things: store documents about the Things defined
  • propertiesHistory: store documents with the records of Properties defined
  • actionsHistory: store documents with the records of Actions defined
  • eventsHistory: store documents with the records of Events defined
Type edge:
  • Links: store connections between Things. Note that connections between other elements are not allowed.
Figure 2.


1..1 → The query navigates level 1

1..2 → The query navigates both levels 1 and 2

2..2 → The query navigates just level 2

Each Collection will contain multiple documents. Each document could be defined with a set of attributes as shown in the schema below:

Figure 3.


It is now possible to run custom queries directly on the database. New endpoints have been added to execute AQL queries that will run in the ArangoDB database where the AnythingDB's Space information is stored.

The new endpoints that we have created are compatible with the ArangoDB API, so it means handling ArangoDB cursors. Here is the documentation about ArangoDB query and how to use it.