OrientDB Basic Concepts - OrientDB

What is OrientDB Basic Concepts?

The main aspect of OrientDB is to maintain multi-model objects, i.e. it supports diverse models like Document, Graph, Key/Value and Real Object. It contains a break up API to support all these four models.

Document Model

The expressions Document model belongs to NoSQL database. It means the data is stored in the Documents and the group of Documents are called as Collection. officially, document means a set of key/value pairs or also referred to as fields or properties.
OrientDB makes use of the concepts such as classes, clusters, and link for storing, grouping, and analyzing the documents.
The following table demonstrates the comparison between relational model, document model, and OrientDB document model −
Relational Model
Document Model
OrientDB Document Model
Table
Collection
Class or Cluster
Row
Document
Document
Column
Key/value pair
Document field
Relationship
Not available
Link

Graph Model

A graph data structure is a data model that can store data in the form of Vertices (Nodes) interconnected by Edges (Arcs). The idea of OrientDB graph database came from property graph. The vertex and edge are the main artifacts of the Graph model. They contain the properties, which can make these appear similar to documents.
The subsequent table shows a comparison between graph model, relational data model, and OrientDB graph model.
Relational Model
Graph Model
OrientDB Graph Model
Table
Vertex and Edge Class
Class that extends "V" (for Vertex) and "E" (for Edges)
Row
Vertex
Vertex
Column
Vertex and Edge property
Vertex and Edge property
Relationship
Edge
Edge

The Key/Value Model

The Key/Value model means that information can be stored in the form of key/value pair where the values can be of easy and complex types. It can maintain documents and graph elements as values.
The subsequent table demonstrates the similarity between relational model, key/value model, and OrientDB key/value model.
Relational Model
Key/Value Model
OrientDB Key/Value Model
Table
Bucket
Class or Cluster
Row
Key/Value pair
Document
Column
Not available
Document field or Vertex/Edge property
Relationship
Not available
Link

The Object Model

This model has been inherited by Object Oriented programming and supports Inheritance between types (sub-types extends the super-types), Polymorphism when you consign to a base class and Direct binding from/to Objects used in programming languages.
The subsequent table demonstrates the relationship between relational model, Object model, and OrientDB Object model.
Relational Model
Object Model
OrientDB Object Model
Table
Class
Class or Cluster
Row
Object
Document or Vertex
Column
Object property
Document field or Vertex/Edge property
Relationship
Pointer
Link
Before going further on in aspect, it is healthier to know the basic terms associated with OrientDB. Following are some of the important terminologies.

Record

The smallest unit that you can load from and store in the database. Records can be stored in four types.

  • Document
  • Record Bytes
  • Vertex
  • Edge

Record ID

When OrientDB generates a record, the database server automatically allocates a unit identifier to the record, called RecordID (RID). The RID looks like #<cluster>:<position>. <cluster> means group classification number and the <position> means absolute position of the record in the cluster.

Documents

The Document is the mainly flexible record type available in OrientDB. Documents are gently typed and are defined by schema classes with defined constraint, but you can also insert the document without any schema, i.e. it supports schema-less mode too.
Documents can be without difficulty handled by export and import in JSON format. For example, take a glance at the following JSON sample document. It defines the document details.

RecordBytes

Record Type is the same as BLOB type in RDBMS. OrientDB can load and store document Record type along with binary data.

Vertex

OrientDB database is not only a Document database but also a Graph database. The latest conceptions such as Vertex and Edge are used to store the data in the form of graph. In graph databases, the most basic unit of data is node, which in OrientDB is called a vertex. The Vertex stores information for the database.

Edge

There is a split record type called the Edge that connects one vertex to another. Edges are bidirectional and can only connect two vertices. There are two types of edges in OrientDB, one is regular and another one lightweight.

Class

The class is a type of data model and the concept drawn from the Object-oriented programming paradigm. Supported on the established document database model, data is stored in the form of collection, although in the Relational database model data is stored in tables. OrientDB follows the Document API along with OPPS paradigm. As a concept, the class in OrientDB has the closest relationship with the table in relational databases, but (unlike tables) classes can be schema-less, schema-full or mixed. Classes can take over from other classes, creating trees of classes. Each class has its own cluster or clusters, (created by default, if none are defined).

Cluster

Cluster is an essential conception which is used to store records, documents, or vertices. In easy words, Cluster is a place where a group of records are stored. By default, OrientDB will create one cluster per class. All the records of a class are stored in the same cluster having the same name as the class. You can create up to 32,767(2^15-1) clusters in a database.
The CREATE class is a command used to create a cluster with specific name. Once the cluster is created you can use the cluster to save records by specifying the name during the creation of any data model.

Relationships

OrientDB supports two kinds of relationships: referenced and embedded. Referenced relationships means it stores direct link to the target objects of the relationships. An embedded relationship means it stores the connection within the record that embeds it. This connection is stronger than the reference connection.

Database

The database is an interface to access the real storage. IT understands high-level concepts such as queries, schemas, metadata, indices, and so on. OrientDB also provides multiple database types. For additional information on these types, see Database Types.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

OrientDB Topics