Neo4jAndTelCogoodnessPeterNeubauerNeoTechnology#neo4j@peterneubauerpeter@neotechnology.comSomeusecasesNOSQLdatamodelsBigtableclonesKey-valuestoresDocumentdatabasesGraphdatabasesDatacomplexityDatasizeTheNeo4jmodel:PropertyGraphCoreabstractions:NodesRelationshipsbetweennodesPropertiesonbothname=“Emil”age=29sex=“yes”type=KNOWStime=4yearstype=carvendor=“SAAB”model=“95Aero”112233TheNoSQLlandscapeNeo4jintroExamplesforTelCosCDRRoutingSocialgraphsMasterDataManagementSpatialandLBSNetworktopologyanalysisNeo4jandAndroidAgendaMostwidelydeployedgraphdbintheworldACID,persistent,embedded/serverRobust:24/7productionsince2003Mature:lotsofproductiondeploymentsScalable:HighAvailability,MasterfailoverCommunity:ecosystemoftools,bindings,frameworksProduct:OSGi,Spatial,RDF,languagesAvailableunderAGPLv3andascommercialproductButthefirstoneisfree!ForALLuse-cases.Links–Nodes,Relationships,PropertiesNodeshavedifferentpropertiesMatrixcharacters:Peoplevs.ProgramsBuildstructureasyougoWholovesNeo?BuildinganodespaceGraphDatabaseServicegraphDb=...//Getfactory//CreateThomas'Neo'AndersonNodemrAnderson=graphDb.createNode();mrAnderson.setProperty(name,ThomasAnderson);mrAnderson.setProperty(age,29);//CreateMorpheusNodemorpheus=graphDb.createNode();morpheus.setProperty(name,Morpheus);morpheus.setProperty(rank,Captain);morpheus.setProperty(occupation,Totalbadass);//CreatearelationshiprepresentingthattheyknoweachothermrAnderson.createRelationshipTo(morpheus,RelTypes.KNOWS);//...createTrinity,Cypher,AgentSmith,ArchitectsimilarlyBuildinganodespaceGraphDatabaseServicegraphDb=...//GetfactoryTransactiontx=graphdb.beginTx();//CreateThomas'Neo'AndersonNodemrAnderson=graphDb.createNode();mrAnderson.setProperty(name,ThomasAnderson);mrAnderson.setProperty(age,29);//CreateMorpheusNodemorpheus=graphDb.createNode();morpheus.setProperty(name,Morpheus);morpheus.setProperty(rank,Captain);morpheus.setProperty(occupation,Totalbadass);//CreatearelationshiprepresentingthattheyknoweachothermrAnderson.createRelationshipTo(morpheus,RelTypes.KNOWS);//...createTrinity,Cypher,AgentSmith,Architectsimilarlytx.commit();Code(2):Traversinganodespace//InstantiateatraverserthatreturnsMrAnderson'sfriendsTraverserfriendsTraverser=mrAnderson.traverse(Traverser.Order.BREADTH_FIRST,StopEvaluator.END_OF_GRAPH,ReturnableEvaluator.ALL_BUT_START_NODE,RelTypes.KNOWS,Direction.OUTGOING);//TraversethenodespaceandprintouttheresultSystem.out.println(MrAnderson'sfriends:);for(Nodefriend:friendsTraverser){System.out.printf(Atdepth%d=%s%n,friendsTraverser.currentPosition().getDepth(),friend.getProperty(name));}Rubygeminstallneo4jrequire”rubygems”require'neo4j'classPersonincludeNeo4j::NodeMixinproperty:name,:age,:occupationindex:namehas_n:friendsendNeo4j::Transactoin.rundoneo=Person.new:name='Neo',:age=29morpheus=Person.new:name='Morpheus',:occupation='badass'neo.friendsmorpheusendneo.friends.each{|p|...}Spatialandsocialdataname=“OmniHotel”lat=3492848long=28382342311length=7milesname=...lat,long=...name=“Swedland”lat=23410349long=2342348852331313ROADROOOADname=“TheTavern”lat=1295238237long=234823492length=3milesname=...7722ROADROADROADname=...4242ROADFinancialdata–frauddetectionname=“MrGodfather”karma=veeeery-lowcash=more-than-you11amount=$1000name=“Emil”cash=always-too-li'ltitle=“ATM@WallSt”id=230918484233cash_left=384204331313TRANSFERWITHDRAWname=“TheTavern”lat=1295238237long=234823492amount=$1000name=...7722OWNSDEPOSITTRANSFERname=...4242WITHDRAWCDRanalysisname=“MrGodfather”karma=veeeery-lowcash=more-than-you11time=2minname=“Emil”cash=always-too-li'lName=customer_support331313CALLEDCALLEDname=“Bob”lat=1295238237long=234823492time=13minname=Alice7722CALLEDCALLEDFAMILYname=flat_business4242DATA_PLANCallDataRecords(CDR)FormingagraphLocationbasedPossibleuses:Findclusters(betterplans)BuildsocialconnectionsFindinfluencersRoutingRoutingwithNeo4jandA*RoutingConnectingandSplittingRoutingSocialgraphsRecommendationsLocationbasedservicesInfluencersShortestpathRecommendationsandbiggraphsGlobalheuristicsPagerankLocalrecommendationsShortestpathsHammockfunctionsRandomwalksDijkstra,A*,ShootingstaretcGrammarbasedRandomWalksPicfromgremlin.tinkerpop.com/MarkoRodriguezImpact,DependencyAnalysisMasterDataManagementSpatialComplexdataMultipleindexing(domain,Spatial,temporal)LocationenteringmanydomainsGISgoingmainstream,topologiesexplodeNogoodsystemsoutthereProprietarystacksrule(ESRI,Oracle)OpenGovernmentDataShapefilessuck.CurrentchallengesinSpatialDomainandSpatialinterconnectionsUnstructureddomaindataRoutingTopologyhandlingNogoodOSSfullGISstackMultipleindexes-GISOpenStreetMapTheOpenStreetMapdatasetWikiforSpatialinfoFreelyavailabledataVeryunstructured,freetaggingPoints,Ways,Relations,Tags,ChangesetsChangescanbepushedbackUsedforotherpurposesGreatcoverageininterestingplaces(towns,disastersetc)OpenStreetMapOpenStreetMapWebexposureofSpatialDataDavideSavazziGeotools&GeoServerRoutinguDigGSoC2010-uDigNeo4jdynamiclayersLayer1Layer2Layer3GeometryEncoderDynamicQueryDynamicSty