dove sono i tuoi vertici e di cosa stanno parlando?
TRANSCRIPT
Roberto Franchini - OrientDB
ROME 18-19 MARCH 2016
Where are your vertexes and what are they talking about?
whoami(1)More than 15 years of experience, proud to be a
programmer Member of OrientDB team, tech lead for full-text
& spatial indexes, JDBC driver and Docker images
Wrote software for NLP and opinion mining on fast data/big data
JUG-Torino co-lead
#orientdb at #codemoton
Graph databases
Order #134 (Order)
John (Provider)
Commodore Amiga
1200 (Product)
Frank (Customer)
Monitor 40”
(Product)
Mouse (Product)
Bruno (Provider)
Just Data
Order #134 (Order)
John (Provider)
Commodore Amiga
1200 (Product)
Frank (Customer)
Monitor 40”
(Product)
Mouse (Product)
Bruno (Provider)
Data by itself has little value, it’s the relationship between data that gives it
incredible value
Just Data
Order #134 (Order)
John (Provider)
Commodore Amiga
1200 (Product)
(Sells)
Frank (Customer)
(Has)(Makes)
Monitor 40”
(Product)
(Sells)(Has)
Mouse (Product)
Bruno (Provider)
(Sells)
(Has)
Data and relationships
Definition
“A graph database is any storage system that provides
index-free adjacency” - Marko Rodriguez (author of TinkerPop Blueprints)
Every developer knows the Relational Model, but who knows the
Graph one?
Back to school: Graph Theory crash course
Basic Graph
Roberto RomeVisited
Vertices and Edges can have properties
Vertices are directed
* https://github.com/tinkerpop/blueprints/wiki/Property-Graph-Model
Property Graph Model*
Rome country: Italy
Roberto
company: OrientDB
Vertices and Edges can have propertiesVertices and Edges can have properties
Visited on: 2016
RobertoRome
Visited on: 2016
An Edge connects only 2 vertices
Use multiple edges to represent 1-N and N-M relationships
Worked on: 2016
1-N and N-M relationships
Rob Rome
Visited on: 2016
#13:55 #15:99out = #22:11
in = #22:11
#22:11
(Edge)
(Vertex) (Vertex)
out = #13:55in = #15:99
Connections use persistent pointers
Each element in the Graph has own
immutable Record ID
Each element in the Graph has own
immutable Record ID
Each element in the Graph has own
immutable Record ID
Congrats! This is your diploma in «Graph Theory»
Meet OrientDB
Graph
Document
Object
Key/Value
Multi-Model represents the intersection
of multiple models in just one product
Full-Text
Spatial
Multi-model
GraphDocument
Object
Key/Value
Multi Model represents the intersection
of multiple models in just one product
- Just one product to learn and maintain - Just one vendor relationship to manage - No ETL, no synchronization required - Performance and Reliability is easy to test from the
beginning
Multi-model
Multi-Model
Snow Patrol (Band)
Luca (Account)
Indie (Genre)
123, 1st Street
Austin,
Jill (Account)
Graphs{ ”@rid": “12:382”, ”@class": ”Customer", “name”: “Jill”, “surname” : “Raggio”, “phone” : “+39 33123212”, “details”: { “city”:”London", “tags”:”millennial” } }
Schema-less structures
Object OrientedKey-Value pairs
Geo-Spatial
Full-Text
OrientDB (Multi-Model)
Vertices and Edges are Documents
`
{ ”@rid": “12:382”, ”@class": ”Customer", “name”: “Frank”, “surname” : “Raggio”, “phone” : “+39 33123212”, “details”: { “city”:”London", “tags”:”millennial” } }
Frank
Order
Makes
General purpose solution: • JSON • Schema-less • Schema-full • Schema-hybrid • Nested documents • Rich indexing and querying • Developer friendly
Searching for something
IndexA Vertex is just a Document
We can define indexes on fields
CREATE CLASS User EXTENDS VCREATE PROPERTY User.userId LONGCREATE INDEX User.userId ON User(userId) UNIQUE
SELECT FROM User WHERE userId = 1024
What?Ok, but my Users can describe themselves with
free text. How can I find users describing themselves as programmes?
CREATE PROPERTY User.description STRINGCREATE INDEX User.description ON User(description) FULLTEXT ENGINE LUCENE
SELECT FROM User WHERE description LUCENE “programmer”
From where?Users write articles with geo localisation data
inside. I want all the article posted from the Rome area
CREATE CLASS Article EXTENDS V CREATE PROPERTY Article.geo EMBEDDED OPointCREATE INDEX Article.geo ON Article (geo) SPATIAL ENGINE LUCENE
SELECT * FROM Article WHERE ST_WITHIN(geo, ST_Buffer( ST_GeomFromText(‘POINT(12.5113300 41.8919300)'), 1)) = true
Twitter graph
Twitter graph
User
Tweet
Posts
User
Follows
Tweet
Retweets
Tweet
ReplyTo
Source
Using
Hashtag
Tags
User schemaCREATE CLASS User EXTENDS V CREATE PROPERTY User.userId LONG CREATE INDEX User.userId ON User(userId) UNIQUE
CREATE PROPERTY User.description STRING CREATE PROPERTY User.screenName STRING CREATE PROPERTY User.lang STRING CREATE PROPERTY User.location STRING
Tweet schemaCREATE CLASS Tweet EXTENDS V CREATE PROPERTY Tweet.tweetId LONG CREATE INDEX Tweet.tweetId ON Tweet(tweetId) UNIQUE CREATE PROPERTY Tweet.text STRING CREATE PROPERTY Tweet.lang STRING CREATE PROPERTY Tweet.location STRING CREATE PROPERTY Tweet.createdAt DATETIME CREATE PROPERTY Tweet.isRetweeted BOOLEAN CREATE PROPERTY Tweet.isRetweet BOOLEAN
IndexesCREATE INDEX User.description ON User(description)
FULLTEXT ENGINE LUCENE
CREATE INDEX Tweet.text ON Tweet(text) FULLTEXT ENGINE LUCENE
CREATE PROPERTY Tweet.geo EMBEDDED OPoint CREATE INDEX Tweet.geo ON Tweet (geo)
SPATIAL ENGINE LUCENE
RelationsCREATE CLASS Posts EXTENDS E CREATE CLASS Hashtag EXTENDS VCREATE PROPERTY Hashtag.label STRINGCREATE CLASS Tags EXTENDS ECREATE CLASS Source EXTENDS V CREATE PROPERTY Source.name STRINGCREATE CLASS Using EXTENDS E CREATE CLASS Follows EXTENDS ECREATE CLASS Retweets EXTENDS ECREATE CLASS ReplyTo EXTENDS ECREATE CLASS Mentions EXTENDS E
It’s demo time
32Luca Franchini
OrientDB Features
First Multi-Model DBMS with a Graph-Engine
Open Source Apache2 license
Data Models are built into the core engine
The Graph Database engine allows O(1)
performance on traversing relationships, against
O(LogN) of RDBMS and any other Multi-Model
DBMS built as layers
APIs and toolsSupport for TinkerPop standard for Graph DB: Gremlin language and Blueprints API
SQL + extensions for graphs
Live Query
FullText indexing based on Lucene
Spatial indexing (points and polygons)
APIs and tools JDBC driver to connect any BI tool
HTTP/JSON support
ETL tool
Teleporter (EE, import from RDBMS)
Drivers in Java, Node.js, Python, PHP, .NET, Perl, C/C++ and more
Get Started for Free
OrientDB Community Edition is FREE for any purpose (Apache 2 license)
Udemy Getting Started Training is and Free
http://www.orientechnologies.com/getting-started
OrientDB Enterprise is Free for Development
OrientDB At a Glance
70,000 Downloads per month from 200+ countries
100+ Code contributors on Github and 15,000+
commits
1,000s Users from SMBs to
Fortune 10 Companies
17+ Years of Product
Research
Global Coverage and 24x7 Support
Thanks!
ROME 18-19 MARCH 2016
http://www.orientdb.com @robfrankie [email protected]
All pictures belong to their respective authors