1. ROME 11-12 april 2014ROME 11-12 april 2014
OrientDB: a Document-Graph Database
ready for the Cloud
OrientDB Committer
OrientDB Academy Coordinator at Orient Technologies LTD
Project Manager at AssetData S.r.l.
Email: l.dellaquila – at – orientechnologies.com
Twitter: @ldellaquila
Luigi Dell’Aquila
2. ROME 11-12 april 2014 - Luigi Dell’Aquila
Relational Databases:
Everybody knows what a TABLE is
Everybody knows SQL
3. ROME 11-12 april 2014 - Luigi Dell’Aquila
These are tables,
Data ARE Tables!
4. ROME 11-12 april 2014 - Luigi Dell’Aquila
These are tables,
Data ARE Tables!
5. ROME 11-12 april 2014 - Luigi Dell’Aquila
These are tables,
Data ARE Tables!
20. ROME 11-12 april 2014 - Luigi Dell’Aquila
Two data models:
Graph
and
Document
21. ROME 11-12 april 2014 - Luigi Dell’Aquila
Classes, not Tables
create class Person
create class Student extends Person
select from Person
Polymorphic query: returns both instances of Person and
Student
22. ROME 11-12 april 2014 - Luigi Dell’Aquila
Dynamic schema
create class Person
insert into Person (name, surname) values (“Luigi”,
“Dell’Aquila”)
No need to fully specify the class structure, you can work in
schemaless mode
23. ROME 11-12 april 2014 - Luigi Dell’Aquila
Complex attributes
Update person
set address = {
“street”: “5th Ave”,
“city”: “NY”
},
tags = [“developer”, “artist”, “geek”]
Collections and embedded properties
24. ROME 11-12 april 2014 - Luigi Dell’Aquila
Physical links
(no Join!)
Update person set address.city =
(select from city where name = ‘Rome’)
where name = ‘Luigi’
Select address.city.country.name
from Person where name = ‘Luigi’
Dot notation instead of Join
No need for foreign keys
O(1) computational cost – compared to O(log N) in relational Join
25. ROME 11-12 april 2014 - Luigi Dell’Aquila
The Graph API
(TinkerPop Blueprints)
Traverse out(“Friend”) from
(select from Person where name = ‘Luigi’)
while address.city = ‘Rome’
Find my friends network in my city (friends, firends of frineds,
friends of friends of friends…)
Deep traversal, no need to know in advance HOW deep
26. ROME 11-12 april 2014 - Luigi Dell’Aquila
Every record has unique ID
Select from Person
{"result": [
{
"@rid": "#13:0",
"@class": “Person",
"name": "Luigi",
"surname": "Dell'Aquila",
"friendOf": "#13:1"
}
]}
27. ROME 11-12 april 2014 - Luigi Dell’Aquila
Every record has unique ID
Select from Person
{"result": [
{
"@rid": "#13:0",
"@class": “Person",
"name": "Luigi",
"surname": "Dell'Aquila",
"friendOf": "#13:1"
}
]}
28. ROME 11-12 april 2014 - Luigi Dell’Aquila
Every record has unique ID
Select from Person
{"result": [
{
"@rid": "#13:0",
"@class": “Person",
"name": "Luigi",
"surname": "Dell'Aquila",
"friendOf": "#13:1"
}
]}
29. ROME 11-12 april 2014 - Luigi Dell’Aquila
Record ID (RID)
=
Physical position
30. ROME 11-12 april 2014 - Luigi Dell’Aquila
Traversing relationships
=
Following a physical path
31. ROME 11-12 april 2014 - Luigi Dell’Aquila
It means:
• Accessing linked data is very efficient
• No calculation *
• Independent from cluster size **
• Deep traversal is allowed and encouraged ***
* In RDMS, a Join is calculated EVERY TIME you execute a query
** RDBS use index-based optimization to speed up joins, but index
access is O(log N), so it depends on data size – what about Big
Data???
*** in RDMS multiple joins are inefficient (would you dare to write a
query with 1000 joins?)
32. ROME 11-12 april 2014 - Luigi Dell’Aquila
But OrientDB
Gives you more!
33. ROME 11-12 april 2014 - Luigi Dell’Aquila
Javascript In the Storage
Extend the query language
With you own functions
34. ROME 11-12 april 2014 - Luigi Dell’Aquila
Javascript functions
As REST services
35. ROME 11-12 april 2014 - Luigi Dell’Aquila
But of course you can use it
from
36. ROME 11-12 april 2014 - Luigi Dell’Aquila
90’s are gone
Today you need