The Neo4j Manual V1.9.M04
Total Page:16
File Type:pdf, Size:1020Kb
The Neo4j Manual v1.9.M04 The Neo4j Team neo4j.org <http://neo4j.org/> www.neotechnology.com <http://www.neotechnology.com/> The Neo4j Manual v1.9.M04 by The Neo4j Team neo4j.org <http://neo4j.org/> www.neotechnology.com <http://www.neotechnology.com/> Publication date 2013-01-17 17:29:44 Copyright © 2013 Neo Technology Starting points • What is a graph database? • Cypher Query Language • Using Neo4j embedded in Java applications • Using Neo4j embedded in Python applications • Remote Client Libraries • Languages • Neo4j Server • REST API License: Creative Commons 3.0 This book is presented in open source and licensed through Creative Commons 3.0. You are free to copy, distribute, transmit, and/or adapt the work. This license is based upon the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. Any of the above conditions can be waived if you get permission from the copyright holder. In no way are any of the following rights affected by the license: • Your fair dealing or fair use rights • The author’s moral rights • Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights Note For any reuse or distribution, you must make clear to the others the license terms of this work. The best way to do this is with a direct link to this page: http://creativecommons.org/licenses/by-sa/3.0/ <http://creativecommons.org/licenses/by-sa/3.0/> Table of Contents Preface ................................................................................................................................................... iv I. Introduction ........................................................................................................................................ 1 1. Neo4j Highlights ....................................................................................................................... 2 2. Graph Database Concepts ......................................................................................................... 3 3. The Neo4j Graph Database ..................................................................................................... 11 II. Tutorials .......................................................................................................................................... 20 4. Using Neo4j embedded in Java applications .......................................................................... 21 5. Neo4j Remote Client Libraries ............................................................................................... 50 6. The Traversal Framework ....................................................................................................... 56 7. Data Modeling Examples ........................................................................................................ 65 8. Languages .............................................................................................................................. 101 9. Using Neo4j embedded in Python applications .................................................................... 102 10. Extending the Neo4j Server ................................................................................................ 106 III. Reference ..................................................................................................................................... 113 11. Capabilities .......................................................................................................................... 114 12. Transaction Management .................................................................................................... 121 13. Data Import .......................................................................................................................... 130 14. Indexing ............................................................................................................................... 134 15. Cypher Query Language ..................................................................................................... 153 16. Graph Algorithms ................................................................................................................ 239 17. Neo4j Server ........................................................................................................................ 241 18. REST API ............................................................................................................................ 254 19. Python embedded bindings ................................................................................................. 368 IV. Operations .................................................................................................................................... 384 20. Installation & Deployment .................................................................................................. 385 21. Configuration & Performance ............................................................................................. 396 22. High Availability ................................................................................................................. 427 23. Backup ................................................................................................................................. 444 24. Security ................................................................................................................................ 449 25. Monitoring ........................................................................................................................... 455 V. Tools ............................................................................................................................................. 466 26. Web Administration ............................................................................................................ 467 27. Neo4j Shell .......................................................................................................................... 473 VI. Community .................................................................................................................................. 489 28. Community Support ............................................................................................................ 490 29. Contributing to Neo4j .......................................................................................................... 491 A. Manpages ...................................................................................................................................... 515 neo4j ........................................................................................................................................... 516 neo4j-shell .................................................................................................................................. 518 neo4j-backup .............................................................................................................................. 519 B. Questions & Answers ................................................................................................................... 521 iii Preface This is the reference manual for Neo4j version 1.9.M04, written by the Neo4j Team. The main parts of the manual are: • Part I, “Introduction” — introducing graph database concepts and Neo4j. • Part II, “Tutorials” — learn how to use Neo4j. • Part III, “Reference” — detailed information on Neo4j. • Part IV, “Operations” — how to install and maintain Neo4j. • Part V, “Tools” — guides on tools. • Part VI, “Community” — getting help from, contributing to. • Appendix A, Manpages — command line documentation. • Appendix B, Questions & Answers — common questions. The material is practical, technical, and focused on answering specific questions. It addresses how things work, what to do and what to avoid to successfully run Neo4j in a production environment. The goal is to be thumb-through and rule-of-thumb friendly. Each section should stand on its own, so you can hop right to whatever interests you. When possible, the sections distill "rules of thumb" which you can keep in mind whenever you wander out of the house without this manual in your back pocket. The included code examples are executed when Neo4j is built and tested. Also, the REST API request and response examples are captured from real interaction with a Neo4j server. Thus, the examples are always in sync with Neo4j. Who should read this? The topics should be relevant to architects, administrators, developers and operations personnel. iv Part I. Introduction This part gives a bird’s eye view of what a graph database is, and then outlines some specifics of Neo4j. Chapter 1. Neo4j Highlights As a robust, scalable and high-performance database, Neo4j is suitable for full enterprise deployment or a subset of the full server can be used in lightweight projects. It features: • true ACID transactions • high availability • scales to billions of nodes and relationships • high speed querying through traversals Proper ACID behavior is the foundation of data reliability. Neo4j enforces that all operations that modify data occur within a transaction, guaranteeing consistent data. This robustness extends from