graphdb in php @ codemotion 03/23/2012

111
1 Graph databases: time for serious stuDavid Funaro Alessandro Nadalin

Upload: alessandro-nadalin

Post on 08-May-2015

2.402 views

Category:

Technology


2 download

DESCRIPTION

Presentation given about graph databases and OrientDB.

TRANSCRIPT

Page 1: GraphDB in PHP @ Codemotion 03/23/2012

1

Graph databases:time for serious stuff

David FunaroAlessandro Nadalin

Page 16: GraphDB in PHP @ Codemotion 03/23/2012

Your data is a graph

23

Page 17: GraphDB in PHP @ Codemotion 03/23/2012

a tree is a graph

24

Page 18: GraphDB in PHP @ Codemotion 03/23/2012

parent_id is a graph

25

Page 21: GraphDB in PHP @ Codemotion 03/23/2012

maximum flowGiven a dataset, calculate how to best organize it

Page 30: GraphDB in PHP @ Codemotion 03/23/2012

✓Relational Database

(mysql, oracle)

✓Document Oriented DB

(mongodb, couchdb)

✓XML Database

(MarkLogic, eXist-db)

http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching-scoring-ranking-and-recommendation#

Representing a Graph in:

37

Page 35: GraphDB in PHP @ Codemotion 03/23/2012

Tree-based DB WAY

41

1

find

http://davidfunaro.com

3

David Funaro

put in the Search Engine2

The cost to find a single friend HP grows as the friends HP tables grows

Page 43: GraphDB in PHP @ Codemotion 03/23/2012

How ?

49

PREFIX geospecies: <http://rdf.geospecies.org/ont/geospecies#>PREFIX lycopodiophyta: <http://lod.geospecies.org/phyla/Pc2>PREFIX door_county: <http://sws.geonames.org/5250768/>PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT DISTINCT ?family_name ?canonicalName ?commonName ?identifier ?wikipedia_url

WHERE {?x geospecies:hasFamilyName ?family_name; geospecies:hasCanonicalName ?canonicalName; geospecies:hasCommonName ?commonName; dcterms:identifier ?identifier; geospecies:inPhylum lycopodiophyta:; geospecies:isUSDA_ExpectedIn door_county:. OPTIONAL { ?x geospecies:hasCommonName ?commonName; geospecies:hasWikipediaArticle ?wikipedia_url} }

ORDER BY ?family_name ?canonicalName

Page 60: GraphDB in PHP @ Codemotion 03/23/2012

68SELECT FROM fellas WHERE any() traverse(0,-1) ( @rid = [Michelle @rid] )

Page 61: GraphDB in PHP @ Codemotion 03/23/2012

SELECT FROM fellas WHERE any() traverse(0,2) ( @rid = [Michelle @rid] )

Page 63: GraphDB in PHP @ Codemotion 03/23/2012

beyond SQL

Page 65: GraphDB in PHP @ Codemotion 03/23/2012

ACID

Page 68: GraphDB in PHP @ Codemotion 03/23/2012

Double Protocol

Page 86: GraphDB in PHP @ Codemotion 03/23/2012

Orient = PHP Library to work with OrientDB

101

https://github.com/congow/Orient

Page 87: GraphDB in PHP @ Codemotion 03/23/2012

Data Mapper

Query BuilderHTTP Binding

Page 88: GraphDB in PHP @ Codemotion 03/23/2012

HTTP Binding

Page 93: GraphDB in PHP @ Codemotion 03/23/2012

...and much more!

(connect, disconnect, ...)

Page 94: GraphDB in PHP @ Codemotion 03/23/2012

Query Builder

Page 96: GraphDB in PHP @ Codemotion 03/23/2012

               $query->select(array('name', 'username', 'email'), false)                ->from(array('12:0', '12:1'), false)                ->where('any() traverse ( any() like "%danger%" )')                ->orWhere("1 = ?", 1)                ->andWhere("links = ?", 1)                ->limit(20)                ->orderBy('username')                ->orderBy('name', true, true)                ->range("12:0", "12:1");

              SELECT name, username, email               FROM [12:0, 12:1]               WHERE any() traverse ( any() like "%danger%" )              OR 1 = "1" AND links = "1"               ORDER BY name, username               LIMIT 20               RANGE 12:0 12:1

Page 97: GraphDB in PHP @ Codemotion 03/23/2012

Data Mapper

Page 99: GraphDB in PHP @ Codemotion 03/23/2012

Domain Driven Design

Page 111: GraphDB in PHP @ Codemotion 03/23/2012

Credits

http://www.flickr.com/photos/sayamindu/5677281218/sizes/l/in/photostream/http://farm1.static.flickr.com/182/471383865_79d04aec36_o.pnghttp://farm1.static.flickr.com/134/318947873_12028f1b66_b.jpg

http://www.flickr.com/photos/atomdocs/3275758118/sizes/o/in/photostream/http://www.flickr.com/photos/pattipics/5229478393/sizes/o/in/photostream/

http://www.flickr.com/photos/kongharald/366597251/sizes/o/in/photostream/http://www.everaldo.com/

http://www.flickr.com/photos/tusnelda/6140792529/sizes/l/in/photostream/http://www.flickr.com/photos/mondi/5368644355/sizes/l/in/photostream/

http://www.flickr.com/photos/jayneandd/4191106566/sizes/l/in/photostream/http://www.flickr.com/photos/jooon/2093253534/sizes/l/in/photostream/

http://www.flickr.com/photos/bluedharma/89186151/sizes/o/in/photostream/http://www.flickr.com/photos/exfordy/2747089295/sizes/l/in/photostream/

http://www.flickr.com/photos/nostri-imago/3137422976/sizes/o/in/photostream/http://www.flickr.com/photos/fionasjournal/379587818/sizes/z/in/photostream/

http://www.flickr.com/photos/nperlapro/1297392267/http://www.flickr.com/photos/fastphive/28428808/sizes/m/in/photostream/

http://www.flickr.com/photos/rnugraha/2003147365/sizes/o/in/photostream/http://www.flickr.com/photos/zigazou76/4412946911/sizes/l/in/photostream/http://www.flickr.com/photos/greatnet/4667555436/sizes/l/in/photostream/

http://www.flickr.com/photos/mnsc/2768391365/sizes/l/in/photostream/http://www.flickr.com/photos/christmaswithak/4675962453/sizes/l/in/photostream/

http://www.amazon.com/Trainspotting-Irvine-Welsh/dp/0393314804http://www.flickr.com/photos/franconadalin59/5778176872/sizes/l/in/photostream/

http://farm6.static.flickr.com/5176/5474445627_875d621689_b.jpghttp://farm3.static.flickr.com/2243/2189435082_a16d3c89ae_b.jpghttp://farm3.static.flickr.com/2647/3816311930_ac52cff491_o.jpg

http://i130.photobucket.com/albums/p266/feike1977/PES6-4-3-3defencesettings.jpghttp://images.usatoday.com/life/_photos/2006/11/30/numb3rs-topper.jpg

http://www.flickr.com/photos/jakecaptive/3205277810/sizes/l/in/photostream/