dove sono i tuoi vertici e di cosa stanno parlando?

38
Roberto Franchini - OrientDB ROME 18-19 MARCH 2016 Where are your vertexes and what are they talking about?

Upload: codemotion

Post on 16-Apr-2017

380 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Dove sono i tuoi vertici e di cosa stanno parlando?

Roberto Franchini - OrientDB

ROME 18-19 MARCH 2016

Where are your vertexes and what are they talking about?

Page 2: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 3: Dove sono i tuoi vertici e di cosa stanno parlando?

#orientdb at #codemoton

Page 4: Dove sono i tuoi vertici e di cosa stanno parlando?

Graph databases

Page 5: Dove sono i tuoi vertici e di cosa stanno parlando?

Order #134 (Order)

John (Provider)

Commodore Amiga

1200 (Product)

Frank (Customer)

Monitor 40”

(Product)

Mouse (Product)

Bruno (Provider)

Just Data

Page 6: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 7: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 8: Dove sono i tuoi vertici e di cosa stanno parlando?

Definition

“A graph database is any storage system that provides

index-free adjacency” - Marko Rodriguez (author of TinkerPop Blueprints)

Page 9: Dove sono i tuoi vertici e di cosa stanno parlando?

Every developer knows the Relational Model, but who knows the

Graph one?

Page 10: Dove sono i tuoi vertici e di cosa stanno parlando?

Back to school: Graph Theory crash course

Page 11: Dove sono i tuoi vertici e di cosa stanno parlando?

Basic Graph

Roberto RomeVisited

Page 12: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 13: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 14: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 15: Dove sono i tuoi vertici e di cosa stanno parlando?

Congrats! This is your diploma in «Graph Theory»

Page 16: Dove sono i tuoi vertici e di cosa stanno parlando?

Meet OrientDB

Page 17: Dove sono i tuoi vertici e di cosa stanno parlando?

Graph

Document

Object

Key/Value

Multi-Model represents the intersection

of multiple models in just one product

Full-Text

Spatial

Multi-model

Page 18: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 19: Dove sono i tuoi vertici e di cosa stanno parlando?

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)

Page 20: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 21: Dove sono i tuoi vertici e di cosa stanno parlando?

Searching for something

Page 22: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 23: Dove sono i tuoi vertici e di cosa stanno parlando?

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”

Page 24: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 25: Dove sono i tuoi vertici e di cosa stanno parlando?

Twitter graph

Page 26: Dove sono i tuoi vertici e di cosa stanno parlando?

Twitter graph

User

Tweet

Posts

User

Follows

Tweet

Retweets

Tweet

ReplyTo

Source

Using

Hashtag

Tags

Page 27: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 28: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 29: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 30: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 31: Dove sono i tuoi vertici e di cosa stanno parlando?

It’s demo time

Page 32: Dove sono i tuoi vertici e di cosa stanno parlando?

32Luca Franchini

Page 33: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 34: Dove sono i tuoi vertici e di cosa stanno parlando?

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)

Page 35: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 36: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 37: Dove sono i tuoi vertici e di cosa stanno parlando?

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

Page 38: Dove sono i tuoi vertici e di cosa stanno parlando?

Thanks!

ROME 18-19 MARCH 2016

http://www.orientdb.com @robfrankie [email protected]

All pictures belong to their respective authors