neo4j数据库怎么登录(报错解决与简单实践使用分析)

在图数据库领域中neo4j应该是使用的非常广泛的一种了,之前研究生期间就安装过这个数据库,后来换了电脑也就没有在尝试使用了,今天想在台式机上重新安装一下。

neo4j数据库怎么登录(报错解决与简单实践使用分析)(1)

数据库下载地址在https://neo4j.com/download-center/

打开后下载我红色线框圈出来的版本即可:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(2)

就是社区版【免费】的windows版本就行了。下载好了以后直接解压缩即可,如下:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(3)

类似java环境变量配置,新建Neo4j_HOME变量,变量值即为neo4j-community-3.5.8所在的路径,之后再系统的path中将bin所在的路径加入到path中,这样就完成了环境变量的配置处理。

接下来启动neo4j,启动命令如下:

neo4j.bat console

本地启动直接报错了,报错信息如下:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(4)

查阅网上的资料找到一个解决方案是:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned Import-Module '(neo4j文件目录)\bin\Neo4j-Management.psd1' Invoke-Neo4j console

亲测不可行,报错如下:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(5)

可能是我使用有误,也可能是报错并非这种方式可以解决的。

下面开始分析上面的错误,其实错误的意思大概就是:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(6)

中的什么路径没有找到,那么我们就进入到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 <http://www.gnu.org/licenses/>. try { Unblock-File -Path '%~dp0Neo4j-Management\*.*' -ErrorAction 'SilentlyContinue' } catch { }; Import-Module "$PSScriptRoot\Neo4j-Management.psd1" $Arguments = Get-Args $args Exit (Invoke-Neo4j -Verbose:$Arguments.Verbose -Command $Arguments.ArgsAsStr) # SIG # Begin signature block # MIIQ4QYJKoZIhvcNAQcCoIIQ0jCCEM4CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCA4m4lkLiHgwGm # mvWs5yfFXtCjjyI/VZfiAvrvRYA54KCCDcIwggPFMIICraADAgECAgEAMA0GCSqG # SIb3DQEBCwUAMIGDMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEG # A1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5jb20sIEluYy4xMTAv # BgNVBAMTKEdvIERhZGR5IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIw # HhcNMDkwOTAxMDAwMDAwWhcNMzcxMjMxMjM1OTU5WjCBgzELMAkGA1UEBhMCVVMx # EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT # EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp # ZmljYXRlIEF1dGhvcml0eSAtIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB # CgKCAQEAv3FiCPH6WTT3G8kYo/eASVjpIoMTpsUgQwE7hPHmhUmfJ r2hBtOoLTb # cJjHMgGxBT4HTu70 k8vWTAi56sZVmvigAf88xZ1gDlRe X5NbZ0TqmNghPktj p # A4P6or6KFWp/3gvDthkUBcrqw6gElDtGfDIN8wBmIsiNaW02jBEYt9OyHGC0OPoC # jM7T3UYH3go 6118yHz7sCtTpJJiaVElBWEaRIGMLKlDliPfrDqBmg4pxR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XRob3JpdHkgLSBH # MgIJAIR2GChi98IaMA0GCWCGSAFlAwQCAQUAoIGEMBgGCisGAQQBgjcCAQwxCjAI # oAKAAKECgAAwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIB # CzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIEaESDUeYnlC7IcoVjyj # CPRspUeHReHa 89GNFb/onYXMA0GCSqGSIb3DQEBAQUABIIBAA9lIYGqn2TcLWTO # 5aDuqorxskxnCynaoE/XtUmQ4YmztpQgV4O5PoodwNYLG5qWb52jjG5KNlBeBvxO # FYwUSIyIJJqeuM Ikm8P0SfpySzXfM1cIBtF50Z6FdcPabLvQR0dTORHbzN2Fk2I # H69lPVmmFnbxHfW0vzUlLBNvH3iBfmr6hvctIwayEuOw5fsC6sxg8Jv0xetLfM J # 9DcQ/vGr8Xw4dto 6tHkDE07ZOvD2rlfVnPrjCp8RYVOpzA0v5pLK5OCGX1Y/4Nn # U2wNm8QM9LGaryw/5ey84yr1W9gaC2XVbhnA9uKNcAjLi1m29Kl7Nm5bxmPfJL1A # QJC6mSo= # SIG # End signature block

从上面的内容和启动命令的报错输出结合来看,我们很容易定位到这里:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(7)

就是这里的路径除了问题,我并不知道“$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 <http://www.gnu.org/licenses/>. try { Unblock-File -Path '%~dp0Neo4j-Management\*.*' -ErrorAction 'SilentlyContinue' } catch { }; Import-Module "D:\neo4j\neo4j-community-3.5.8\bin\Neo4j-Management.psd1" $Arguments = Get-Args $args Exit (Invoke-Neo4j -Verbose:$Arguments.Verbose -Command $Arguments.ArgsAsStr) # SIG # Begin signature block # MIIQ4QYJKoZIhvcNAQcCoIIQ0jCCEM4CAQExDzANBglghkgBZQMEAgEFADB5Bgor # BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG # KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCCA4m4lkLiHgwGm # mvWs5yfFXtCjjyI/VZfiAvrvRYA54KCCDcIwggPFMIICraADAgECAgEAMA0GCSqG # SIb3DQEBCwUAMIGDMQswCQYDVQQGEwJVUzEQMA4GA1UECBMHQXJpem9uYTETMBEG # A1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5jb20sIEluYy4xMTAv # BgNVBAMTKEdvIERhZGR5IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IC0gRzIw # HhcNMDkwOTAxMDAwMDAwWhcNMzcxMjMxMjM1OTU5WjCBgzELMAkGA1UEBhMCVVMx # EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT # EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp # ZmljYXRlIEF1dGhvcml0eSAtIEcyMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB # CgKCAQEAv3FiCPH6WTT3G8kYo/eASVjpIoMTpsUgQwE7hPHmhUmfJ r2hBtOoLTb # cJjHMgGxBT4HTu70 k8vWTAi56sZVmvigAf88xZ1gDlRe X5NbZ0TqmNghPktj p # A4P6or6KFWp/3gvDthkUBcrqw6gElDtGfDIN8w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keS5jb20vcmVwb3NpdG9yeS8xMzAx # BgNVBAMTKkdvIERhZGR5IFNlY3VyZSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBH # MgIJAIR2GChi98IaMA0GCWCGSAFlAwQCAQUAoIGEMBgGCisGAQQBgjcCAQwxCjAI # oAKAAKECgAAwGQYJKoZIhvcNAQkDMQwGCisGAQQBgjcCAQQwHAYKKwYBBAGCNwIB # CzEOMAwGCisGAQQBgjcCARUwLwYJKoZIhvcNAQkEMSIEIEaESDUeYnlC7IcoVjyj # CPRspUeHReHa 89GNFb/onYXMA0GCSqGSIb3DQEBAQUABIIBAA9lIYGqn2TcLWTO # 5aDuqorxskxnCynaoE/XtUmQ4YmztpQgV4O5PoodwNYLG5qWb52jjG5KNlBeBvxO # FYwUSIyIJJqeuM Ikm8P0SfpySzXfM1cIBtF50Z6FdcPabLvQR0dTORHbzN2Fk2I # H69lPVmmFnbxHfW0vzUlLBNvH3iBfmr6hvctIwayEuOw5fsC6sxg8Jv0xetLfM J # 9DcQ/vGr8Xw4dto 6tHkDE07ZOvD2rlfVnPrjCp8RYVOpzA0v5pLK5OCGX1Y/4Nn # U2wNm8QM9LGaryw/5ey84yr1W9gaC2XVbhnA9uKNcAjLi1m29Kl7Nm5bxmPfJL1A # QJC6mSo= # SIG # End signature block

保存退出之后,重新启动数据库,结果输出如下:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(8)

可以看到,neo4j数据库已经成功启动了,到此,算是环境配置结束了。

到这里安装过程就结束了,Python中提供了操作neo4j数据库的模块py2neo 可以很方便地进行图数据库的使用,下面进行简单的使用分析:

#!usr/bin/env python # encoding:utf-8 from __future__ import division """ __Author__:沂水寒城 功能: Python操作neo4j实践图数据库使用 """ import os import sys import json from 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)

使用到的部分数据截图如下所示,都是人物关系数据:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(9)

运行结束后,打开浏览器,输入:http://localhost:7474 回车就可以查看图数据库里面的数据了,部分数据截图如下:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(10)

neo4j数据库怎么登录(报错解决与简单实践使用分析)(11)

neo4j数据库怎么登录(报错解决与简单实践使用分析)(12)

neo4j数据库怎么登录(报错解决与简单实践使用分析)(13)

neo4j数据库中部分数据库类型截图如下所示:

neo4j数据库怎么登录(报错解决与简单实践使用分析)(14)

初步使用,感觉知识图谱如果做得足够好,是非常有希望超过AI所能达到的效果的。

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页