图数据库介绍

来自ling
跳转至: 导航搜索

https://www.cnblogs.com/mantoudev/p/10414495.html

Neo4j基础(详细) https://www.jianshu.com/p/9e3c4892ab3e

https://github.com/neo4j/neo4j

SDN-Architecture.png

安装

Docker常用服务#neo4j

https://blog.csdn.net/weixin_37197708/article/details/79453703

Springboot 集成Neo4j完整版(含集群)

https://blog.csdn.net/zt15732625878/article/details/98797467

参考

neo4j博客 visjs vue中使用visjs小记 Network_demo_vis neo4j图形数据库第七弹——整合vis.js实现数据可视化 spring-data-neo4j 使用和总结 Neo4j系列-整合SpringBoot Neo4j Java 工具包

Neo4j图数据库管理系统开发笔记之一:Neo4j Java 工具包 Neo4j图数据库管理系统开发笔记之二:管理系统Server端界面一览 Neo4j图数据库管理系统开发笔记之三:构建安全的RMI Service(Client) Neo4j图数据库管理系统开发笔记之三:构建安全的RMI Service(Server) Neo4j+D3展现的应用实例 springboot2.0+Neo4j+d3.js构建知识图谱 Neo4j-KGBuilder Cypher 语句入门到上天 Vue D3 力导向图

Neo4J 安装&常见语句操作&项目中的集成应用&复杂查询(@Query注解和自定义Match)

反模式

  • 不要把neo4j 当作关系数据库使用

关系数据库关心的是数据如何存储。而不关心数据如何查询。所以在使用nosql之前,建模很重要。Neo4j关注的是节点,以及节点之间如何关联。

  • 第一次在关键任务中使用Neo4j
  • 将关系存储在节点内部,即一个实体内部嵌套其他实体,这样会导致节点数据很大

这就是为什么要单独创建关系了。

  • 不恰当的使用关系的类型。

节点之间的关系必须是有意义的。关系必须是唯一的。这需要深入的理解图形数据库。

  • 存储大的二进制对象。

BLOB对象导致大的属性值,Neo4j使用一个文件来存储属性值的。这样会导致读取时间过长,同时减缓其他属性的读取。

  • 在所有属性上添加索引

Neo4j支持两种类型的索引:schema indexes 和 legacy indexes。如果节点或者关系的每个属性都创建索引,会导致额外的写操作。

使用multiTransactionManager这个事务管理器,可以让mysql和neo4j的的修改同时提交或者回滚

https://blog.csdn.net/u014229652/article/details/94385601?utm_medium=distribute.pc_relevant_right.none-task-blog-BlogCommendFromMachineLearnPai2-8.nonecase&depth_1-utm_source=distribute.pc_relevant_right.none-task-blog-BlogCommendFromMachineLearnPai2-8.nonecase

语法

https://www.w3cschool.cn/neo4j/neo4j_cql_introduction.html

create
(accountOwner1:AccountOwner{FirstName:"Sylvia",LastName:"Song",UniqueID:"SylviaSong"}),
(accountOwner2:AccountOwner{FirstName:"Angle",LastName:"Hao",UniqueID:"AngleHao"}),
(accountOwner3:AccountOwner{FirstName:"Jacky",LastName:"Song",UniqueID:"JackySong"}),
(address1:Address{Street:"123 NW1st Street",City:"Beijing"}),
(accountOwner1)-[:HAS_ADDRESS]->(address1),
(accountOwner2)-[:HAS_ADDRESS]->(address1),
(accountOwner3)-[:HAS_ADDRESS]->(address1),
(phoneNumber1:PhoneNumber{PhoneNumber:"111-111-11111"}),
(phoneNumber2:PhoneNumber{PhoneNumber:"222-222-22222"})
                                <-[:HAS_PHONENUMBER]-(accountOwner3),
(accountOwner1)-[:HAS_PHONENUMBER]->(phoneNumber1),
(accountOwner2)-[:HAS_PHONENUMBER]->(phoneNumber1),
(SSN1:SSN{SSN:"241-23-1234"}),
(accountOwner2)-[:HAS_SSN]->(SSN1),
(accountOwner3)-[:HAS_SSN]->(SSN1),
(SSN2:SSN{SSN:"241-23-5678"}),
(accountOwner1)-[:HAS_SSN]->(SSN2),
(creditCard1:CreditCard{AccountNumber:"1234567890123456",
                        Limit:5000,
                        Balance:1442.23,
                        ExpirarionDate:"01-20",
                        SecurityCode:"123"})<-[:HAS_CREDITCARD]-(accountOwner1),
(creditCard2:CreditCard{AccountNumber:"1234567890123456",
                        Limit:4000,
                        Balance:2345.56,
                        ExpirarionDate:"02-20",
                        SecurityCode:"456"})<-[:HAS_CREDITCARD]-(accountOwner2),
(bankAccount1:BankAccount{AccountNumber:"2345678901234567",
                          Balance:7054.43})<-[:HAS_BANKACCOUNT]-(accountOwner1),
(bankAccount2:BankAccount{AccountNumber:"3456789012345678",
                          Balance:4231.12})<-[:HAS_BANKACCOUNT]-(accountOwner2),
(bankAccount3:BankAccount{AccountNumber:"4567890123456789",
                          Balance:12345.45})<-[:HAS_BANKACCOUNT]-(accountOwner3),
(unsecuredLoan1:UnsecuredLoan{AccountNumber:"4567890123456789-0",
                              Balance:9045.53,
                              APR:.0541,
                             LoanAmount:12000.00})<-[:HAS_UNSECUREDLOAN]-(accountOwner2),
(unsecuredLoan2:UnsecuredLoan{AccountNumber:"5678901234567890-0",
                              Balance:16341.95,
                              APR:.0341,
                              LoanAmount:22000.00})<-[:HAS_UNSECUREDLOAN]-(accountOwner3)

nginx

https://blog.csdn.net/wangdonghello/article/details/83622176

问题解决

the reason for the failure is not available to this Neo4j Driver.

https://neo4j.com/developer/kb/explanation-of-error-websocket-connection-failure/

This error can be resolved by editing the file $NEO4J_HOME/conf/neo4j.conf and uncommenting:

  1. To have Bolt accept non-local connections, uncomment this line:

dbms.connector.bolt.address=0.0.0.0:7687

ClassNotFoundException: org.neo4j.ogm.drivers.embedded.driver.EmbeddedDriver

不能不穿数据库信息

//	@Bean
//	public SessionFactory sessionFactory() {
//		// with domain entity base package(s)
//		return new SessionFactory("com.ling.cloud.neo4j");
//	}
//
//	@Bean
//	public Neo4jTransactionManager transactionManager() throws Exception {
//		return new Neo4jTransactionManager(sessionFactory());
//	}

ClassNotFoundException: org.neo4j.ogm.drivers.http.driver.HttpDriver

		<!-- add this dependency if you want to use the embedded driver -->
<!--		<dependency>-->
<!--			<groupId>org.neo4j</groupId>-->
<!--			<artifactId>neo4j-ogm-embedded-driver</artifactId>-->
<!--		</dependency>-->
		<!-- add this dependency if you want to use the HTTP driver -->
		<dependency>
			<groupId>org.neo4j</groupId>
			<artifactId>neo4j-ogm-http-driver</artifactId>
		</dependency>

NullPointerException

Caused by: java.lang.NullPointerException: null
	at java.lang.String.contains(String.java:2133)
	at org.neo4j.ogm.metadata.FieldInfo.persistableAsProperty(FieldInfo.java:194)
	at org.neo4j.ogm.metadata.DomainInfo.postProcessFields(DomainInfo.java:223)
	at org.neo4j.ogm.metadata.DomainInfo.finish(DomainInfo.java:204)
	at org.neo4j.ogm.metadata.DomainInfo.create(DomainInfo.java:70)
	at org.neo4j.ogm.metadata.MetaData.<init>(MetaData.java:51)
	at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:103)
	at org.neo4j.ogm.session.SessionFactory.<init>(SessionFactory.java:87)

Neo4jConfig 导致问题

Neo4J health check failed