SlideShare a Scribd company logo
1 of 43
Download to read offline
NEO4J, WHAT ELSE?!
    Ron van Weverwijk
AGENDA

• Positionering   binnen NoSql
• Waarom    een Graph database?
• Neo4j

• Cypher

• Vragen?
VIER NOSQL CATEGORIEËN
KEY-VALUE STORE
COLUMN FAMILY
KEY-VALUE STORE     (BIGTABLE)
COLUMN FAMILY
KEY-VALUE STORE     (BIGTABLE)




  DOCUMENT
  DATABASES
COLUMN FAMILY
KEY-VALUE STORE     (BIGTABLE)




  DOCUMENT
  DATABASES       GRAPH DATABASES
WAAR IS EEN
GRAPHDATABASE GOED IN?
http://inmaps.linkedinlabs.com/
PageRank is gebouwd met 15 regels code!
Bron:http://www.royans.net/arch/pregel-googles-other-data-processing-infrastructure/
WAAROM EEN
GRAPHDATABASE?
WAAROM EEN
GRAPHDATABASE?
WAAROM EEN
GRAPHDATABASE?
Experiment: Hoe zijn 2 nodes verbonden?




• 1000   personen

• gemiddeld   50 relaties

• Zijn
     2 personen verbonden
 met maximaal 4 stappen?

• Warme    cache
Experiment: Hoe zijn 2 nodes verbonden?




• 1000   personen                       Relationeel   Neo4j

• gemiddeld   50 relaties

• Zijn
                              1000       2000ms       2ms
     2 personen verbonden
 met maximaal 4 stappen?

• Warme    cache            1 000 000        ?        2ms
Experiment: Hoe zijn 2 nodes verbonden?




• 1000   personen                       Relationeel   Neo4j

• gemiddeld   50 relaties

• Zijn
                              1000       2000ms       2ms
     2 personen verbonden
 met maximaal 4 stappen?

• Warme    cache            1 000 000        ?        2ms
NODES (VERTICES)
RELATIONS (EDGES)
PROPERTIES OP NODES

    type: persoon                   type: team
      name: Ron                      name: S2




                    type: persoon
                    name: Corjan
GETYPEERDE RELATIES

                     speelt_in
    type: persoon                   type: team
      name: Ron                      name: S2




                                     coach_van


                    type: persoon
                    name: Corjan
PROPERTIES OP RELATIES

                      speelt_in
     type: persoon                   type: team
       name: Ron                      name: S2
                      jaar: 2011



                                      coach_van
                                      jaar: 2011

                     type: persoon
                     name: Corjan
PROPERTIES

• Alle    Java primitieven kunnen gebruikt worden:

  • String

  • boolean

  • int

  • double

  • ...
SCHEMA-LESS DATABASE
           !=
DATABASE WITHOUT DESIGN
Doctor Who (Jim Webber)
FILEBASED
EMBEDDABLE, SERVER
                 HIGH AVAILABLE


• new      EmbeddedGraphDatabase("/tmp/neodb");

• GET      http://localhost:7474/db/data/node/123
•   Map<String,String> config = HighlyAvailableGraphDatabase.loadConfigurations( configFile );
    GraphDatabaseService db = new HighlyAvailableGraphDatabase( path, config );
TRANSACTIONS
TRANSACTIONS
Transaction tx = db.beginTx();
try {
  ...
  tx.success();
} finally {
  tx.finish();
}
SHOW ME THE CODE!
    Start database
    Maak nodes
    Maak relaties
    Maak lucene index
TRAVERSING
TraversalDescription traversal =
 new TraversalDescriptionImpl()
          .depthFirst()
          .uniqueness(Uniqueness.RELATIONSHIP_PATH);

Iterable<Path> paths = traversal.traverse(startNode);

                   Ron            Lindy




                          Adres
ALGORITHMS

• find   all paths

• find   all simple paths

• find   the shortest path

• Dijkstra   algorithm

• The   a* search algorithm
DEMO!

Neo4j webconsole
Cypher viewer: Friso van Vollenhoven
https://github.com/friso/graphs
player_of
Mathieu                                 coach_of
                           S2                            Corjan
          player_of



               commission_member_of
     Ron                              Webcommissie

                                  commission_member_of



                         Dennis
GELEERDE LESSEN

• Blijf   tekenen: Maak het netwerk visueel

• Maak     proefopzetjes en refactor

• Pas     node wrapping toe om het domein simpel te houden

• Typeer     nodes

• gebruik    BatchInsert voor veel data
NODE WRAPPING

public interface Member {

    String getName();

    void setName(String name);

    // .....
}
NODE WRAPPING
public class MemberNode implements Member {
  private Node node;
  public static final String MEMBER_NAME_KEY = "name";

    public MemberNode(Node node) {
      this.node = node;
    }

    public String getName() {
      return (String) getNode().getProperty(MEMBER_NAME_KEY);
    }

    public void setName(String name) {
      getNode().setProperty(MEMBER_NAME_KEY, name);
    }
}
NODE WRAPPING
public Team getMyTeam() {
 Relationship teamRelationship =
  getNode().getSingleRelationship(PLAYER_OF,
                                  Direction.OUTGOING);

    Node teamNode = teamRelationship.getEndNode();

    return new Team(teamNode);
}
Ron van Weverwijk
rvanweverwijk@xebia.com

More Related Content

Viewers also liked

Videoscribe je agile transitie
Videoscribe je agile transitieVideoscribe je agile transitie
Videoscribe je agile transitieXebia Nederland BV
 
Becoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientBecoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientXebia Nederland BV
 
7 maatpakken voor de product owner
7 maatpakken voor de product owner7 maatpakken voor de product owner
7 maatpakken voor de product ownerXebia Nederland BV
 
Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryXebia Nederland BV
 
Why we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionWhy we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionXebia Nederland BV
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréXebia Nederland BV
 
Why hadoop map reduce needs scala, an introduction to scoobi and scalding
Why hadoop map reduce needs scala, an introduction to scoobi and scaldingWhy hadoop map reduce needs scala, an introduction to scoobi and scalding
Why hadoop map reduce needs scala, an introduction to scoobi and scaldingXebia Nederland BV
 
Seminar Lean Architectuur June 17th, 2010
Seminar Lean Architectuur June 17th, 2010Seminar Lean Architectuur June 17th, 2010
Seminar Lean Architectuur June 17th, 2010Xebia Nederland BV
 
How DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingHow DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingXebia Nederland BV
 

Viewers also liked (13)

Videoscribe je agile transitie
Videoscribe je agile transitieVideoscribe je agile transitie
Videoscribe je agile transitie
 
Becoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredientBecoming an agile enterprise, focus on the test ingredient
Becoming an agile enterprise, focus on the test ingredient
 
Scan je teams!
Scan je teams!Scan je teams!
Scan je teams!
 
7 maatpakken voor de product owner
7 maatpakken voor de product owner7 maatpakken voor de product owner
7 maatpakken voor de product owner
 
Testen in de transitie naar continuous delivery
Testen in de transitie naar continuous deliveryTesten in de transitie naar continuous delivery
Testen in de transitie naar continuous delivery
 
Why we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right questionWhy we need test automation, but it’s not the right question
Why we need test automation, but it’s not the right question
 
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume CorréTestWorks Conf Performance testing made easy with gatling - Guillaume Corré
TestWorks Conf Performance testing made easy with gatling - Guillaume Corré
 
Why hadoop map reduce needs scala, an introduction to scoobi and scalding
Why hadoop map reduce needs scala, an introduction to scoobi and scaldingWhy hadoop map reduce needs scala, an introduction to scoobi and scalding
Why hadoop map reduce needs scala, an introduction to scoobi and scalding
 
Seminar Lean Architectuur June 17th, 2010
Seminar Lean Architectuur June 17th, 2010Seminar Lean Architectuur June 17th, 2010
Seminar Lean Architectuur June 17th, 2010
 
Creating the right products
Creating the right productsCreating the right products
Creating the right products
 
Judo Strategy
Judo StrategyJudo Strategy
Judo Strategy
 
How DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of TestingHow DUO started with Continuous Delivery and changed their way of Testing
How DUO started with Continuous Delivery and changed their way of Testing
 
Scrumban
ScrumbanScrumban
Scrumban
 

More from Xebia Nederland BV

The 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationThe 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationXebia Nederland BV
 
Holacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartHolacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartXebia Nederland BV
 
Become a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaBecome a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaXebia Nederland BV
 
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarTestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarXebia Nederland BV
 
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...Xebia Nederland BV
 
TestWorks Conf Real world automation survival - Alan Richardson
TestWorks Conf Real world automation survival - Alan RichardsonTestWorks Conf Real world automation survival - Alan Richardson
TestWorks Conf Real world automation survival - Alan RichardsonXebia Nederland BV
 
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarTestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarXebia Nederland BV
 
Why agile testing isn't working
Why agile testing isn't workingWhy agile testing isn't working
Why agile testing isn't workingXebia Nederland BV
 
The lean startup principals applied an experience report
The lean startup principals applied an experience reportThe lean startup principals applied an experience report
The lean startup principals applied an experience reportXebia Nederland BV
 

More from Xebia Nederland BV (14)

The 10 tip recipe for business model innovation
The 10 tip recipe for business model innovationThe 10 tip recipe for business model innovation
The 10 tip recipe for business model innovation
 
Holacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taartHolacracy: een nieuwe bodem voor de Scrum taart
Holacracy: een nieuwe bodem voor de Scrum taart
 
3* Scrum Master
3* Scrum Master3* Scrum Master
3* Scrum Master
 
Agile en Scrum buiten IT
Agile en Scrum buiten ITAgile en Scrum buiten IT
Agile en Scrum buiten IT
 
Become a digital company - Case KPN / Xebia
Become a digital company - Case KPN / XebiaBecome a digital company - Case KPN / Xebia
Become a digital company - Case KPN / Xebia
 
Webinar Xebia & bol.com
Webinar Xebia & bol.comWebinar Xebia & bol.com
Webinar Xebia & bol.com
 
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé MochtarTestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
TestWorks Conf Scalable QA with docker - Maarten van den Ende and Adé Mochtar
 
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
TestWorks Conf Robot framework - the unsung hero of test automation - Michael...
 
TestWorks Conf Real world automation survival - Alan Richardson
TestWorks Conf Real world automation survival - Alan RichardsonTestWorks Conf Real world automation survival - Alan Richardson
TestWorks Conf Real world automation survival - Alan Richardson
 
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan MolenaarTestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
TestWorks Conf 2015 Beefing up FitNesse - Arjan Molenaar
 
Adriaan de-jonge
Adriaan de-jongeAdriaan de-jonge
Adriaan de-jonge
 
Bitcoin Xebicon2012
Bitcoin Xebicon2012Bitcoin Xebicon2012
Bitcoin Xebicon2012
 
Why agile testing isn't working
Why agile testing isn't workingWhy agile testing isn't working
Why agile testing isn't working
 
The lean startup principals applied an experience report
The lean startup principals applied an experience reportThe lean startup principals applied an experience report
The lean startup principals applied an experience report
 

Neo4 j, what else?