SlideShare une entreprise Scribd logo
1  sur  163
Télécharger pour lire hors ligne
GraphDB in PHP
                Alessandro Nadalin   David Funaro




                                                    1

domenica 23 ottobre 11
Agenda


                         •Theory
                         •When to use a graph?
                         •Why graphDB?
                         •The graphDB community
                         •OrientDB
                         •OrientDB in PHP
                         •Demo
                                                  2

domenica 23 ottobre 11
Essential (Theory)




                                              3

domenica 23 ottobre 11
Essential (Theory)



                         G=
                         Graph




                                                  3

domenica 23 ottobre 11
Essential (Theory)



                         G = (V,
                                      Vertex
                         Graph




                                                  3

domenica 23 ottobre 11
Essential (Theory)



                         G = (V,
                                      Vertex
                         Graph




                                        A



                                                  3

domenica 23 ottobre 11
Essential (Theory)



                         G = (V, E)
                                      Vertex
                         Graph




                                               Edge
                                        A



                                                      3

domenica 23 ottobre 11
Essential (Theory)



                         G = (V, E)
                                      Vertex
                         Graph




                                               Edge
                                        A



                                                      3

domenica 23 ottobre 11
Binary Relation


                                 Hates


                           A               B



                         Itchy           Scratchy



                                                    4

domenica 23 ottobre 11
Binary Relation



                                  Edge

                           A               B


                         Vertex          Vertex




                                                  4

domenica 23 ottobre 11
Graph


                             B       E

                                         F
                         A


                             D       G




                                             5

domenica 23 ottobre 11
Undirected Graph


                                  B         E


                         A


                                  D         F




Example: Friendship                             6

domenica 23 ottobre 11
Directed Edge




                           A                B


                         Vertex        Vertex




                                                7

domenica 23 ottobre 11
Directed Edge



                                  Edge

                           A                B


                         Vertex          Vertex




                                                  7

domenica 23 ottobre 11
Directed Graph

                         A              B



                                  A
                                              F

                             D




Example: Followee                                 8

domenica 23 ottobre 11
Path


                             B      E

                                        F
                         A


                             D      G




                                            9

domenica 23 ottobre 11
Path




       A                 B   D      G   E   F




                                            10

domenica 23 ottobre 11
Graph -> GraphDB




  GraphDB is a database that use the Graph
       as its primary data structure




                                            11

domenica 23 ottobre 11
... when to use a graph ?




domenica 23 ottobre 11
Web in ’99




                                      13

domenica 23 ottobre 11
Web in 2005




                                       14

domenica 23 ottobre 11
The social web




                                          15

domenica 23 ottobre 11
Your data is a graph




                                                16

domenica 23 ottobre 11
a tree is a graph




                                             17

domenica 23 ottobre 11
parent_id is a graph




                                                18

domenica 23 ottobre 11
Recommendations
                                              lives in



         John                       type           shows
                                            Mr
                          Fun                                 Cinema B
                                           Bean                          loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                                   shows      Cinema A   location
                                    type
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           19

domenica 23 ottobre 11
Recommendations
                                              lives in



         John                       type           shows
                                            Mr
                          Fun                                 Cinema B
                                           Bean                          loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                    type
                                                   shows      Cinema A   location     ✓

                                                              x x
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           20

domenica 23 ottobre 11
Recommendations
                                              lives in



         John                       type           shows
                                            Mr
                          Fun                                 Cinema B
                                           Bean
                                                                  ✓      loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                    type
                                                   shows      Cinema A   location     ✓

                                                              x x
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           21

domenica 23 ottobre 11
Recommendations
                                              lives in



         John                       type           shows
                                            Mr
                          Fun                                 Cinema B

                                             ✓
                                           Bean
                                                                  ✓      loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                    type
                                                   shows      Cinema A   location     ✓

                                                              x x
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           22

domenica 23 ottobre 11
Recommendations
                                              lives in



         John

                         xFun
                                    type    Mr

                                             ✓
                                           Bean
                                                   shows
                                                              Cinema B

                                                                  ✓      loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                    type
                                                   shows      Cinema A   location     ✓

                                                              x x
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           23

domenica 23 ottobre 11
Recommendations
                                              lives in



         John

                         x x x
                          Fun
                                    type    Mr
                                           Bean
                                                   shows
                                                              Cinema B
                                                                         loca
                                                                             tion
                lik




                                                                                    Rome
                   es




                                    type
                                                   shows
                                                                  ✓
                                                              Cinema A   location     ✓

                                                              x x
                         Thriller          Se7en
                                                    s ho
                                                         ws

                                                                         location Milan
                                                              Cinema C



                                                                                           24

domenica 23 ottobre 11
Recommendations
                                              lives in



         John

                         x x x
                          Fun
                                    type    Mr
                                           Bean
                                                   shows
                                                           Cinema B
                                                                      loca
                                                                          tion
                lik




                                                                                 Rome
                   es




                                    type
                                                   shows
                                                               ✓
                                                           Cinema A   location     ✓
                                              ✓ shows
                                                           x x
                         Thriller          Se7en




                                                                      location Milan
                                                           Cinema C



                                                                                        25

domenica 23 ottobre 11
Recommendations
                                              lives in



         John

                         x x x
                          Fun
                                    type    Mr
                                           Bean
                                                   shows
                                                           Cinema B
                                                                      loca
                                                                          tion
                lik




                                                                                 Rome
                   es




                                    type
                                                   shows
                                                               ✓
                                                           Cinema A   location     ✓
                                              ✓ shows
                                                           x x
                             ✓
                         Thriller          Se7en




                                                                      location Milan
                                                           Cinema C



                                                                                        26

domenica 23 ottobre 11
Recommendations
                                              lives in



         John

                         x x x
                          Fun
                                    type    Mr
                                           Bean
                                                   shows
                                                           Cinema B
                                                                      loca
                                                                          tion
                lik




                          ✓
                                                                                 Rome
                   es




                                    type
                                                   shows
                                                               ✓
                                                           Cinema A   location     ✓
                                              ✓ shows
                                                           x x
                             ✓
                         Thriller          Se7en




                                                                      location Milan
                                                           Cinema C



                                                                                        27

domenica 23 ottobre 11
Solve decision problems




domenica 23 ottobre 11
Maximum flow

domenica 23 ottobre 11
domenica 23 ottobre 11
Given a dataset, calculate how to best organize it
                         maximum flow
domenica 23 ottobre 11
travelling salesman problem




domenica 23 ottobre 11
The pizza guy needs to deliver on A, B,C.


domenica 23 ottobre 11
Decision base on distance, traffic, time and so on.



domenica 23 ottobre 11
Shortest path
domenica 23 ottobre 11
Identify "special" nodes of the graph




domenica 23 ottobre 11
Given your dataset, organize some clusters

          Are there some nodes which cannot belong to a cluster?

   They probably have some properties different from the average




domenica 23 ottobre 11
Given your dataset, organize some clusters

          Are there some nodes which cannot belong to a cluster?

   They probably have some properties different from the average


              ACHTUNG!
            TERRORISTEN!

domenica 23 ottobre 11
but ... why graphDB?




                                                38

domenica 23 ottobre 11
Representing a Graph in:
                             http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching-
                             scoring-ranking-and-recommendation#




                                                                                                            39

domenica 23 ottobre 11
Representing a Graph in:
                             http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching-
                             scoring-ranking-and-recommendation#
✓ Relational Database
   (mysql, oracle)




✓ Document Oriented DB
   (mongodb, couchdb)




✓ XML Database
   (MarkLogic, eXist-db)
                                                                                                            39

domenica 23 ottobre 11
where is the difference ?




                                                     40

domenica 23 ottobre 11
GraphDB



                   A graph database is any storage
                   system that provides index-free
                   adjacency.




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

domenica 23 ottobre 11
Step by step example




        Given a list of people, find their homepages




                                                       42

domenica 23 ottobre 11
Tree-based DB WAY




                            1




                                             43

domenica 23 ottobre 11
Tree-based DB WAY



                                    David Funaro

                                put in the Search Engine
                                                      2




                            1




                                                           43

domenica 23 ottobre 11
Tree-based DB WAY



                                    David Funaro

                                put in the Search Engine
                                                      2




                                                                        find   3


                            1

                                                           http://davidfunaro.com
                                                                                   43

domenica 23 ottobre 11
Tree-based DB WAY



                                David Funaro

               The cost to find Search Engine friend HP
                          put in the a single
                                               2

              grows as the friends HP tables grows

                                                                find   3


                            1

                                                   http://davidfunaro.com
                                                                           43

domenica 23 ottobre 11
GraphDB WAY




                         it’s like that the GraphDB has an additional information
                                               (the ancor <a>)
                                                                              44

domenica 23 ottobre 11
GraphDB WAY




                             1   get the embedded
                                 information(index)
                                                             www.odino.org




                         it’s like that the GraphDB has an additional information
                                               (the ancor <a>)
                                                                              44

domenica 23 ottobre 11
GraphDB WAY

                           The Anchor work as a local index to
                            reach the document = index-free
                                       adjacency

                             <a href=”http://odino.org”>
                               Alessandro Nadalin
                             </a>




                                                                 45

domenica 23 ottobre 11
Local cost



                 The local cost is O(k) = Constant




                                                     46

domenica 23 ottobre 11
Local cost




    The local cost is O(k) = Constant




                                          47

domenica 23 ottobre 11
Local cost




                                      48

domenica 23 ottobre 11
Local cost




                      Thus, as the graph grows in size,
                   the cost of a local step remain the same



                                                              48

domenica 23 ottobre 11
any database can implicity represent a
                          graph

                         BUT
            only a graph database make the graph
                     structure explicit




                                                    49

domenica 23 ottobre 11
Benchmark


        Deph             RDBMS     Graph
            1             100ms     30ms
                                                         •       1 Million Vertex

                                                         •       4 Million Edge
            2            1000ms    500ms
                                                         •       Scale Free Tolopogy
            3            10000ms   3000ms
                                                         •       Postgres VS Neo4J
            4            100000m 50000ms
                            s                            •       Both Hash and BTree
            5              N/A   100000m
                                    s

                                                                                                                       50
                                   http://markorodriguez.com/2011/02/18/mysql-vs-neo4j-on-a-large-scale-graph-traversal/

domenica 23 ottobre 11
community that is building and feeding the GraphDB ecosystem
                         GraphDB community



    ThinkerPop
       Stack




                               Databases
domenica 23 ottobre 11
data model and their
                           implementation




       Blueprints is a collection of interfaces, implementations,
     ouplementations, and test suites for the property graph data
      model. Blueprints is analogous to the JDBC, but for graph
                                databases.


                                               https://github.com/tinkerpop/blueprints/wiki/



domenica 23 ottobre 11
a data flow Framework using Process Graph




                           provide a collection of "pipes" that are
                           connected togheter to from processing
                                          pipelines



domenica 23 ottobre 11
a graph-based programming language.




       a Turing-Complete graph-base programming language
            that compiles Gremlin syntax down to Pipes




domenica 23 ottobre 11
a REST-full graph shell.




                 Allow blueprints graph to be exposed
                    through a RESTful API (HTTP)




domenica 23 ottobre 11
What's hot



domenica 23 ottobre 11
OrientDB

domenica 23 ottobre 11
Glossary


                            RID
                           <10:05>
                         Cluster Position




                                            58

domenica 23 ottobre 11
Glossary


                            RID
                           <10:05>
                         Cluster Position

                            CLASS

                                            58

domenica 23 ottobre 11
Main features



domenica 23 ottobre 11
Inheritance
domenica 23 ottobre 11
class Vehicle




                                              class Car
                         class Bike




domenica 23 ottobre 11
class Vehicle




                                                   class Car
                              class Bike

                         SELECT FROM Vehicle WHERE owner = 1:1




domenica 23 ottobre 11
class Vehicle




                                                class Car
                           class Bike

                     can return records of class Bike or Car




domenica 23 ottobre 11
Traversal



domenica 23 ottobre 11
domenica 23 ottobre 11
SELECT FROM fellas WHERE any() traverse(0,-1) ( @rid = [Michelle @rid] )
                                                                     66

domenica 23 ottobre 11
SELECT FROM fellas WHERE any() traverse(0,-1) ( @rid = [Michelle @rid] )
                                                                     67

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

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

domenica 23 ottobre 11
SQL synthax



domenica 23 ottobre 11
beyond SQL



domenica 23 ottobre 11
SELECT FROM authors WHERE book.title = ...




domenica 23 ottobre 11
domenica 23 ottobre 11
                         ACID
speaks JSON




domenica 23 ottobre 11
{ "schema": {
 "name": "Address"
   },
    "result": [{
      "@type": "d", "@rid": "#13:0", "@version": 6, "@class": "Address",
      "type": "Residence",
      "street": "Piazza Navona, 1",
      "city": "#14:0",
      "nick": "Luca2"
    }, {
    ...
    ...




domenica 23 ottobre 11
Double Protocol




domenica 23 ottobre 11
HTTP




domenica 23 ottobre 11
HTTP



                         Universal

domenica 23 ottobre 11
HTTP



Easy to interact with

domenica 23 ottobre 11
binary



domenica 23 ottobre 11
binary

                         Blazing fast

domenica 23 ottobre 11
on-record SELECTs




domenica 23 ottobre 11
SELECT FROM cats




domenica 23 ottobre 11
SELECT FROM cats




domenica 23 ottobre 11
SELECT FROM 11:0




domenica 23 ottobre 11
SELECT FROM 11:0




domenica 23 ottobre 11
SELECT FROM [11:0,11:1]




domenica 23 ottobre 11
SELECT FROM [11:0,11:1]




domenica 23 ottobre 11
SELECT FROM [11:0,12:0]




domenica 23 ottobre 11
SELECT FROM [11:0,12:0]




domenica 23 ottobre 11
stress-free setup
domenica 23 ottobre 11
2 Mb
domenica 23 ottobre 11
./orient/bin/server.sh




                                     93

domenica 23 ottobre 11
in-memory DB




domenica 23 ottobre 11
or disk-persisted




domenica 23 ottobre 11
Supports standards        Supports standards




                                               96

 domenica 23 ottobre 11
•Inheritance
                         •Traversal
                         •Sql syntax like
                         •ACID
  OrientDB               •Speak JSON
                         •Double protocol
                         •on-record Select
                         •ThinkerPop Compliant
domenica 23 ottobre 11
Oh, it's Java.




                                          98

domenica 23 ottobre 11
PHP ?



domenica 23 ottobre 11
somebody started writing the
                            binary-protocol binding
                         https://github.com/AntonTerekhov/OrientDB-PHP
                                      ( beta0.4.1, 28 April 2010 )




domenica 23 ottobre 11
$db = new OrientDB($host, $port);

                         $record = $db->recordLoad('1:1', '*:-1');

                         // $record instance of OrientDBRecord




domenica 23 ottobre 11
and others




domenica 23 ottobre 11
domenica 23 ottobre 11
Orient Library




               ... are writing a complete library
                   https://github.com/congow/Orient




                                                      104

domenica 23 ottobre 11
Orient = PHP Library to work with OrientDB




                                           105

domenica 23 ottobre 11
Data Mapper




                         Query Builder
                                               HTTP Binding


domenica 23 ottobre 11
HTTP Binding




domenica 23 ottobre 11
use CongowOrient;
use CongowOrientFoundationBinding;

$driver   = new OrientHttpClientCurl();
$orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo');

$response = $orient->query("SELECT FROM Address");

$output   = json_decode($response->getBody());

foreach ($output->result as $address)
{
  var_dump($address->street);
}




domenica 23 ottobre 11
use CongowOrient;
use CongowOrientFoundationBinding;

$driver   = new OrientHttpClientCurl();
$orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo');

$response = $orient->query("SELECT FROM Address");

$output   = json_decode($response->getBody());

foreach ($output->result as $address)
{
  var_dump($address->street);
}




domenica 23 ottobre 11
use CongowOrient;
use CongowOrientFoundationBinding;

$driver   = new OrientHttpClientCurl();
$orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo');

$response = $orient->query("SELECT FROM Address");

$output   = json_decode($response->getBody());

foreach ($output->result as $address)
{
  var_dump($address->street);
}




domenica 23 ottobre 11
use CongowOrient;
use CongowOrientFoundationBinding;

$driver   = new OrientHttpClientCurl();
$orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo');

$response = $orient->query("SELECT FROM Address");

$output   = json_decode($response->getBody());

foreach ($output->result as $address)
{
  var_dump($address->street);
}




domenica 23 ottobre 11
use CongowOrient;
use CongowOrientFoundationBinding;

$driver   = new OrientHttpClientCurl();
$orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo');

$response = $orient->query("SELECT FROM Address");

$output   = json_decode($response->getBody());

foreach ($output->result as $address)
{
  var_dump($address->street);              { "schema": {
                                            "name": "Address"
}                                             },
                                                "result": [{
                                                  "@type": "d", "@rid": "#13:0", "@version": 6, "@class": "Address",
                                                  "type": "Residence",
                                                  "street": "Piazza Navona, 1",
                                                  "city": "#14:0",
                                                  "nick": "Luca2"
                                                }, {
                                               ...
                                               ...




domenica 23 ottobre 11
apart from ->query($SQL)




domenica 23 ottobre 11
->get|delete|postClass($class)




domenica 23 ottobre 11
->post|delete|put|getDocument($rid)




domenica 23 ottobre 11
...and much more!

                         (connect, disconnect, ...)




domenica 23 ottobre 11
Query Builder




domenica 23 ottobre 11
use CongowOrientQuery;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw(); 
// SELECT FROM users WHERE username = "admin"




domenica 23 ottobre 11
use CongowOrientQuery;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw(); 
// SELECT FROM users WHERE username = "admin"




domenica 23 ottobre 11
use CongowOrientQuery;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw(); 
// SELECT FROM users WHERE username = "admin"




domenica 23 ottobre 11
use CongowOrientQuery;

$query = new Query();
$query->from(array('users'))->where('username = ?', "admin");

echo $query->getRaw(); 
// SELECT FROM users WHERE username = "admin"




domenica 23 ottobre 11
      $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


    domenica 23 ottobre 11
Data Mapper




domenica 23 ottobre 11
A Doctrine2 strange ODM




domenica 23 ottobre 11
namespace PolandPHPConEntity;

use CongowOrientODMMapperAnnotations as ODM;

/**
* @ODMDocument(class="Person")
*/
class Speaker
{
    /**
     * @ODMProperty( type="string")
     */
    protected $name;

         public function setName($name)
         {
             $this->name = $name;
         }


domenica 23 ottobre 11
namespace PolandPHPConEntity;

use CongowOrientODMMapperAnnotations as ODM;

/**
* @ODMDocument(class="Person")
*/
class Speaker
{
    /**
     * @ODMProperty(type="string")
     */
    protected $name;

         public function setName($name)
         {
             $this->name = $name;
         }


domenica 23 ottobre 11
namespace PolandPHPConEntity;

use CongowOrientODMMapperAnnotations as ODM;

/**
* @ODMDocument(class="Person")
*/
class Speaker
{
    /**
     * @ODMProperty(type="string")
     */
    protected $name;

         public function setName($name)
         {
             $this->name = $name;
         }


domenica 23 ottobre 11
namespace PolandPHPConEntity;

use CongowOrientODMMapperAnnotations as ODM;

/**
* @ODMDocument(class="Person")
*/
class Speaker
{
    /**
     * @ODMProperty(type="string")
     */
    protected $name;

         public function setName($name)
         {
             $this->name = $name;
         }


domenica 23 ottobre 11
Domain Driven Design




domenica 23 ottobre 11
{ "schema": {
 "name": "Speaker"
   },
    "result": [{
      "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker",
      "name": "David Coallier"
    }, {
    ...
    ...




domenica 23 ottobre 11
{ "schema": {
 "name": "Speaker"
   },
    "result": [{
      "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker",
      "name": "David Coallier"
    }, {
    ...
    ...




  $david = $mapper->hydrate(json_decode($speaker));




domenica 23 ottobre 11
{ "schema": {
 "name": "Speaker"
   },
    "result": [{
      "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker",
      "name": "David Coallier"
    }, {
    ...
    ...




    $david instanceOf PolandPHPConEntitySpeaker




domenica 23 ottobre 11
Repository Pattern




     $repo = $manager->getRepository('Speaker')




domenica 23 ottobre 11
$speakers = $repo->findAll();




domenica 23 ottobre 11
$speaker = $repo->find($rid);




domenica 23 ottobre 11
$criteria = array('Name' => 'Lorna');

       $lornas = $repo->findBy($criteria);




domenica 23 ottobre 11
$criteria = array(
          'Name'      => 'Lorna',
          'last_name' => 'Jane'
       );

       $lornaJ = $repo->findOneBy($criteria);




domenica 23 ottobre 11
Know your boundaries




                                                138

domenica 23 ottobre 11
https://github.com/doctrine/common/tree/master/lib/Doctrine/Common/Persistence




                                                                           139

domenica 23 ottobre 11
Theory sucks.




                                         140

domenica 23 ottobre 11
Demo


domenica 23 ottobre 11
Demo


                            Menu items in RDBMS
            id type              page   url
            1            external NULL http://www.google.com
            2            page    1      NULL




                                                               142

domenica 23 ottobre 11
Demo
                         Menu items in OrientDB
                                  Link



                  PageLink
          rid title
                          {page
                                           ExternalLink
                                     rid title       url

          9:1 home         1         8:2    google   google.com
                                                                  143

domenica 23 ottobre 11
That’s all, folks!




                                              144

domenica 23 ottobre 11
That’s all, folks!

   David Funaro
   @ingdavidino
   http://davidfunaro.com




                                                 144

domenica 23 ottobre 11
That’s all, folks!

   David Funaro                     Alessandro Nadalin
   @ingdavidino                                        @_odino_
   http://davidfunaro.com                        http://odino.org




                                                                    144

domenica 23 ottobre 11
That’s all, folks!

   David Funaro                     Alessandro Nadalin
   @ingdavidino                                        @_odino_
   http://davidfunaro.com                        http://odino.org




                                                                    144

domenica 23 ottobre 11
Credits

                         http://www.flickr.com/photos/sayamindu/5677281218/sizes/l/in/photostream/
                                  http://farm1.static.flickr.com/182/471383865_79d04aec36_o.png
                                   http://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/0393314804
                         http://www.flickr.com/photos/franconadalin59/5778176872/sizes/l/in/photostream/
                                  http://farm6.static.flickr.com/5176/5474445627_875d621689_b.jpg
                                      http://farm3.static.flickr.com/2243/2189435082_a16d3c89ae_b.jpg
                                       http://farm3.static.flickr.com/2647/3816311930_ac52cff491_o.jpg
                           http://i130.photobucket.com/albums/p266/feike1977/PES6-4-3-3defencesettings.jpg
                                   http://images.usatoday.com/life/_photos/2006/11/30/numb3rs-topper.jpg
                           http://www.flickr.com/photos/jakecaptive/3205277810/sizes/l/in/photostream/




domenica 23 ottobre 11

Contenu connexe

Dernier

H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 

Dernier (20)

H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 

En vedette

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

En vedette (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Graph databases in PHP @ PHPCon Poland 10-22-2011

  • 1. GraphDB in PHP Alessandro Nadalin David Funaro 1 domenica 23 ottobre 11
  • 2. Agenda •Theory •When to use a graph? •Why graphDB? •The graphDB community •OrientDB •OrientDB in PHP •Demo 2 domenica 23 ottobre 11
  • 3. Essential (Theory) 3 domenica 23 ottobre 11
  • 4. Essential (Theory) G= Graph 3 domenica 23 ottobre 11
  • 5. Essential (Theory) G = (V, Vertex Graph 3 domenica 23 ottobre 11
  • 6. Essential (Theory) G = (V, Vertex Graph A 3 domenica 23 ottobre 11
  • 7. Essential (Theory) G = (V, E) Vertex Graph Edge A 3 domenica 23 ottobre 11
  • 8. Essential (Theory) G = (V, E) Vertex Graph Edge A 3 domenica 23 ottobre 11
  • 9. Binary Relation Hates A B Itchy Scratchy 4 domenica 23 ottobre 11
  • 10. Binary Relation Edge A B Vertex Vertex 4 domenica 23 ottobre 11
  • 11. Graph B E F A D G 5 domenica 23 ottobre 11
  • 12. Undirected Graph B E A D F Example: Friendship 6 domenica 23 ottobre 11
  • 13. Directed Edge A B Vertex Vertex 7 domenica 23 ottobre 11
  • 14. Directed Edge Edge A B Vertex Vertex 7 domenica 23 ottobre 11
  • 15. Directed Graph A B A F D Example: Followee 8 domenica 23 ottobre 11
  • 16. Path B E F A D G 9 domenica 23 ottobre 11
  • 17. Path A B D G E F 10 domenica 23 ottobre 11
  • 18. Graph -> GraphDB GraphDB is a database that use the Graph as its primary data structure 11 domenica 23 ottobre 11
  • 19. ... when to use a graph ? domenica 23 ottobre 11
  • 20. Web in ’99 13 domenica 23 ottobre 11
  • 21. Web in 2005 14 domenica 23 ottobre 11
  • 22. The social web 15 domenica 23 ottobre 11
  • 23. Your data is a graph 16 domenica 23 ottobre 11
  • 24. a tree is a graph 17 domenica 23 ottobre 11
  • 25. parent_id is a graph 18 domenica 23 ottobre 11
  • 26. Recommendations lives in John type shows Mr Fun Cinema B Bean loca tion lik Rome es shows Cinema A location type Thriller Se7en s ho ws location Milan Cinema C 19 domenica 23 ottobre 11
  • 27. Recommendations lives in John type shows Mr Fun Cinema B Bean loca tion lik Rome es type shows Cinema A location ✓ x x Thriller Se7en s ho ws location Milan Cinema C 20 domenica 23 ottobre 11
  • 28. Recommendations lives in John type shows Mr Fun Cinema B Bean ✓ loca tion lik Rome es type shows Cinema A location ✓ x x Thriller Se7en s ho ws location Milan Cinema C 21 domenica 23 ottobre 11
  • 29. Recommendations lives in John type shows Mr Fun Cinema B ✓ Bean ✓ loca tion lik Rome es type shows Cinema A location ✓ x x Thriller Se7en s ho ws location Milan Cinema C 22 domenica 23 ottobre 11
  • 30. Recommendations lives in John xFun type Mr ✓ Bean shows Cinema B ✓ loca tion lik Rome es type shows Cinema A location ✓ x x Thriller Se7en s ho ws location Milan Cinema C 23 domenica 23 ottobre 11
  • 31. Recommendations lives in John x x x Fun type Mr Bean shows Cinema B loca tion lik Rome es type shows ✓ Cinema A location ✓ x x Thriller Se7en s ho ws location Milan Cinema C 24 domenica 23 ottobre 11
  • 32. Recommendations lives in John x x x Fun type Mr Bean shows Cinema B loca tion lik Rome es type shows ✓ Cinema A location ✓ ✓ shows x x Thriller Se7en location Milan Cinema C 25 domenica 23 ottobre 11
  • 33. Recommendations lives in John x x x Fun type Mr Bean shows Cinema B loca tion lik Rome es type shows ✓ Cinema A location ✓ ✓ shows x x ✓ Thriller Se7en location Milan Cinema C 26 domenica 23 ottobre 11
  • 34. Recommendations lives in John x x x Fun type Mr Bean shows Cinema B loca tion lik ✓ Rome es type shows ✓ Cinema A location ✓ ✓ shows x x ✓ Thriller Se7en location Milan Cinema C 27 domenica 23 ottobre 11
  • 38. Given a dataset, calculate how to best organize it maximum flow domenica 23 ottobre 11
  • 40. The pizza guy needs to deliver on A, B,C. domenica 23 ottobre 11
  • 41. Decision base on distance, traffic, time and so on. domenica 23 ottobre 11
  • 43. Identify "special" nodes of the graph domenica 23 ottobre 11
  • 44. Given your dataset, organize some clusters Are there some nodes which cannot belong to a cluster? They probably have some properties different from the average domenica 23 ottobre 11
  • 45. Given your dataset, organize some clusters Are there some nodes which cannot belong to a cluster? They probably have some properties different from the average ACHTUNG! TERRORISTEN! domenica 23 ottobre 11
  • 46. but ... why graphDB? 38 domenica 23 ottobre 11
  • 47. Representing a Graph in: http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching- scoring-ranking-and-recommendation# 39 domenica 23 ottobre 11
  • 48. Representing a Graph in: http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching- scoring-ranking-and-recommendation# ✓ Relational Database (mysql, oracle) ✓ Document Oriented DB (mongodb, couchdb) ✓ XML Database (MarkLogic, eXist-db) 39 domenica 23 ottobre 11
  • 49. where is the difference ? 40 domenica 23 ottobre 11
  • 50. GraphDB A graph database is any storage system that provides index-free adjacency. http://www.slideshare.net/slidarko/problemsolving-using-graph-traversals-searching-scoring-ranking-and-recommendation domenica 23 ottobre 11
  • 51. Step by step example Given a list of people, find their homepages 42 domenica 23 ottobre 11
  • 52. Tree-based DB WAY 1 43 domenica 23 ottobre 11
  • 53. Tree-based DB WAY David Funaro put in the Search Engine 2 1 43 domenica 23 ottobre 11
  • 54. Tree-based DB WAY David Funaro put in the Search Engine 2 find 3 1 http://davidfunaro.com 43 domenica 23 ottobre 11
  • 55. Tree-based DB WAY David Funaro The cost to find Search Engine friend HP put in the a single 2 grows as the friends HP tables grows find 3 1 http://davidfunaro.com 43 domenica 23 ottobre 11
  • 56. GraphDB WAY it’s like that the GraphDB has an additional information (the ancor <a>) 44 domenica 23 ottobre 11
  • 57. GraphDB WAY 1 get the embedded information(index) www.odino.org it’s like that the GraphDB has an additional information (the ancor <a>) 44 domenica 23 ottobre 11
  • 58. GraphDB WAY The Anchor work as a local index to reach the document = index-free adjacency <a href=”http://odino.org”> Alessandro Nadalin </a> 45 domenica 23 ottobre 11
  • 59. Local cost The local cost is O(k) = Constant 46 domenica 23 ottobre 11
  • 60. Local cost The local cost is O(k) = Constant 47 domenica 23 ottobre 11
  • 61. Local cost 48 domenica 23 ottobre 11
  • 62. Local cost Thus, as the graph grows in size, the cost of a local step remain the same 48 domenica 23 ottobre 11
  • 63. any database can implicity represent a graph BUT only a graph database make the graph structure explicit 49 domenica 23 ottobre 11
  • 64. Benchmark Deph RDBMS Graph 1 100ms 30ms • 1 Million Vertex • 4 Million Edge 2 1000ms 500ms • Scale Free Tolopogy 3 10000ms 3000ms • Postgres VS Neo4J 4 100000m 50000ms s • Both Hash and BTree 5 N/A 100000m s 50 http://markorodriguez.com/2011/02/18/mysql-vs-neo4j-on-a-large-scale-graph-traversal/ domenica 23 ottobre 11
  • 65. community that is building and feeding the GraphDB ecosystem GraphDB community ThinkerPop Stack Databases domenica 23 ottobre 11
  • 66. data model and their implementation Blueprints is a collection of interfaces, implementations, ouplementations, and test suites for the property graph data model. Blueprints is analogous to the JDBC, but for graph databases. https://github.com/tinkerpop/blueprints/wiki/ domenica 23 ottobre 11
  • 67. a data flow Framework using Process Graph provide a collection of "pipes" that are connected togheter to from processing pipelines domenica 23 ottobre 11
  • 68. a graph-based programming language. a Turing-Complete graph-base programming language that compiles Gremlin syntax down to Pipes domenica 23 ottobre 11
  • 69. a REST-full graph shell. Allow blueprints graph to be exposed through a RESTful API (HTTP) domenica 23 ottobre 11
  • 72. Glossary RID <10:05> Cluster Position 58 domenica 23 ottobre 11
  • 73. Glossary RID <10:05> Cluster Position CLASS 58 domenica 23 ottobre 11
  • 76. class Vehicle class Car class Bike domenica 23 ottobre 11
  • 77. class Vehicle class Car class Bike SELECT FROM Vehicle WHERE owner = 1:1 domenica 23 ottobre 11
  • 78. class Vehicle class Car class Bike can return records of class Bike or Car domenica 23 ottobre 11
  • 81. SELECT FROM fellas WHERE any() traverse(0,-1) ( @rid = [Michelle @rid] ) 66 domenica 23 ottobre 11
  • 82. SELECT FROM fellas WHERE any() traverse(0,-1) ( @rid = [Michelle @rid] ) 67 domenica 23 ottobre 11
  • 83. SELECT FROM fellas WHERE any() traverse(0,2) ( @rid = = [Michelle @rid] )) SELECT FROM fellas WHERE any() traverse(0,2) ( @rid [Michelle @rid] domenica 23 ottobre 11
  • 84. SELECT FROM fellas WHERE any() traverse(0,2) ( @rid = [Michelle @rid] ) domenica 23 ottobre 11
  • 87. SELECT FROM authors WHERE book.title = ... domenica 23 ottobre 11
  • 90. { "schema": { "name": "Address" }, "result": [{ "@type": "d", "@rid": "#13:0", "@version": 6, "@class": "Address", "type": "Residence", "street": "Piazza Navona, 1", "city": "#14:0", "nick": "Luca2" }, { ... ... domenica 23 ottobre 11
  • 93. HTTP Universal domenica 23 ottobre 11
  • 94. HTTP Easy to interact with domenica 23 ottobre 11
  • 96. binary Blazing fast domenica 23 ottobre 11
  • 98. SELECT FROM cats domenica 23 ottobre 11
  • 99. SELECT FROM cats domenica 23 ottobre 11
  • 100. SELECT FROM 11:0 domenica 23 ottobre 11
  • 101. SELECT FROM 11:0 domenica 23 ottobre 11
  • 107. 2 Mb domenica 23 ottobre 11
  • 108. ./orient/bin/server.sh 93 domenica 23 ottobre 11
  • 111. Supports standards Supports standards 96 domenica 23 ottobre 11
  • 112. •Inheritance •Traversal •Sql syntax like •ACID OrientDB •Speak JSON •Double protocol •on-record Select •ThinkerPop Compliant domenica 23 ottobre 11
  • 113. Oh, it's Java. 98 domenica 23 ottobre 11
  • 114. PHP ? domenica 23 ottobre 11
  • 115. somebody started writing the binary-protocol binding https://github.com/AntonTerekhov/OrientDB-PHP ( beta0.4.1, 28 April 2010 ) domenica 23 ottobre 11
  • 116. $db = new OrientDB($host, $port); $record = $db->recordLoad('1:1', '*:-1'); // $record instance of OrientDBRecord domenica 23 ottobre 11
  • 117. and others domenica 23 ottobre 11
  • 119. Orient Library ... are writing a complete library https://github.com/congow/Orient 104 domenica 23 ottobre 11
  • 120. Orient = PHP Library to work with OrientDB 105 domenica 23 ottobre 11
  • 121. Data Mapper Query Builder HTTP Binding domenica 23 ottobre 11
  • 123. use CongowOrient; use CongowOrientFoundationBinding; $driver   = new OrientHttpClientCurl(); $orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo'); $response = $orient->query("SELECT FROM Address"); $output   = json_decode($response->getBody()); foreach ($output->result as $address) {   var_dump($address->street); } domenica 23 ottobre 11
  • 124. use CongowOrient; use CongowOrientFoundationBinding; $driver   = new OrientHttpClientCurl(); $orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo'); $response = $orient->query("SELECT FROM Address"); $output   = json_decode($response->getBody()); foreach ($output->result as $address) {   var_dump($address->street); } domenica 23 ottobre 11
  • 125. use CongowOrient; use CongowOrientFoundationBinding; $driver   = new OrientHttpClientCurl(); $orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo'); $response = $orient->query("SELECT FROM Address"); $output   = json_decode($response->getBody()); foreach ($output->result as $address) {   var_dump($address->street); } domenica 23 ottobre 11
  • 126. use CongowOrient; use CongowOrientFoundationBinding; $driver   = new OrientHttpClientCurl(); $orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo'); $response = $orient->query("SELECT FROM Address"); $output   = json_decode($response->getBody()); foreach ($output->result as $address) {   var_dump($address->street); } domenica 23 ottobre 11
  • 127. use CongowOrient; use CongowOrientFoundationBinding; $driver   = new OrientHttpClientCurl(); $orient   = new Binding($driver, '127.0.0.1', '2480', 'admin', 'admin', 'demo'); $response = $orient->query("SELECT FROM Address"); $output   = json_decode($response->getBody()); foreach ($output->result as $address) {   var_dump($address->street); { "schema": { "name": "Address" } }, "result": [{ "@type": "d", "@rid": "#13:0", "@version": 6, "@class": "Address", "type": "Residence", "street": "Piazza Navona, 1", "city": "#14:0", "nick": "Luca2" }, { ... ... domenica 23 ottobre 11
  • 131. ...and much more! (connect, disconnect, ...) domenica 23 ottobre 11
  • 133. use CongowOrientQuery; $query = new Query(); $query->from(array('users'))->where('username = ?', "admin"); echo $query->getRaw();  // SELECT FROM users WHERE username = "admin" domenica 23 ottobre 11
  • 134. use CongowOrientQuery; $query = new Query(); $query->from(array('users'))->where('username = ?', "admin"); echo $query->getRaw();  // SELECT FROM users WHERE username = "admin" domenica 23 ottobre 11
  • 135. use CongowOrientQuery; $query = new Query(); $query->from(array('users'))->where('username = ?', "admin"); echo $query->getRaw();  // SELECT FROM users WHERE username = "admin" domenica 23 ottobre 11
  • 136. use CongowOrientQuery; $query = new Query(); $query->from(array('users'))->where('username = ?', "admin"); echo $query->getRaw();  // SELECT FROM users WHERE username = "admin" domenica 23 ottobre 11
  • 137.    $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 domenica 23 ottobre 11
  • 138. Data Mapper domenica 23 ottobre 11
  • 139. A Doctrine2 strange ODM domenica 23 ottobre 11
  • 140. namespace PolandPHPConEntity; use CongowOrientODMMapperAnnotations as ODM; /** * @ODMDocument(class="Person") */ class Speaker {     /**      * @ODMProperty( type="string")      */     protected $name;     public function setName($name)     {         $this->name = $name;     } domenica 23 ottobre 11
  • 141. namespace PolandPHPConEntity; use CongowOrientODMMapperAnnotations as ODM; /** * @ODMDocument(class="Person") */ class Speaker {     /**      * @ODMProperty(type="string")      */     protected $name;     public function setName($name)     {         $this->name = $name;     } domenica 23 ottobre 11
  • 142. namespace PolandPHPConEntity; use CongowOrientODMMapperAnnotations as ODM; /** * @ODMDocument(class="Person") */ class Speaker {     /**      * @ODMProperty(type="string")      */     protected $name;     public function setName($name)     {         $this->name = $name;     } domenica 23 ottobre 11
  • 143. namespace PolandPHPConEntity; use CongowOrientODMMapperAnnotations as ODM; /** * @ODMDocument(class="Person") */ class Speaker {     /**      * @ODMProperty(type="string")      */     protected $name;     public function setName($name)     {         $this->name = $name;     } domenica 23 ottobre 11
  • 145. { "schema": { "name": "Speaker" }, "result": [{ "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker", "name": "David Coallier" }, { ... ... domenica 23 ottobre 11
  • 146. { "schema": { "name": "Speaker" }, "result": [{ "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker", "name": "David Coallier" }, { ... ... $david = $mapper->hydrate(json_decode($speaker)); domenica 23 ottobre 11
  • 147. { "schema": { "name": "Speaker" }, "result": [{ "@type": "d", "@rid": "#1:0", "@version": 6, "@class": "Speaker", "name": "David Coallier" }, { ... ... $david instanceOf PolandPHPConEntitySpeaker domenica 23 ottobre 11
  • 148. Repository Pattern $repo = $manager->getRepository('Speaker') domenica 23 ottobre 11
  • 151. $criteria = array('Name' => 'Lorna'); $lornas = $repo->findBy($criteria); domenica 23 ottobre 11
  • 152. $criteria = array( 'Name' => 'Lorna', 'last_name' => 'Jane' ); $lornaJ = $repo->findOneBy($criteria); domenica 23 ottobre 11
  • 153. Know your boundaries 138 domenica 23 ottobre 11
  • 155. Theory sucks. 140 domenica 23 ottobre 11
  • 157. Demo Menu items in RDBMS id type page url 1 external NULL http://www.google.com 2 page 1 NULL 142 domenica 23 ottobre 11
  • 158. Demo Menu items in OrientDB Link PageLink rid title {page ExternalLink rid title url 9:1 home 1 8:2 google google.com 143 domenica 23 ottobre 11
  • 159. That’s all, folks! 144 domenica 23 ottobre 11
  • 160. That’s all, folks! David Funaro @ingdavidino http://davidfunaro.com 144 domenica 23 ottobre 11
  • 161. That’s all, folks! David Funaro Alessandro Nadalin @ingdavidino @_odino_ http://davidfunaro.com http://odino.org 144 domenica 23 ottobre 11
  • 162. That’s all, folks! David Funaro Alessandro Nadalin @ingdavidino @_odino_ http://davidfunaro.com http://odino.org 144 domenica 23 ottobre 11
  • 163. Credits http://www.flickr.com/photos/sayamindu/5677281218/sizes/l/in/photostream/ http://farm1.static.flickr.com/182/471383865_79d04aec36_o.png http://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/0393314804 http://www.flickr.com/photos/franconadalin59/5778176872/sizes/l/in/photostream/ http://farm6.static.flickr.com/5176/5474445627_875d621689_b.jpg http://farm3.static.flickr.com/2243/2189435082_a16d3c89ae_b.jpg http://farm3.static.flickr.com/2647/3816311930_ac52cff491_o.jpg http://i130.photobucket.com/albums/p266/feike1977/PES6-4-3-3defencesettings.jpg http://images.usatoday.com/life/_photos/2006/11/30/numb3rs-topper.jpg http://www.flickr.com/photos/jakecaptive/3205277810/sizes/l/in/photostream/ domenica 23 ottobre 11