forked from neo4j-documentation/developer-resources
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
2117 lines (1920 loc) · 126 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!doctype html> <!--[if IE 9]> <html class="no-js ie9" lang="en"> <![endif]--> <html class="no-js" lang="en"> <head> <meta charset="utf-8"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="msvalidate.01" content="8787022FB1E99E5BE4A2A32DAEB6B863"/> <link rel="shortcut icon" href="http://neo4j.com/wp-content/themes/neo4jweb/favicon.ico"/> <title>Developer - Neo4j Graph Database</title> <script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
//Allow Linker
ga('create', 'UA-1192232-34','auto', {'allowLinker': true});
ga('send', 'pageview');
// Load the plugin.
ga('require', 'linker');
// Define which domains to autoLink.
ga('linker:autoLink', ['neo4j.org','neo4j.com','neotechnology.com','graphdatabases.com','graphconnect.com']);
</script> <script type="text/javascript" id="inspectletjs">
window.__insp = window.__insp || [];
__insp.push(['wid', 656443939]);
(function() {
function ldinsp(){var insp = document.createElement('script'); insp.type = 'text/javascript'; insp.async = true; insp.id = "inspsync"; insp.src = ('https:' == document.location.protocol ? 'https' : 'http') + '://cdn.inspectlet.com/inspectlet.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(insp, x); };
document.readyState != "complete" ? (window.attachEvent ? window.attachEvent('onload', ldinsp) : window.addEventListener('load', ldinsp, false)) : ldinsp();
})();
</script> <script>
var _prum = [['id', '56c4c51eabe53da82429d2ab'],
['mark', 'firstbyte', (new Date()).getTime()]];
(function() {
var s = document.getElementsByTagName('script')[0]
, p = document.createElement('script');
p.async = 'async';
p.src = '//rum-static.pingdom.net/prum.min.js';
s.parentNode.insertBefore(p, s);
})();
</script> <meta name="description" content="Get Started with Neo4j. Access to developer resources featuring Cypher and use case examples, videos and Graphgists."/> <meta name="robots" content="noodp"/> <link rel="canonical" href="http://neo4j.com/developer/"/> <meta property="og:locale" content="en_US"/> <meta property="og:type" content="article"/> <meta property="og:title" content="(Neo4j)-[:LOVES]-(Developers)"/> <meta property="og:description" content="Get Started with Neo4j. Access to developer resources featuring Cypher and use case examples, videos and Graphgists."/> <meta property="og:url" content="http://neo4j.com/developer/"/> <meta property="og:site_name" content="Neo4j Graph Database"/> <meta property="article:publisher" content="https://www.facebook.com/neo4j.graph.database"/> <meta property="og:image" content="https://s3.amazonaws.com/dev.assets.neo4j.com/wp-content/uploads/20151130214721/Screen-Shot-2016-02-26-at-12.18.29-PM.png"/> <meta name="twitter:card" content="summary_large_image"/> <meta name="twitter:description" content="Get Started with Neo4j. Access to developer resources featuring Cypher and use case examples, videos and Graphgists."/> <meta name="twitter:title" content="Developer - Neo4j Graph Database"/> <meta name="twitter:site" content="@neo4j"/> <meta name="twitter:image" content="https://s3.amazonaws.com/dev.assets.neo4j.com/wp-content/uploads/20151130214721/Screen-Shot-2016-02-26-at-12.18.29-PM.png"/> <meta name="twitter:creator" content="@neo4j"/> <link rel="alternate" type="application/rss+xml" title="Neo4j Graph Database » Feed" href="http://neo4j.com/feed/"/> <link rel="alternate" type="application/rss+xml" title="Neo4j Graph Database » Comments Feed" href="http://neo4j.com/comments/feed/"/> <script type="text/javascript">
window._wpemojiSettings = {"baseUrl":"https:\/\/s.w.org\/images\/core\/emoji\/72x72\/","ext":".png","source":{"concatemoji":"http:\/\/neo4j.com\/wp-includes\/js\/wp-emoji-release.min.js?ver=4.5"}};
!function(a,b,c){function d(a){var c,d,e,f=b.createElement("canvas"),g=f.getContext&&f.getContext("2d"),h=String.fromCharCode;if(!g||!g.fillText)return!1;switch(g.textBaseline="top",g.font="600 32px Arial",a){case"flag":return g.fillText(h(55356,56806,55356,56826),0,0),f.toDataURL().length>3e3;case"diversity":return g.fillText(h(55356,57221),0,0),c=g.getImageData(16,16,1,1).data,g.fillText(h(55356,57221,55356,57343),0,0),c=g.getImageData(16,16,1,1).data,e=c[0]+","+c[1]+","+c[2]+","+c[3],d!==e;case"simple":return g.fillText(h(55357,56835),0,0),0!==g.getImageData(16,16,1,1).data[0];case"unicode8":return g.fillText(h(55356,57135),0,0),0!==g.getImageData(16,16,1,1).data[0]}return!1}function e(a){var c=b.createElement("script");c.src=a,c.type="text/javascript",b.getElementsByTagName("head")[0].appendChild(c)}var f,g,h,i;for(i=Array("simple","flag","unicode8","diversity"),c.supports={everything:!0,everythingExceptFlag:!0},h=0;h<i.length;h++)c.supports[i[h]]=d(i[h]),c.supports.everything=c.supports.everything&&c.supports[i[h]],"flag"!==i[h]&&(c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&c.supports[i[h]]);c.supports.everythingExceptFlag=c.supports.everythingExceptFlag&&!c.supports.flag,c.DOMReady=!1,c.readyCallback=function(){c.DOMReady=!0},c.supports.everything||(g=function(){c.readyCallback()},b.addEventListener?(b.addEventListener("DOMContentLoaded",g,!1),a.addEventListener("load",g,!1)):(a.attachEvent("onload",g),b.attachEvent("onreadystatechange",function(){"complete"===b.readyState&&c.readyCallback()})),f=c.source||{},f.concatemoji?e(f.concatemoji):f.wpemoji&&f.twemoji&&(e(f.twemoji),e(f.wpemoji)))}(window,document,window._wpemojiSettings);
</script> <style type="text/css"> img.wp-smiley, img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important; } </style> <link rel='stylesheet' id='cookielawinfo-style-css' href="http://neo4j.com/wp-content/plugins/cookie-law-info/css/cli-style.css?ver=1.5.3" type='text/css' media='all'/> <link rel='stylesheet' id='font-awesome-four-css' href="http://neo4j.com/wp-content/plugins/font-awesome-4-menus/css/font-awesome.min.css?ver=4.5.0" type='text/css' media='all'/> <link rel='stylesheet' id='foundation-css' href="http://neo4j.com/wp-content/themes/neo4jweb/assets/css/app.css?ver=2016.03.02" type='text/css' media='screen'/> <link rel='stylesheet' id='neo-codemirror-css' href="http://neo4j.com/wp-content/themes/neo4jweb/assets/css/codemirror-neo.css?ver=4.5" type='text/css' media='screen'/> <script type='text/javascript'>
/* <![CDATA[ */
var ajax_object = {"ajaxurl":"http:\/\/neo4j.com\/wp-admin\/admin-ajax.php"};
/* ]]> */
</script> <script type='text/javascript' src='http://neo4j.com/wp-content/plugins/neo4j-download/js/download.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/plugins/jquery-updater/js/jquery-2.2.3.min.js?ver=2.2.3'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/plugins/cookie-law-info/js/cookielawinfo.js?ver=1.5.3'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/plugins/jquery-updater/js/jquery-migrate-1.3.0.min.js?ver=1.3.0'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/vendor/modernizr.min.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/foundation.min.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/vendor/codemirror.min.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/neo_codemirror.js?ver=4.5'></script> <script type='text/javascript' src='//use.typekit.net/rdt4xku.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/misc.js?ver=4.5'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/bundle.js?ver=2016.03.11'></script> <script type='text/javascript' src='http://neo4j.com/wp-content/themes/neo4jweb/assets/js/neo_calculator_v3.js?ver=4.5'></script> <link rel='https://api.w.org/' href="http://neo4j.com/wp-json/"/> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://neo4j.com/xmlrpc.php?rsd"/> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://neo4j.com/wp-includes/wlwmanifest.xml"/> <meta name="generator" content="WordPress 4.5"/> <link rel='shortlink' href="http://neo4j.com/?p=50818"/> <link rel="alternate" type="application/json+oembed" href="http://neo4j.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fneo4j.com%2Fdeveloper%2F"/> <link rel="alternate" type="text/xml+oembed" href="http://neo4j.com/wp-json/oembed/1.0/embed?url=http%3A%2F%2Fneo4j.com%2Fdeveloper%2F&format=xml"/> </head> <body> <header role="banner"> <div class="container"> <div class="row"> <div id="nav-position" class="columns"> <a class="skip-link" href="#content">Skip to Content</a> </div> </div> </div> <div class="top-bar-container contain-to-grid show-for-medium-up"> <nav class="top-bar secondary-nav" role="navigation"> <h2 class="show-for-sr">Quick Links</h2> <section class="top-bar-section"> <ul id="menu-top-nav" class="top-bar-menu right"><li id="menu-item-38286" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-38286"><a href="http://neo4j.com/blog/">Blog</a></li> <li id="menu-item-38817" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-38817"><a href="//support.neo4j.com/hc/">Support</a></li> <li id="menu-item-53859" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-53859"><a href="http://neo4j.com/contact-us/">Contact Us</a></li> <li id="menu-item-36921" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36921"><a href="http://neo4j.com/download/">Download Neo4j</a></li> </ul> </section> </nav> </div> <div class="top-bar-container contain-to-grid sticky"> <nav class="top-bar" data-topbar role="navigation"> <h2 class="show-for-sr">Main Navigation</h2> <ul class="title-area"> <li class="name"> <h1><a href="http://neo4j.com/"><img src="http://neo4j.com/wp-content/themes/neo4jweb/assets/images/neo4j-logo-2015.png" alt="Neo4j Home"/></a></h1> </li> <li class="toggle-topbar menu-icon"><a href="#"><span class="show-for-sr">Menu</span></a></li> </ul> <section class="top-bar-section"> <ul class="right"> <li class="has-dropdown megamenu"> <a href="/product/">Products</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> <div class="medium-4 nav-menu-widget columns"><li><label>Neo4j Graph Database</label></li><div class="menu-product-menu-1-container"><ul id="menu-product-menu-1" class="menu"><li id="menu-item-51974" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51974"><a href="http://neo4j.com/product/">What is Neo4j?</a></li> <li id="menu-item-51868" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51868"><a href="/whats-new-in-neo4j-2-3/">What’s New in Neo4j</a></li> <li id="menu-item-51869" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51869"><a href="/top-ten-reasons/">Why Neo4j?</a></li> <li id="menu-item-51870" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51870"><a href="/open-source-project/">Open Source</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>Neo4j for the Enterprise</label></li><div class="menu-product-menu-2-container"><ul id="menu-product-menu-2" class="menu"><li id="menu-item-51871" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51871"><a href="/licensing/">Licensing</a></li> <li id="menu-item-51872" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51872"><a href="/editions/">Compare Editions</a></li> <li id="menu-item-51873" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51873"><a href="/subscriptions/">Subscriptions</a></li> <li id="menu-item-51874" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51874"><a href="/professional-services/">Professional Services</a></li> </ul></div></div> </div> </div> </ul> </li> <li class="has-dropdown megameu"> <a href="/use-cases/">Solutions</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> <div class="medium-4 nav-menu-widget columns"><li><label>by Use Case</label></li><div class="menu-solution-menu-1-container"><ul id="menu-solution-menu-1" class="menu"><li id="menu-item-51875" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51875"><a href="/use-cases/fraud-detection/">Fraud Detection</a></li> <li id="menu-item-51876" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51876"><a href="/use-cases/graph-based-search/">Graph Based Search</a></li> <li id="menu-item-51877" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51877"><a href="/use-cases/identity-and-access-management/">Identity and Access</a></li> <li id="menu-item-51878" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51878"><a href="/use-cases/master-data-management/">Master Data Management</a></li> <li id="menu-item-51879" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51879"><a href="/use-cases/network-and-it-operations/">Network and IT Operations</a></li> <li id="menu-item-51880" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51880"><a href="/use-cases/real-time-recommendation-engine/">Recommendation Engine</a></li> <li id="menu-item-51881" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51881"><a href="/use-cases/social-network/">Social Network</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>by Technology</label></li><div class="menu-solution-menu-2-container"><ul id="menu-solution-menu-2" class="menu"><li id="menu-item-51882" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51882"><a href="http://neo4j.com/neo4j-on-ibm-power8/">Neo4j on IBM POWER8</a></li> <li id="menu-item-51883" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51883"><a href="http://neo4j.com/graph-visualization-neo4j/">Graph Visualization</a></li> </ul></div></div> </div> </div> </ul> </li> <li class="has-dropdown megamenu"> <a href="/partners/">Partners</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> <div class="medium-4 nav-menu-widget columns"><li><label>Neo4j Partner Program</label></li><div class="menu-partners-menu-1-container"><ul id="menu-partners-menu-1" class="menu"><li id="menu-item-51864" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51864"><a href="http://neo4j.com/partners/">Find a Partner</a></li> <li id="menu-item-53714" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-53714"><a href="http://neo4j.com/neo4j-partner-program/">Become a Neo4j Partner</a></li> <li id="menu-item-51865" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51865"><a href="http://neo4j.com/partners/oem-partner/">OEM Partner</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>Partner Portal</label></li><div class="menu-partners-menu-2-container"><ul id="menu-partners-menu-2" class="menu"><li id="menu-item-51867" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51867"><a href="http://partner.neo4j.com/">Access the Portal</a></li> </ul></div></div> </div> </div> </ul> </li> <li class="has-dropdown megamenu"> <a href="/customers/">Customers</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> </div> </div> </ul> </li> <li class="has-dropdown"> <a href="/graphacademy/">Learn</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> <div class="medium-4 nav-menu-widget columns"><li><label>Learn Neo4j</label></li><div class="menu-learn-menu-1-container"><ul id="menu-learn-menu-1" class="menu"><li id="menu-item-51850" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51850"><a href="/graphacademy/">GraphAcademy</a></li> <li id="menu-item-51851" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51851"><a href="http://neo4j.com/graphacademy/online-training/">Online Training</a></li> <li id="menu-item-51852" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51852"><a href="/graphacademy/neo4j-certification/">Neo4j Certification</a></li> <li id="menu-item-51853" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51853"><a href="/books/">Books</a></li> <li id="menu-item-51854" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51854"><a href="http://neo4j.com/resources/">Neo4j Resources</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>Learn Graph Databases</label></li><div class="menu-learn-menu-2-container"><ul id="menu-learn-menu-2" class="menu"><li id="menu-item-51855" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51855"><a href="/why-graph-databases/">Why Graph Databases?</a></li> <li id="menu-item-51856" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51856"><a href="graph-db-vs-rdbms/">Graph Database vs RDBMS</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>Events</label></li><div class="menu-learn-menu-3-container"><ul id="menu-learn-menu-3" class="menu"><li id="menu-item-51857" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51857"><a href="/events/">Calendar</a></li> <li id="menu-item-51858" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51858"><a href="http://neo4j.com/webinars/">Neo4j Webinars</a></li> <li id="menu-item-51859" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51859"><a href="/graphdays/">GraphDays</a></li> <li id="menu-item-52468" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-52468"><a href="http://neo4j.com/graphtalks/">GraphTalks</a></li> <li id="menu-item-51860" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51860"><a href="http://graphconnect.com/">GraphConnect</a></li> </ul></div></div> </div> </div> </ul> </li> <li class="has-dropdown"> <a href="./">Developers</a> <ul class="sub-menu dropdown dropdown-wrapper"> <div class="header-widgets-container"> <div class="row"> <div class="medium-4 nav-menu-widget columns"><li><label>Developer Guides</label></li><div class="menu-developers-menu-1-container"><ul id="menu-developers-menu-1" class="menu"><li id="menu-item-51828" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51828"><a href="get-started/">Get Started</a></li> <li id="menu-item-51829" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51829"><a href="cypher/">Cypher Query Language</a></li> <li id="menu-item-51830" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51830"><a href="data-modeling/">Data Modeling</a></li> <li id="menu-item-51831" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51831"><a href="language-guides/">Language Drivers</a></li> <li id="menu-item-51832" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51832"><a href="integration/">Tools & Integration</a></li> <li id="menu-item-51833" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-51833"><a href="in-production/">Neo4j in Production</a></li> </ul></div></div><div class="medium-4 nav-menu-widget columns"><li><label>Developer Resources</label></li><div class="menu-developers-menu-2-container"><ul id="menu-developers-menu-2" class="menu"><li id="menu-item-52106" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-52106"><a href="http://neo4j.com/docs/">Documentation</a></li> <li id="menu-item-53223" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-53223"><a href="http://neo4j.com/community/">Community</a></li> <li id="menu-item-51835" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51835"><a href="http://neo4j.com/sandbox/">Sandbox</a></li> <li id="menu-item-51836" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-51836"><a href="http://neo4j.com/graphgists/">GraphGists</a></li> </ul></div></div> </div> </div> </ul> </li> <div class="nav-secondary-mobile"> <hr/> <ul id="menu-top-nav-1" class="top-bar-menu right"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-38286"><a href="http://neo4j.com/blog/">Blog</a></li> <li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-38817"><a href="//support.neo4j.com/hc/">Support</a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-53859"><a href="http://neo4j.com/contact-us/">Contact Us</a></li> <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-36921"><a href="http://neo4j.com/download/">Download Neo4j</a></li> </ul> </div> <li class="has-form"> <form role="search" method="get" id="searchform" class="searchform" action="http://neo4j.com/"> <label class="show-for-sr">Search Terms</label> <input type="text" name="s" id="s" placeholder="Search"/> <input type="image" id="searchsubmit" width="20px" src="http://neo4j.com/wp-content/themes/neo4jweb/assets/images/search-icon.svg" alt="Submit Search"/> </form> </li> </ul> </section> </nav> </div> </header> <div class="developer">
<section class="main-stage">
<div class="row main-stage-show">
<div class="small-12 medium-8 large-5 columns text-center">
<h2 style="font-family: Menlo, Monaco, Consolas, 'Courier New', Terminal, monospace">(Neo4j)-[:LOVES]-(Developers)</h2>
<h2>World's leading graph database, with native graph storage and processing.</h2>
<h2>Property graph model and Cypher query language makes it easy to understand.</h2>
<h2><b>Fast. Natural. Fun.</b></h2>
</div>
<div class="small-12 medium-4 large-7 show-for-large-up columns text-right">
<div id="developer-main-stage-data-viz">
<div class="node-group node-0">
<div class="node">33.5K</div>
<div class="data">
<div class="num">33.5K</div>
<a href="http://neo4j.meetup.com/">Meetup group members <i class="fa fa-long-arrow-right fa-2"></i></a>
</div>
</div>
<div class="node-group node-1">
<div class="node">38.5K</div>
<div class="data">
<div class="num">38.5K</div>
<a href="https://github.com/neo4j/neo4j">commits to the Neo4j core <i class="fa fa-long-arrow-right fa-2"></i></a>
</div>
</div>
<div class="node-group node-2">
<div class="node">29K</div>
<div class="data">
<div class="num">29K</div>
<a href="http://neo4j.com/graphacademy/">people have taken the neo4j training <i class="fa fa-long-arrow-right fa-2"></i></a>
</div>
</div>
<div class="node-group node-3">
<div class="node">2M</div>
<div class="data">
<div class="num">2M+</div>
<a href="http://neo4j.com/download/">Downloads <i class="fa fa-long-arrow-right fa-2"></i></div>
</div>
<div class="node-group node-4">
<div class="node">100K</div>
<div class="data">
<div class="num">100K</div>
<a href="http://twitter.com/neo4j">tweets per year <i class="fa fa-long-arrow-right fa-2"></i></a>
</div>
</div>
</div>
</div>
</div>
<div class="row main-stage-buttons">
<div class="small-12 medium-4 columns text-center">
<a href="/download/" class="button expand btn-download">Download</a>
</div>
<div class="small-12 medium-4 columns text-center">
<a href="/sandbox/" class="button expand btn-sandbox">Sandbox</a>
</div>
<div class="small-12 medium-4 columns text-center">
<a href="/developer/get-started/" class="button expand btn-docs">Docs</a>
</div>
</div>
</section>
<style>
ol.install-instructions {
color: white;
}
ol.install-instructions code {
font-size: 5px;
}
ol.install-instructions a {
color: white;
text-decoration: underline
}
.cypher-query {
padding-top: 10px;
padding-bottom: 15px;
font-size: 120%;
}
</style>
<script type="text/javascript">
var vis_options = {
groups: {
people_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf007',
size: 50,
color: '#fd756e'
}
},
people: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf007',
size: 50,
color: '#68bbf4'
}
},
server: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf233',
size: 50,
color: '#68bbf4'
}
},
server_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf233',
size: 50,
color: '#fd756e'
}
},
disk: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf1c0',
size: 50,
color: '#68bbf4'
}
},
disk_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf1c0',
size: 50,
color: '#fd756e'
}
},
code: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf121',
size: 50,
color: '#68bbf4'
}
},
code_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf121',
size: 50,
color: '#fd756e'
}
},
account: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf19c',
size: 50,
color: '#68bbf4'
}
},
account_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf19c',
size: 50,
color: '#fd756e'
}
},
SSN: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf292',
size: 50,
color: '#68bbf4'
}
},
SSN_highlighted: {
shape: 'icon',
icon: {
face: 'FontAwesome',
code: '\uf292',
size: 50,
color: '#fd756e'
}
},
},
edges: {
arrows: {to: {scaleFactor: 0.5}},
font: {align: 'bottom', face: 'courier', strokeWidth: 2, color: '#666666'},
color: "#6dcc9c",
width: 3
},
nodes: {
shape: 'dot',
size: 20,
font: {
size: 16,
color: '#000000'
},
borderWidth: 2
},
interaction: {
zoomView: false,
}
};
function renderGraph(event) {
var el = $("#sample-" + event.data.usecase + " .console")[event.data.index];
$.getJSON("./viz/" + event.data.usecase + "." + event.data.index + ".viz.json", function(d) {
d.nodes.forEach(function (n) {
n.title = n.label;
if (n.label == 'Person-Highlighted') {
n.group = 'people_highlighted';
n.label = n.name;
} else if (n.label == 'Person') {
n.group = 'people';
n.label = n.name;
} else if (n.label == 'Server') {
n.group = 'server';
n.label = n.name;
} else if (n.label == 'Disk') {
n.group = 'disk';
n.label = n.name;
} else if (n.label == 'Disk-Highlighted') {
n.group = 'disk_highlighted';
n.label = n.name;
} else if (n.label == 'Code') {
n.group = 'code';
n.label = n.name;
} else if (n.label == 'Code-Highlighted') {
n.group = 'code_highlighted';
n.label = n.name;
} else if (n.label == 'Server-Highlighted') {
n.group = 'server_highlighted';
n.label = n.name;
} else if (n.label == 'Account') {
n.group = 'account';
n.label = n.name;
} else if (n.label == 'SSN') {
n.group = 'SSN';
n.label = n.name;
} else if (n.label == 'Account-Highlighted') {
n.group = 'account_highlighted';
n.label = n.name;
} else if (n.label == 'SSN-Highlighted') {
n.group = 'SSN_highlighted';
n.label = n.name;
}
});
d.links.forEach(function (l) {
if (l.label && l.label == 'KNOWS-HIGHLIGHTED') {
l.color = '#fd756e';
l.label = 'KNOWS';
}
});
var g = {
nodes: d.nodes,
edges: d.links
};
var network = new vis.Network(el, g, vis_options);
});
};
$(document).ready(function() {
// social
$('#social-friends').click({usecase: 'social', index: 0}, renderGraph);
$('#social-common').click({usecase: 'social', index: 1}, renderGraph);
$('#social-paths').click({usecase: 'social', index: 2}, renderGraph);
// network
$('#network-main').click({usecase: 'network', index: 0}, renderGraph);
$('#network-impact').click({usecase: 'network', index: 0}, renderGraph);
$('#network-dependency').click({usecase: 'network', index: 1}, renderGraph);
$('#network-statistics').click({usecase: 'network', index: 2}, renderGraph);
// fraud
$('#fraud-main').click({usecase: 'fraud', index: 0}, renderGraph);
$('#fraud-transitive').click({usecase: 'fraud', index: 0}, renderGraph);
$('#fraud-investigation').click({usecase: 'fraud', index: 1}, renderGraph);
$('#fraud-insights').click({usecase: 'fraud', index: 2}, renderGraph);
$(".contact-button").click(function(e) {
window.location = "http://info.neotechnology.com/ContactUs.html"
});
$.each(["social","network","fraud"], function(i, usecase) {
$("#sample-" + usecase + " .runnable-example").each(function(i, runnable) {
var frag = $(runnable).attr("frag");
$.get("./viz/" + usecase + ".frag" + frag + ".txt", function(d) {
CodeMirror.colorize($(".cypher-query", runnable).text(d));
//CodeMirror.colorize($("#foo"));
//CodeMirror.runMode(d, 'application/x-cypher-query', $(".cypher-query"));
});
$(".run-example", runnable).click(function(e) {
});
});
});
// trigger first tabs displayed
$('#social-friends').trigger("click");
$('#network-impact').trigger("click");
$('#fraud-transitive').trigger("click");
});
</script>
<section class="test-drive show-for-large-up">
<div class="row">
<div class="small-12 columns">
<h2>Test-Drive Neo4j with Cypher</h2>
<dl class="tabs" data-tab role="tablist">
<dd class="tab-title active" role="presentation"><a href="#sample-social" role="tab" tabindex="0" aria-selected="true" aria-controls="sample-social">Social</a></dd>
<dd class="tab-title" role="presentation"><a href="#sample-network" role="tab" tabindex="0" aria-selected="false" aria-controls="sample-network" id="network-main">Network Management</a></dd>
<dd class="tab-title" role="presentation"><a href="#sample-fraud" role="tab" tabindex="0" aria-selected="false" aria-controls="sample-fraud" id="fraud-main">Fraud Detection</a></dd>
</dl>
<div class="tabs-content">
<section role="tabpanel" aria-hidden="false" class="content active" id="sample-social">
<dl class="tabs minimalist" data-tab role="tablist">
<dd class="tab-title active" role="presentation"><a href="#friends" role="tab" tabindex="0" aria-selected="true" aria-controls="friends" id="social-friends">Friends of Friends</a></dd>
<dd class="tab-title" role="presentation"><a href="#common" role="tab" tabindex="0" aria-selected="false" aria-controls="common" id="social-common">Common Friends</a></dd>
<dd class="tab-title" role="presentation"><a href="#paths" role="tab" tabindex="0" aria-selected="false" aria-controls="paths" id="social-paths">Connecting Paths</a></dd>
</dl>
<div class="tabs-content">
<section role="tabpanel" aria-hidden="false" aria-selected="true" class="content active gexample" id="friends">
<div class="demo runnable-example row" frag="0">
<div class="small-6 columns">
<h3>
Friends of Friends
</h3>
<p>Find all of Joe's second-degree friends</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>Joe knows Sally, and Sally knows Anna. Bob is excluded from the result because, in addition to being a 2nd-degree friend through Sally, he's also a first-degree friend.</p>
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content gexample" id="common">
<div class="demo runnable-example row" frag="1">
<div class="small-6 columns">
<h3>
Common Friends
</h3>
<p>Find friends in common between Joe and Sally</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>Joe and Sally both know Bob.<br /><br /><br /></p>
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content gexample" id="paths">
<div class="demo runnable-example row" frag="2">
<div class="small-6 columns">
<h3>
Connecting Paths
</h3>
<p>Find all paths, up to 6 degrees, between Joe and Billy</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>There's actually only one path between Joe and Billy in this dataset, so that path is returned.<br /><br /><br /></p>
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<dl class="tabs dark" data-tab role="tablist">
<dd class="tab-title no-click" role="presentation">See Code In:</dd>
<dd class="tab-title" role="presentation"><a href="#java" role="tab" tabindex="0" aria-selected="false" aria-controls="java">Java</a></dd>
<dd class="tab-title" role="presentation"><a href="#python" role="tab" tabindex="0" aria-selected="false" aria-controls="python">Python</a></dd>
<dd class="tab-title" role="presentation"><a href="#ruby" role="tab" tabindex="0" aria-selected="false" aria-controls="ruby">Ruby</a></dd>
<dd class="tab-title" role="presentation"><a href="#php" role="tab" tabindex="0" aria-selected="true" aria-controls="php">PHP</a></dd>
<dd class="tab-title" role="presentation"><a href="#cs" role="tab" tabindex="0" aria-selected="false" aria-controls="c#">C#</a></dd>
<dd class="tab-title" role="presentation"><a href="#node" role="tab" tabindex="0" aria-selected="false" aria-controls="node#">Javascript</a></dd>
</dl>
<div class="tabs-content dark">
<section role="tabpanel" aria-hidden="false" class="content" id="php">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-php">
<?php
/**
* To install Neo4j-PHP-Client, we use Composer
*
* $ curl -sS https://getcomposer.org/installer | php
* $ php composer.phar require graphaware/neo4j-php-client
*
*/
require __DIR__.'/vendor/autoload.php';
use GraphAware\Neo4j\Client\ClientBuilder;
// change to your hostname, port, username, password
$neo4j_url = "bolt://neo4j:password@localhost";
// setup connection
$client = ClientBuilder::create()
->addConnection('default', $neo4j_url)
->build();
// setup data
$insert_query = <<<EOQ
UNWIND {pairs} as pair
MERGE (p1:Person {name:pair[0]})
MERGE (p2:Person {name:pair[1]})
MERGE (p1)-[:KNOWS]-(p2);
EOQ;
// friend data to insert
$data = [["Jim","Mike"],["Jim","Billy"],["Anna","Jim"],
["Anna","Mike"],["Sally","Anna"],["Joe","Sally"],
["Joe","Bob"],["Bob","Sally"]];
// insert data
$client->run($insert_query, ["pairs" => $data]);
// friend of friend: query
$foaf_query = <<<EOQ
MATCH (person:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf)
WHERE person.name = {name}
AND NOT (person)-[:KNOWS]-(foaf)
RETURN foaf.name AS name
EOQ;
// friend of friend: build and execute query
$params = ['name' => 'Joe'];
$result = $client->run($foaf_query, $params);
foreach ($result->records() as $record) {
echo $record->get('name') . PHP_EOL;
}
// common friends: query
$common_friends_query = <<<EOQ
MATCH (user:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf:Person)
WHERE user.name = {user} AND foaf.name = {foaf}
RETURN friend.name AS friend
EOQ;
// common friends: build and execute query
$params = ['user' => 'Joe', 'foaf' => 'Sally'];
$result = $client->run($common_friends_query, $params);
foreach ($result->records() as $record) {
echo $record->get('friend') . PHP_EOL;
}
// connecting paths: query
$connecting_paths_query = <<<EOQ
MATCH path = shortestPath((p1:Person)-[:KNOWS*..6]-(p2:Person))
WHERE p1.name = {name1} AND p2.name = {name2}
RETURN [n IN nodes(path) | n.name] as names
EOQ;
// connecting paths: build and execute query
$params = ['name1' => 'Joe', 'name2' => 'Billy'];
$result = $client->run($connecting_paths_query, $params);
foreach ($result->records() as $record) {
print_r($record->get('names'));
}
</code>
</pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing PHP</h3>
<p><ol class="install-instructions">
<li><a href="https://getcomposer.org/download/">Install Composer</a> from within web directory: <code>$ curl -sS https://getcomposer.org/installer | php</code></li>
<li><a href="https://github.com/graphaware/neo4j-php-client">Install Neo4j-PHP-Client</a> from within web directory: <code>$ php composer.phar require neoxygen/neoclient</code></li>
<li>Copy and paste code at left into php file and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="java">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-java">
// javac -cp neo4j-java-driver*.jar:. Network.java
// java -cp neo4j-java-driver*.jar:. Network
import org.neo4j.driver.v1.*;
import static org.neo4j.driver.v1.Values.parameters;
import java.util.List;
import static java.util.Arrays.asList;
import static java.util.Collections.singletonMap;
public class Social {
public static void main(String...args) {
Config noSSL = Config.build().withEncryptionLevel(Config.EncryptionLevel.NONE).toConfig();
Driver driver = GraphDatabase.driver("bolt://localhost",AuthTokens.basic("neo4j","test"),noSSL); // <password>
try (Session session = driver.session()) {
List data =
asList(asList("Jim","Mike"),asList("Jim","Billy"),asList("Anna","Jim"),
asList("Anna","Mike"),asList("Sally","Anna"),asList("Joe","Sally"),
asList("Joe","Bob"),asList("Bob","Sally"));
String insertQuery = "UNWIND {pairs} as pair " +
"MERGE (p1:Person {name:pair[0]}) " +
"MERGE (p2:Person {name:pair[1]}) " +
"MERGE (p1)-[:KNOWS]-(p2);";
session.run(insertQuery,singletonMap("pairs",data)).consume();
StatementResult result;
String foafQuery =
" MATCH (person:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf) "+
" WHERE person.name = {name} " +
" AND NOT (person)-[:KNOWS]-(foaf) " +
" RETURN foaf.name AS name ";
result = session.run(foafQuery, parameters("name","Joe"));
while (result.hasNext()) System.out.println(result.next().get("name"));
String commonFriendsQuery =
"MATCH (user:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf:Person) " +
" WHERE user.name = {from} AND foaf.name = {to} " +
" RETURN friend.name AS friend";
result = session.run(commonFriendsQuery, parameters("from","Joe","to","Sally"));
while (result.hasNext()) System.out.println(result.next().get("friend"));
String connectingPathsQuery =
"MATCH path = shortestPath((p1:Person)-[:KNOWS*..6]-(p2:Person)) " +
" WHERE p1.name = {from} AND p2.name = {to} " +
" RETURN [n IN nodes(path) | n.name] as names";
result = session.run(connectingPathsQuery, parameters("from","Joe","to","Billy"));
while (result.hasNext()) System.out.println(result.next().get("names"));
}
}
}
</code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Java</h3>
<p><ol class="install-instructions">
<li><a href="http://search.maven.org/#artifactdetails|org.neo4j.driver|neo4j-java-driver|1.0.0|jar">Download Neo4j Driver</a> </li>
<li>Copy and paste code at left into <code>Social.java</code></li>
<li>Run <code>javac -cp neo4j-java-driver-1.0.0.jar Social.java</code></li>
<li>Run <code>java -cp neo4j-java-driver-1.0.0.jar:. Social</code></li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="python">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-python">
# pip install neo4j-driver
from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "<password>"))
session = driver.session()
# Insert data
insert_query = '''
UNWIND {pairs} as pair
MERGE (p1:Person {name:pair[0]})
MERGE (p2:Person {name:pair[1]})
MERGE (p1)-[:KNOWS]-(p2);
'''
data = [["Jim","Mike"],["Jim","Billy"],["Anna","Jim"],
["Anna","Mike"],["Sally","Anna"],["Joe","Sally"],
["Joe","Bob"],["Bob","Sally"]]
session.run(insert_query, parameters={"pairs": data})
# Friends of a friend
foaf_query = '''
MATCH (person:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf)
WHERE person.name = {name}
AND NOT (person)-[:KNOWS]-(foaf)
RETURN foaf.name AS name
'''
results = session.run(foaf_query, parameters={"name": "Joe"})
for record in results:
print(record["name"])
# Common friends
common_friends_query = """
MATCH (user:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf:Person)
WHERE user.name = {user} AND foaf.name = {foaf}
RETURN friend.name AS friend
"""
results = session.run(common_friends_query, parameters={"user": "Joe", "foaf": "Sally"})
for record in results:
print(record["friend"])
# Connecting paths
connecting_paths_query = """
MATCH path = shortestPath((p1:Person)-[:KNOWS*..6]-(p2:Person))
WHERE p1.name = {name1} AND p2.name = {name2}
RETURN path
"""
results = session.run(connecting_paths_query, parameters={"name1": "Joe", "name2": "Billy"})
for record in results:
print (record["path"])
session.close()
</code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Python</h3>
<p><ol class="install-instructions">
<li><a href="https://github.com/neo4j/neo4j-python-driver">Install neo4j-python-driver</a> using pip: <code>$ pip install neo4j-driver</code></li>
<li>Copy and paste code at left into py file and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="ruby">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-ruby"><?php $page = file_get_contents(get_template_directory() . "/includes/social-page.rb.txt"); print htmlspecialchars($page); ?></code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Ruby</h3>
<p><ol class="install-instructions">
<li><a href="http://neo4jrb.io/">Install Neo4j.rb</a> using gem: <code>$ gem install neo4j-core</code></li>
<li>Copy and paste code at left into rb file and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="cs">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-csharp"><?php $page = file_get_contents(get_template_directory() . "/includes/social-page.cs.txt"); print htmlspecialchars($page); ?></code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing C#</h3>
<p><ol class="install-instructions">
<li><a href="https://dist.nuget.org/index.html">Install NuGet</a> </li>
<li>Run the NuGet Package Manager Console</li>
<li>Install the <a href="http://www.nuget.org/packages/Neo4jClient">Neo4jClient package</a>: <code>PM> Install-Package Neo4jClient</code></li>
<li>Copy and paste code at left into your .NET project, build, and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="node">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-javascript">
// npm install neo4j-driver
var neo4j = require('neo4j-driver').v1;
var driver = neo4j.driver("bolt://localhost", neo4j.auth.basic("neo4j", "<password>"));
var session = driver.session();
var queryCount = 0;
var insertQuery =
"UNWIND {pairs} as pair \
MERGE (p1:Person {name:pair[0]}) \
MERGE (p2:Person {name:pair[1]}) \
MERGE (p1)-[:KNOWS]-(p2)";
var foafQuery =
"MATCH (person:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf) \
WHERE person.name = {name} \
AND NOT (person)-[:KNOWS]-(foaf) \
RETURN foaf.name AS name";
var commonFriendsQuery =
"MATCH (user:Person)-[:KNOWS]-(friend)-[:KNOWS]-(foaf:Person) \
WHERE user.name = {name1} AND foaf.name = {name2} \
RETURN friend.name AS friend";
var connectingPathsQuery =
"MATCH path = shortestPath((p1:Person)-[:KNOWS*..6]-(p2:Person)) \
WHERE p1.name = {name1} AND p2.name = {name2} \
RETURN [n IN nodes(path) | n.name] as names";
var data = [["Jim","Mike"],["Jim","Billy"],["Anna","Jim"],
["Anna","Mike"],["Sally","Anna"],["Joe","Sally"],
["Joe","Bob"],["Bob","Sally"]];
function query(query, params, message, column) {
session
.run(query, params)
.then(function(result) {
console.log(message);
result.records.forEach(function(record) {
console.log(record.get(column));
});
queryCount += 1;
if (queryCount > 2) {
session.close();
process.exit();
}
})
.catch(function(error){
console.log(error);
});
}
session
.run(insertQuery, {pairs: data})
.then(function(result) {
query(foafQuery, {name: "Joe"}, "Friends of friends of Joe: ", "name");
query(commonFriendsQuery, {name1: "Joe", name2: "Sally"}, "Common friends", "friend");
query(connectingPathsQuery, {name1: "Joe", name2:"Billy"}, "Connecting paths: ", "names");
})
.catch(function(error) {
console.log(error);
});
</code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Javascript</h3>
<p><ol class="install-instructions">
<li><a href="https://github.com/neo4j/neo4j-javascript-driver">Install neo4j-driver</a> using npm: <code>$ npm install --save neo4j-driver</code></li>
<li>Copy and paste code at left into js file and run</li>
</ol></p>
</div>
</div>
</section>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="sample-network">
<dl class="tabs minimalist" data-tab role="tablist">
<dd class="tab-title active" role="presentation"><a href="#impact" role="tab" tabindex="0" aria-selected="true" aria-controls="impact" id="network-impact">Impact Analysis</a></dd>
<dd class="tab-title" role="presentation"><a href="#dependency" role="tab" tabindex="0" aria-selected="false" aria-controls="dependency" id="network-dependency">Dependency Analysis</a></dd>
<dd class="tab-title" role="presentation"><a href="#statistics" role="tab" tabindex="0" aria-selected="false" aria-controls="statistics" id="network-statistics">Statistics</a></dd>
</dl>
<div class="tabs-content">
<section role="tabpanel" aria-hidden="false" aria-selected="true" class="content active gexample" id="impact">
<div class="demo runnable-example row" frag="0">
<div class="small-6 columns">
<h3>
Impact Analysis
</h3>
<p>Find all services that depend on Server 1. These would be impacted by an outage of that server.</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>Only Webserver VM depends on Server 1. Because we're looking at variable length paths of DEPENDS_ON relationships, we're also able to determine that Public Website would be impacted by an outage of Server 1.
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content gexample" id="dependency">
<div class="demo runnable-example row" frag="1">
<div class="small-6 columns">
<h3>
Dependency Analysis
</h3>
<p>Find all services which the Public Website depends on to be operational.</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>The Public Website depends on the Database VM and the Webserver VM, which each depend on other services.</p>
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content gexample" id="statistics">
<div class="demo runnable-example row" frag="2">
<div class="small-6 columns">
<h3>
Statistics
</h3>
<p>Find the most depended-upon component</p>
<pre class="cypher-query cm-s-neo" data-lang="cypher">
</pre>
<p>As is the case in many data centers, the SAN is the most depended upon component. All six other services directly or indirectly depend on it.</p>
</div>
<div class="small-6 columns">
<div class="console"></div>
</div>
</div>
</section>
<dl class="tabs dark" data-tab role="tablist">
<dd class="tab-title no-click" role="presentation">See Code In:</dd>
<dd class="tab-title" role="presentation"><a href="#java" role="tab" tabindex="0" aria-selected="false" aria-controls="java">Java</a></dd>
<dd class="tab-title" role="presentation"><a href="#python" role="tab" tabindex="0" aria-selected="false" aria-controls="python">Python</a></dd>
<dd class="tab-title" role="presentation"><a href="#ruby" role="tab" tabindex="0" aria-selected="false" aria-controls="ruby">Ruby</a></dd>
<dd class="tab-title" role="presentation"><a href="#php" role="tab" tabindex="0" aria-selected="true" aria-controls="php">PHP</a></dd>
<dd class="tab-title" role="presentation"><a href="#cs" role="tab" tabindex="0" aria-selected="false" aria-controls="c#">C#</a></dd>
<dd class="tab-title" role="presentation"><a href="#node" role="tab" tabindex="0" aria-selected="false" aria-controls="node#">Javascript</a></dd>
</dl>
<div class="tabs-content dark">
<section role="tabpanel" aria-hidden="false" class="content" id="php">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-php"><?php $page = file_get_contents(get_template_directory() . "/includes/network-page.php.txt"); print htmlspecialchars($page); ?></code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing PHP</h3>
<p><ol class="install-instructions">
<li><a href="https://getcomposer.org/download/">Install Composer</a> from within web directory: <code>$ curl -sS https://getcomposer.org/installer | php</code></li>
<li><a href="https://github.com/graphaware/neo4j-php-client">Install Neo4j-PHP-Client</a> from within web directory: <code>$ php composer.phar require neoxygen/neoclient</code></li>
<li>Copy and paste code at left into php file and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="java">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-java"><?php $page = file_get_contents(get_template_directory() . "/includes/network-page.java.txt"); print htmlspecialchars($page); ?></code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Java</h3>
<p><ol class="install-instructions">
<li><a href="https://github.com/neo4j-contrib/neo4j-jdbc">Download Neo4j JDBC</a> </li>
<li>Copy and paste code at left into <code>Social.java</code></li>
<li>Run <code>javac Social.java</code></li>
<li>Run <code>java -cp /path/to/neo4j-jdbc-2.3-SNAPSHOT-jar-with-dependencies.jar:. Social</code></li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="python">
<div class="row">
<div class="small-8 columns">
<div class="code-container">
<pre style="height: 500px;"><code class="language-python">
# npm install neo4j-driver
from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://localhost", auth=basic_auth("neo4j", "<password>"))
session = driver.session()
# Insert data
insert_query = '''
UNWIND {pairs} AS pair
MERGE (s1:Service {name: pair[0]})
MERGE (s2:Service {name: pair[1]})
MERGE (s1)-[:DEPENDS_ON]->(s2);
'''
data = [["CRM", "Database VM"], ["Database VM", "Server 2"],
["Server 2", "SAN"], ["Server 1", "SAN"], ["Webserver VM", "Server 1"],
["Public Website", "Webserver VM"], ["Public Website", "Webserver VM"]]
session.run(insert_query, parameters={"pairs": data})
# Impact Analysis
impact_query = '''
MATCH (n:Service)<-[:DEPENDS_ON*]-(dependent:Service)
WHERE n.name = {service_name}
RETURN collect(dependent.name) AS dependent_services
'''
results = session.run(impact_query, parameters={"service_name": "Server 1"})
for record in results:
print(record)
# Dependency Analysis
dependency_query = """
MATCH (n:Service)-[:DEPENDS_ON*]->(downstream:Service)
WHERE n.name = {service_name}
RETURN collect(downstream.name) AS downstream_services
"""
results = session.run(dependency_query, {"service_name": "Public Website"})
for record in results:
print(record)
# Statistics
stats_query = """
MATCH (n:Service)<-[:DEPENDS_ON*]-(dependent:Service)
RETURN n.name AS service, count(DISTINCT dependent) AS dependents
ORDER BY dependents DESC
LIMIT 1
"""
results = session.run(stats_query)
for record in results:
print(record)
session.close()
</code></pre>
</div>
</div>
<div class="small-4 columns">
<h3 class="subheader">Downloading and Installing Python</h3>
<p><ol class="install-instructions">
<li><a href="https://github.com/neo4j/neo4j-python-driver">Install neo4j-python-driver</a> using pip: <code>$ pip install neo4j-driver</code></li>
<li>Copy and paste code at left into py file and run</li>
</ol></p>
</div>
</div>
</section>
<section role="tabpanel" aria-hidden="true" class="content" id="ruby">
<div class="row">