OrientDB Quick Guide
OrientDB is an Open Source NoSQL Database Management System,
which contains the features of traditional DBMS along with the new features of
both Document and Graph DBMS. It is written in Java. It can store 220,000
records per second.
OrientDB installation file is available in two editions :
- Community
Edition
- Enterprise
Edition
The main feature of OrientDB is to support multi-model
objects, it supports different models like Document, Graph, Key/Value and Real
Object. It contains a separate API to support all these four models.
Document Model
OrientDB uses the concepts such as classes, clusters, and
link for storing, grouping, and link for storing, grouping, and analyzing the
documents.
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 interconnected by Edges.The vertex and edge are the
main artifacts of the Graph model.
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 that data can be stored in the form of
key/value pair where the values can be of simple and complex types. It can
support documents and graph elements as values.
Comparison 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
Comparison 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
|
OrientDB Commands:
- Create
database - Orientdb> CREATE DATABASE
PLOCAL:/opt/orientdb/databses/sample
- Drop database -
orientdb>
DROP DATABASE PLOCAL:/opt/orientdb/databases/sample admin admin
- Create the Schema called Customer -
CREATE
DATABASE PLOCAL:/opt/orientdb/databases/sample
CREATE CLASS Customer
CREATE PROPERTY
Customer.id integer
CREATE PROPERTY
Customer.name String
CREATE
PROPERTY Customer.age integer
· Insert Record -
INSERT INTO Customer
(id, name, age) VALUES (01,'Anne', 25)
INSERT INTO Customer SET
id = 02, name = 'Jean', age = 26
INSERT INTO Customer
CONTENT {"id": "03", "name": "Nicola",
"age": "29"}
· Select Record -
orientdb
{db = demo}> SELECT FROM Customer WHERE name LIKE 'A%'
orientdb
{db = demo}> SELECT FROM Customer WHERE name.left(1) = 'A'
·Update
Record -
Orientdb
{db = demo}> UPDATE Customer SET age = 28 WHERE name = 'Anne'
·Delete Record -
orientdb
{db = demo}> DELETE FROM Customer WHERE id = 03
Comments
Post a Comment