在图数据库领域中neo4j应该是使用的非常广泛的一种了,之前研究生期间就安装过这个数据库,后来换了电脑也就没有在尝试使用了,今天想在台式机上重新安装一下。
![66f104ec7df75562c570e38b064b4733.png](https://i-blog.csdnimg.cn/blog_migrate/8ef396db83c4c5296d23c12771e44676.jpeg)
数据库下载地址在https://neo4j.com/download-center/
打开后下载我红色线框圈出来的版本即可:
![200ef5d65ad0e324183a1fa33aad7402.png](https://i-blog.csdnimg.cn/blog_migrate/a834a6a3ddbef698a7ee6d59ae60bd89.jpeg)
就是社区版【免费】的windows版本就行了。下载好了以后直接解压缩即可,如下:
![9f390ad74371baa9b00143808c3f9e21.png](https://i-blog.csdnimg.cn/blog_migrate/c071b3aa7a18b32c3797a13ee17dd3af.jpeg)
类似java环境变量配置,新建NEO4J_HOME变量,变量值即为neo4j-community-3.5.8所在的路径,之后再系统的path中将bin所在的路径加入到path中,这样就完成了环境变量的配置处理。
接下来启动neo4j,启动命令如下:
neo4j.bat console
本地启动直接报错了,报错信息如下:
![9a0c024381baf5a9ee8a0d9d27cd48ba.png](https://i-blog.csdnimg.cn/blog_migrate/2793621791812f2d20610c3e8b154d05.jpeg)
查阅网上的资料找到一个解决方案是:
Set-ExecutionPolicy -ExecutionPolicy RemoteSignedImport-Module '(neo4j文件目录)binNeo4j-Management.psd1'Invoke-Neo4j console
亲测不可行,报错如下:
![7e5f9dec14d75c7b24f8b82ebf457e18.png](https://i-blog.csdnimg.cn/blog_migrate/5edf4730841955bebd8592b38cf1550a.jpeg)
可能是我使用有误,也可能是报错并非这种方式可以解决的。
下面开始分析上面的错误,其实错误的意思大概就是:
![7b9f5bb79659a850f2fe8cee7bf3f906.png](https://i-blog.csdnimg.cn/blog_migrate/b4b2627d31900e26052da76f10576ec9.jpeg)
中的什么路径没有找到,那么我们就进入到bin目录下打开这个文件,文件内容如下:
# Copyright (c) 2002-2018 "Neo4j,"# Neo4j Sweden AB [http://neo4j.com]## This file is part of Neo4j.## Neo4j is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see . try{ Unblock-File -Path '%~dp0Neo4j-Management*.*' -ErrorAction 'SilentlyContinue'}catch{}; Import-Module "$PSScriptRootNeo4j-Management.psd1"$Arguments = Get-Args $argsExit (Invoke-Neo4j -Verbose:$Arguments.Verbose -Command $Arguments.ArgsAsStr) # SIG # Begin signature block# MIIQ4QYJKoZIhvcNAQcCoIIQ0jCCEM4CAQExDzANBglghkgBZQMEAgEFADB5Bgor# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCA4m4lkLiHgwGm# mvWs5yfFXtCjjyI/VZfiAvrvRYA54KCCDcIwggPFMIICraADAgECAgEAMA0GCSqG# SIb3DQEBCwUAMIGDMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEG# A1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5jb20sIEluYy4xMTAv# BgNVBAMTKEdvIERhZGR5IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIw# HhcNMDkwOTAxMDAwMDAwWhcNMzcxMjMxMjM1OTU5WjCBgzELMAkGA1UEBhMCVVMx# EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT# EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp# ZmljYXRlIEF1dGhvcml0eSAtIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB# CgKCAQEAv3FiCPH6W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ATCBwjCBtDELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzAR# BgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMS0w# KwYDVQQLEyRodHRwOi8vY2VydHMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8xMzAx# BgNVBAMTKkdvIERhZGR5IFNlY3VyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBH# MgIJAIR2GChi98IaMA0GCWCGSAFlAwQCAQUAoIGEMBgGCisGAQQBgjcCAQwxCjAI# oAKAAKECgAAwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIB# CzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIEaESDUeYnlC7IcoVjyj# CPRspUeHReHa+89GNFb/onYXMA0GCSqGSIb3DQEBAQUABIIBAA9lIYGqn2TcLWTO# 5aDuqorxskxnCynaoE/XtUmQ4YmztpQgV4O5PoodwNYLG5qWb52jjG5KNlBeBvxO# FYwUSIyIJJqeuM+Ikm8P0SfpySzXfM1cIBtF50Z6FdcPabLvQR0dTORHbzN2Fk2I# H69lPVmmFnbxHfW0vzUlLBNvH3iBfmr6hvctIwayEuOw5fsC6sxg8Jv0xetLfM+J# 9DcQ/vGr8Xw4dto+6tHkDE07ZOvD2rlfVnPrjCp8RYVOpzA0v5pLK5OCGX1Y/4Nn# U2wNm8QM9LGaryw/5ey84yr1W9gaC2XVbhnA9uKNcAjLi1m29Kl7Nm5bxmPfJL1A# QJC6mSo=# SIG # End signature block
从上面的内容和启动命令的报错输出结合来看,我们很容易定位到这里:
![58ce1ec3a3469364935b9658fe1e211e.png](https://i-blog.csdnimg.cn/blog_migrate/81a69af44f0ed621d631a1e94c05aeb8.jpeg)
就是这里的路径除了问题,我并不知道“$PSScriptRoot”这个变量代表的什么意思,感觉有点像环境变量配置里面的NEO4J_HOME一样,既然想到了这里,我就修改了这个相关值为绝对路径值,修改后整个文件内容如下:
# Copyright (c) 2002-2018 "Neo4j,"# Neo4j Sweden AB [http://neo4j.com]## This file is part of Neo4j.## Neo4j is free software: you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program. If not, see . try{ Unblock-File -Path '%~dp0Neo4j-Management*.*' -ErrorAction 'SilentlyContinue'}catch{}; Import-Module "D:eo4jeo4j-community-3.5.8binNeo4j-Management.psd1"$Arguments = Get-Args $argsExit (Invoke-Neo4j -Verbose:$Arguments.Verbose -Command $Arguments.ArgsAsStr) # SIG # Begin signature block# MIIQ4QYJKoZIhvcNAQcCoIIQ0jCCEM4CAQExDzANBglghkgBZQMEAgEFADB5Bgor# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCA4m4lkLiHgwGm# mvWs5yfFXtCjjyI/VZfiAvrvRYA54KCCDcIwggPFMIICraADAgECAgEAMA0GCSqG# SIb3DQEBCwUAMIGDMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEG# A1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5jb20sIEluYy4xMTAv# BgNVBAMTKEdvIERhZGR5IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIw# HhcNMDkwOTAxMDAwMDAwWhcNMzcxMjMxMjM1OTU5WjCBgzELMAkGA1UEBhMCVVMx# EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT# EUdvRGFkZHkuY29tLCBJbmMuMTEwLwY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QyQYY63WoVk7TIq1VkbmRXtcvm3/plWPUNTPPEy0Dfnjn# dA2UByib6/iqdnSZ7MYit31rmSsRAS3Wil/qqOGlVfYrSm2s64ryPMOacAkxggJ1# MIICcQIBATCBwjCBtDELMAkGA1UEBhMCVVMxEDAOBgNVBAgTB0FyaXpvbmExEzAR# BgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMuMS0w# KwYDVQQLEyRodHRwOi8vY2VydHMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeS8xMzAx# BgNVBAMTKkdvIERhZGR5IFNlY3VyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBH# MgIJAIR2GChi98IaMA0GCWCGSAFlAwQCAQUAoIGEMBgGCisGAQQBgjcCAQwxCjAI# oAKAAKECgAAwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIB# CzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIEaESDUeYnlC7IcoVjyj# CPRspUeHReHa+89GNFb/onYXMA0GCSqGSIb3DQEBAQUABIIBAA9lIYGqn2TcLWTO# 5aDuqorxskxnCynaoE/XtUmQ4YmztpQgV4O5PoodwNYLG5qWb52jjG5KNlBeBvxO# FYwUSIyIJJqeuM+Ikm8P0SfpySzXfM1cIBtF50Z6FdcPabLvQR0dTORHbzN2Fk2I# H69lPVmmFnbxHfW0vzUlLBNvH3iBfmr6hvctIwayEuOw5fsC6sxg8Jv0xetLfM+J# 9DcQ/vGr8Xw4dto+6tHkDE07ZOvD2rlfVnPrjCp8RYVOpzA0v5pLK5OCGX1Y/4Nn# U2wNm8QM9LGaryw/5ey84yr1W9gaC2XVbhnA9uKNcAjLi1m29Kl7Nm5bxmPfJL1A# QJC6mSo=# SIG # End signature block
保存退出之后,重新启动数据库,结果输出如下:
![293c75b4f56b2b71a295d6e73f04cdc7.png](https://i-blog.csdnimg.cn/blog_migrate/29ed332c1f948b7a9aec04465c9d9df1.jpeg)
可以看到,neo4j数据库已经成功启动了,到此,算是环境配置结束了。
到这里安装过程就结束了,Python中提供了操作neo4j数据库的模块py2neo 可以很方便地进行图数据库的使用,下面进行简单的使用分析:
#!usr/bin/env python# encoding:utf-8from __future__ import division """__Author__:沂水寒城功能: Python操作neo4j实践图数据库使用""" import osimport sysimport jsonfrom py2neo import Graph,Node,Relationship reload(sys)sys.setdefaultencoding('utf-8') ##连接neo4j数据库graph=Graph( 'http://localhost:7474', username='neo4j', password='neo4j' )#清除图数据graph.delete_all()#创建结点with open('data.txt') as f: data_list=[one.strip().split('###') for one in f.readlines() if one]have_list=[]node_list=[]map_dict={}for one_relation in data_list: P1,P2,relation,weight=one_relation if P1 not in have_list: have_list.append(P1) one_node=Node('sougou',name=P1) node_list.append(one_node) map_dict[P1]=one_node if P2 not in have_list: have_list.append(P2) one_node=Node('sougou',name=P2) node_list.append(one_node) map_dict[P2]=one_node for one_node in node_list: graph.create(one_node) #创建关系for one_relation in data_list: P1,P2,relation,weight=one_relation one_link=Relationship(map_dict[P1],relation,map_dict[P2]) one_link['count']=weight graph.create(one_link) print(graph)
使用到的部分数据截图如下所示,都是人物关系数据:
![f692bad7ddf75de39743094173471951.png](https://i-blog.csdnimg.cn/blog_migrate/f33bfec13e5fc7e4baa14c8d3effa280.jpeg)
运行结束后,打开浏览器,输入:http://localhost:7474 回车就可以查看图数据库里面的数据了,部分数据截图如下:
![e771d2441424d2f8f5b995f7748bbb3d.png](https://i-blog.csdnimg.cn/blog_migrate/ace4f5ab79e8240d82c83c7e597e9ab7.jpeg)
![d3a1443bf8cd84b3578545e33d022949.png](https://i-blog.csdnimg.cn/blog_migrate/da4549465e096cb093bba1d4b899610e.jpeg)
![c38a0fc74ee43b29b4f602d03a6e9359.png](https://i-blog.csdnimg.cn/blog_migrate/c93a63d8b3e3dd398598ccbad91bd96a.jpeg)
![45bd29f13423a869eabb2ca109f7d8b2.png](https://i-blog.csdnimg.cn/blog_migrate/28e761331ea2cb23e17e887bde47045b.jpeg)
neo4j数据库中部分数据库类型截图如下所示:
![2913a07c0410d75551327c63559832d3.png](https://i-blog.csdnimg.cn/blog_migrate/549d067782ca6b5d26e0689839e402b1.jpeg)
初步使用,感觉知识图谱如果做得足够好,是非常有希望超过AI所能达到的效果的。