OrientDB supports both document and graph data models. This combinations provides an extended set of features that can be utilized in several different scenarios.
The data in this model is stored inside documents. A document is a set of key/value pairs (also referred to as fields or properties) where a key allows access to its value. Values can hold primitive data types, embedded documents or arrays of other values. Documents are not typically forced to have a schema which can be a benefit because they remain flexible and easy to modify. Documents are stored in collections enabling developers to group data as they decide. OrientDB uses the concepts of "classes" and "clusters" instead of "collections" for grouping documents. This provides several benefits we will discuss in further sections of the documentation. The table below illustrates the comparison between the relational model, the document model and the OrientDB document model:
Relational Model | Document Model | OrientDB Document Model |
---|---|---|
Table | Collection | Class or cluster |
Row | Document | Document |
Column | Key/value pair | Key/value pair |
Relationship | not available | Link |
A graph represents a network-like structure consisting of vertices (also known as nodes) interconnected by edges (also known as relationships). OrientDB's graph model is represented by the concept of a property graph, which defines the following:
In addition to mandatory properties each vertex or edge can also hold a set of custom properties. These properties can be defined by users, which can make vertices and edges appear similar to documents. In the table below, you can find a comparison between the graph model, the relational data model and the OrientDB graph model:
Relational Model | Graph Model | OrientDB Graph Model |
---|---|---|
Table | Vertex and Edge Class | Class or Cluster |
Row | Vertex | Vertex |
Columns | Key/value pair | Key/value pair |
Relationship | Edge | Edge |