4. NEW DATA REQUIREMENTS
interwebs
Orient Technologies www.orientdb.com
Reach WEB
ACCESS Social
Relational Databases
i18n
From 1970 until today, relational
databases have ruled the landscape.
In 2009 the NoSQL movement
gained traction due to the
shortcomings of the relational
model. MANY FACTORS contributed
to the need for new ideas.
It’s not 1970 anymore
broadband
mobile access
cultural changes
5. the minds of developers opened
! Choices, choices
Today there are a variety of
choices in DBMS. Each has their own
strengths, evaluating your needs is
critical.
NoSQL OPTIONS
Document
Orient Technologies www.orientdb.com
Column Based
Key/Value
Object Graph
6. WHAT ABOUT OrientDB?
where do we fit in the scheme of things?
Document Graph
OrientDB is a document-graph database
We provide the flexibility and speed of a document store combined
with the advanced relationship features of a graph database
…and lots more
Orient Technologies www.orientdb.com
7. RELATIONAL VS GRAPH
what are the major differences?
ID Name Employer
10 Gary Weis 232
12 Betty Crocker 899
13 Bob Jones 232
88 Tessa Virtue 12
Companies
ID Name
899 ABC Inc.
232 Acme Corp.
998 Z Industries
12 BMO
Orient Technologies www.orientdb.com
People
Relational databases store data in tables
They use a foreign key and a JOIN operation to determine relationships
8. RELATIONAL VS GRAPH
what are the major differences?
Company
#14:15
ABC Inc.
Graph databases use direct links for relationships
“Edges” allow for index free adjacency and tremendous FLEXIBILITY!
Orient Technologies www.orientdb.com
Person
#12:10
Gary Weis
Person
#12:10
Gary Weis
Person
#12:10
Gary Weis
Company
#14:15
ABC Inc.
Employee
status: full-time
Employee
status: full-time
Employee
status: part-time
LOOK MA!
I have two jobs!
Customer
last order: today
9. RELATIONAL VS GRAPH
what are the major differences?
Relationships
based on context
Partner
ownership: 1%
Many to Many?
Pie ce of cake
Graph databases make data modelling natural
Build your model as you would think of the data intuitively
Orient Technologies www.orientdb.com
Company
#14:15
ABC Inc.
Person
#12:10
Gary Weis Employee
status: full-time
Customer
last order: today
Tag
#12:10
Seller
Person
#14:10
Bob
Tag
#12:11
Buyer
Tag
#12:11
Hot Lead
Person
#14:12
Dave
Person
#14:22
Ruby
Employee
#12:10
VP
Employee
#12:10
Director
Employee
#12:10
Director
Employee
#12:10
Manager
Employee
#12:10
Manager
Employee
#12:10
Manager
Employee
#12:10
Manager
Hierarch i cal data?
C hild’s play
10. MORE OrientDB FEATURES
We will cover these later…
Orient Technologies www.orientdb.com
"
Schema-less, schema-ful or schema-mixed
Inheritance and polymorphism in your model
Extended SQL syntax, blueprints, gremlin
Multi-master replication and sharding for horizontal scalability
A wide selection of language API’s
Browser based development Studio
Embedded functions, record level security, REST, web server….
Phew! Lets get to some hands on learning.
11. AN IMPORTANT ONE
APACHE 2.0
A truly permissive license
!
!
Use for free for ANY purpose - guaranteed
we’ll pa ss o n GPL thanks
Orient Technologies www.orientdb.com
13. $
You only need a JVM installed to run the server
Orient Technologies www.orientdb.com
#
Download
Unzip
%
Run
THREE STEPS
and 5 minutes
14. Section 3 - Data Modelling Concepts
& Concepts
The moving parts
Orient Technologies www.orientdb.com
15. Links
Orient Technologies www.orientdb.com
DATA ENTITY
The primary storage
container of data. Also
referred to as a record.
In Graph mode it is
called a Vertex (or Node)
RELATIONSHIP
A direct connection
between two Vertices or
Documents. Edges and
Links are the relationships
in OrientDB.
DATA ATTRIBUTE
Typed or JSON data
embedded in Documents,
Vertices or Edges. Useful
to query, sort and more!
KEY ELEMENTS
the building blocks
Document
& Vertex
firstName: “Bob”
lastName: “Barker”
age: 102
createdAt: 10/12/12
Edge
Pro p ert ie s
mother: #22:187
16. ♂ Person Characteristics
Orient Technologies www.orientdb.com
'
{!
@rid: 20:12,!
first: “Bob”,!
last: “Barker”,!
birth: 03/04/1920,!
children: [!
#22:123,!
#20:776!
]!
}!
• Inherently unstructured
• Varied contents (schema-less)
• Can contain Links to other documents
• Can contain sub-documents
• Has a Class type
• Has an unique ID (graph wide)
• Are stored inside of a Cluster
• Record ID is composed of cluster &
position (#13:1)
♂
DOCUMENTS
Fast, efficient and flexible storage
Person
{!
@rid: 20:23,!
first: “Wendy”,!
last: “Smith”,!
birth: 06/02/1974,!
children: [],!
pet: {!
name: “Davis”,!
type: “Dog”,!
color: “Black”!
},!
gender: “female”!
}!
17. PROPERTIES
A place to store your stuff
♂ Person
{!
@rid: 20:23,!
first: “Wendy”,!
last: “Smith”,!
birth: 06/02/1974,!
children: [],!
pet: {!
name: “Davis”,!
type: “Dog”,!
color: “Black”!
},!
gender: “female”!
}!
Orient Technologies www.orientdb.com
)
Characteristics
• Have an unique name
• Have a data type
• Can be indexed
• Schema-full restrictions
• Min/Max
• Mandatory
• Readonly
• Not Null
• Unique
• Regexp
DATA TYPES
• Boolean
• Integer
• Short
• Long
• Float
• Double
• Datetime
• String
• Binary
• Embedded
• Embedded list
• Embedded set
• Embedded map
• Link
• Link list
• Link set
• Link map
• Byte
• Transient
• Date
• Custom
• Decimal
• LinkBag
• Any (non determined)
* Tes t on
Tuesday!
18. VERTEX
Storage for a graph
♂ Person
{!
@rid: 20:23,!
first: “Wendy”,!
last: “Smith”,!
birth: 06/02/1974,!
children: [],!
in: [!
#13:2, #13:45!
],!
out: [!
#12:10, #14:33!
]!
}!
Orient Technologies www.orientdb.com
*
Characteristics
• Similar to a document
• Can store data
• Has ID, cluster, links etc
• Has a collection of
• incoming edges
• outgoing edges
• Also called “Nodes”
They are also
ALWAYS round
19. EDGE
Fast, efficient and flexible storage
,Company
Orient Technologies www.orientdb.com
Characteristics
• Stored as a document
• Can have properties
• Has ID, cluster
• Has a name (E by default)
• Has a direction (from & to)
• Incoming Vertex (Head)
• Outgoing Vertex (Tail)
+ Employs
♂ Person
{!
@rid: 20:23,!
first: “Wendy”,!
last: “Smith”,!
birth: 06/02/1974!
}!
+
{!
@rid: 18:99,!
name: “ACME”,!
volume: 980000,!
: 06/02/1974!
}!
{!
startDate: “2010-01-01”!
}!
20. CLASS
Types of Data
Orient Technologies www.orientdb.com
-
Characteristics
• Each record must have one
• Can inherit from another class
• Still allows for schema-less data
• Can have multiple clusters
• Has a default cluster
• Can contain properties for a
schema-ful or schema-mixed model
♂ Person
{!
superclass: “V”,!
clusters: [12,14],!
defaultCluster: 12,!
properties: [!
{!
name: "lastName",!
type: "STRING",!
mandatory: false,!
readonly: false,!
notNull: false,!
min: null,!
max: null,!
collate: "default"!
}!
]}!
♂ SuperHero
{!
superclass: “Person”,!
clusters: [15],!
defaultCluster: 15,!
properties: [!
{!
name: "strength",!
type: “LONG",!
mandatory: false,!
readonly: false,!
notNull: false,!
min: 1,!
max: 1000000,!
collate: "default"!
}!
]}!
21. CLUSTER
Storage flexibility
. USA .
• Where a group of records are stored
• By default, one cluster per class
• Can have multiple clusters per class
• Useful for storage, scaling and
archiving purposes
• Can be used for optimized queries
♂ ♂
♂ Person
♂ Person
♂ Person
♂ Person
♂ Person
Orient Technologies www.orientdb.com
Characteristics
♂ Person
{!
@rid: 20:23,!
first: “Wendy”,!
last: “Smith”,!
country: USA!
}!
♂ Person
{!
@rid: 20:18,!
first: “Bill”,!
last: “Brown”,!
country: USA!
}!
♂ Person
{!
@rid: 20:231,!
first: “Tammy”,!
last: “Taylor”,!
country: USA!
}!
♂ Person
{!
@rid: 20:881,!
first: “Tiffany”,!
last: “Henry”,!
country: USA!
}!
♂ Person
{!
@rid: 20:31,!
first: “Alex”,!
last: “Chang”,!
country: USA!
}!
. Europe
{!
@rid: 22:23,!
first: “Jacques”,!
last: “Revere”,!
country: France!
}!
{!
@rid: 22:922,!
first: “Guilia”,!
last: “Abruzzo”,!
country: Italy!
}!
{!
@rid: 22:11,!
first: “Fabio”,!
last: “Gilberti”,!
country: Italy!
}!
{!
@rid: 22:313,!
first: “Laurent”,!
last: “Biraghi”,!
country: France!
}!
{!
@rid: 22:111,!
first: “Erwan”,!
last: “Enault”,!
country: France!
}!
22. CLUSTER
Storage scalability
Automatic Map/Reduce Query
Directed query to one cluster
/ VPS: Dallas TX / VPS: San Jose CA / VPS: Paris FR
.♂ USA1 .♂ USA2 .♂ Europe1
Orient Technologies www.orientdb.com
23. CLUSTER
Storage replication
/ VPS: Dallas TX / VPS: San Jose CA / VPS: New York NY
.♂ USA1 .♂ USA2 .♂ USA3
.♂ USA2 .♂ USA3 .♂ USA1
Multi-Master Replication!
Orient Technologies www.orientdb.com
24. Studio
5 minute overview
Orient Technologies www.orientdb.com
25. Console Tool
There is one… no time to demo
Orient Technologies www.orientdb.com
26. Node.js & OrientDB
The HelloWorld of my world
Orient Technologies www.orientdb.com