没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
The Neo4j Developer Manual
v3.1
Table of Contents
Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê1
1. Neo4j highlights . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê2
2. Graph database concepts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê3
Get started. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê8
3. Install Neo4j . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê9
4. Get started with Cypher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê10
Cypher . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê23
5. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê24
6. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê30
7. Clauses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê51
8. Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê131
9. Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê166
10. Query Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê176
11. Execution Plans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê190
Drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê217
12. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê219
13. Get started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê220
14. Configure and connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê222
15. Run statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê226
16. Process results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê229
17. Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê232
18. Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê234
HTTP API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê234
19. Transactional Cypher HTTP endpoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê235
20. Authentication and authorization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê245
Extending Neo4j . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê248
21. Procedures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê249
22. User-defined functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê256
23. Authentication and authorization plugins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê258
Appendix A: Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê262
24. Neo4j Status Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê263
Appendix B: Terminology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ê268
© 2017 Neo Technology
License: Creative Commons 3.0
This is the developer manual for Neo4j version 3.1, authored by the Neo4j Team.
The main parts of the manual are:
• Introduction — Introducing graph database concepts and Neo4j.
• Get started — Get started using Neo4j: Cypher and Drivers.
• Cypher — Reference for the Cypher query language.
• Drivers — Uniform language driver manual.
• Reference — Neo4j status code reference.
• Terminology — Graph database terminology.
Who should read this?
This manual is written for the developer of a Neo4j client application.
Introduction
This chapter introduces graph database concepts and Neo4j highlights.
1
Chapter 1. Neo4j highlights
Connected data is all around us. Neo4j supports rapid development of graph powered systems that
take advantage of the rich connectedness of data.
A native graph database: Neo4j is built from the ground up to be a graph database. The architecture
is designed for optimizing fast management, storage, and traversal of nodes and relationships. In
Neo4j, relationships are first class citizens that represent pre-materialized connections between
entities. An operation known in the relational database world as a join, whose performance degrades
exponentially with the number of relationships, is performed by Neo4j as navigation from one node to
another, whose performance is linear.
This different approach to storing and querying connections between entities provides traversal
performance of up to 4 million hops per second and core. As most graph searches are local to the
larger neighborhood of a node, the total amount of data stored in a database will not affect
operations runtime. Dedicated memory management, and highly scalable and memory efficient
operations, contribute to the benefits.
Whiteboard friendly: The property graph approach allows consistent use of the same model
throughout conception, design, implementation, storage, and visualization of any domain or use case.
This allows all business stakeholders to participate throughout the development cycle. With the
schema optional model, the domain model can be evolved continuously as requirements change,
without penalty of expensive schema changes and migrations.
Cypher, the declarative graph query language, is designed to visually represent graph patterns of
nodes and relationships. This highly capable, yet easily readable, query language is centered around
the patterns that express concepts or questions from a specific domain. Cypher can also be extended
for narrow optimizations for specific use cases.
Supports rapid development: Neo4j supports fast development of graph powered systems. Neo4j’s
development stems from the need to run real-time queries on highly related information; something
no other database can provide. These unique Neo4j features get you up and running quickly and
sustain fast application development for highly scalable applications.
Provides true data safety through ACID transactions: Neo4j uses transactions to guarantee that data
is persisted in the case of hardware failure or system crashes.
Designed for business-critical and high-performance operations: Neo4j clustering is designed to
support business-critical and high-performance applications. It can store hundreds of trillions of
entities for the largest datasets imaginable while being sensitive to compact storage. Neo4j can be
deployed as a scalable, fault-tolerant cluster of machines. Due to its high scalability, Neo4j clusters
require only tens of machines, not hundreds or thousands, saving on cost and operational complexity.
Other features for production applications include hot-backups and extensive monitoring.
Neo4j’s application is only limited by your imagination.
2
Chapter 2. Graph database concepts
This chapter contains an introduction to the graph data model.
2.1. The Neo4j graph database
A graph database stores data in a graph, the most generic of data structures, capable of elegantly
representing any kind of data in a highly accessible way.
For graph database terminology, see Terminology.
Here’s an example graph which we will approach step by step in the following sections:
Person
name = 'Tom Hanks'
born = 1956
Movie
title = 'Forrest Gump'
released = 1994
ACTED_IN
roles = ['Forrest']
Person
name = 'Robert Zemeckis'
born = 1951
DIRECTED
2.1.1. Nodes
A graph records data in nodes and relationships. Both can have properties. This is
sometimes referred to as the "Property Graph Model".
The fundamental units that form a graph are nodes and relationships. In Neo4j, both nodes and
relationships can contain properties.
Nodes are often used to represent entities, but depending on the domain relationships may be used
for that purpose as well.
In addition to having properties and relationships, nodes can also be labeled with one or more labels.
The simplest possible graph is a single Node. A Node can have zero or more named values referred to
as properties. Let’s start out with one node that has a single property named title:
title = 'Forrest Gump'
The next step is to have multiple nodes. Let’s add two more nodes and one more property on the
node in the previous example:
name = 'Tom Hanks'
born = 1956
title = 'Forrest Gump'
released = 1994
name = 'Robert Zemeckis'
born = 1951
2.1.2. Relationships
Relationships organize the nodes by connecting them. A relationship connects two nodes — a
start node and an end node. Just like nodes, relationships can have properties.
3
剩余274页未读,继续阅读
资源评论
zhizh
- 粉丝: 2
- 资源: 18
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功