Neo4j 的一些使用心得

<div class="htmledit\_views" id="content\_views"> <p><br></p> <p><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">由对图数据的处理需求,看到了图数据库(GraphDataBase)这种比较新的数据库模式,并且通过比较发现用的相对多的要属Neo4j了,现在来看网上对Neo4j的介绍还比较少,内容主要来源于三个地方:官方网站</span><a href="http://www.neo4j.org/" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);font-family:simsun;font-size:14px;line-height:21px;" target="\_blank">http://www.neo4j.org/</a><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">&nbsp;</span><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">;中文社区</span><a href="http://www.neo4j.org.cn/" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);font-family:simsun;font-size:14px;line-height:21px;" target="\_blank">http://www.neo4j.org.cn/</a><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">&nbsp;</span><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">和Neo4j google网上论坛</span><a href="https://groups.google.com/forum/?fromgroups#!forum/neo4j" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);font-family:simsun;font-size:14px;line-height:21px;" target="\_blank">https://groups.google.com/forum/?fromgroups#!forum/neo4j</a><span style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;">。而中文社区的内容基本上是对官网内容的翻译,可以中英文对照着看,以加快理解。</span></p> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;在各种官方资料中都说Neo4j的性能优良,可以支持几十亿个节点和上百亿的关系,于是怀着兴奋和期望开始了对它的研究。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Neo4j有两种运行模式,即程序嵌入式模式和服务器模式。对于项目的长期使用来说显然是服务器模式更加适合。所以在对嵌入式模式进行了简单的了解之后就开始对其服务器模式进行研究。对于官网中已经介绍的内容本文就不再赘述了,而目前能搜索到的资料基本上也是这些内容的重复,本文中讲一些我使用过程中遇到的问题和经验。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;首先当然是去官网上下载安装包。我选择的是neo4j-enterprise-1.8.M07-windows版本,按照官网的教程逐步进行安装,启动。这个时候遇到了第一个问题,就是neo4j.bat install执行之后,服务可以安装上去,但是无论如何都无法启动。提示:<span style="color:#FF0000;">失败 1053 服务没有及时响应启动或控制请求</span>&nbsp;在网上翻看了很多资料,基本上都是修改服务的超时时间,但是此时对这个问题无效。最后在google论坛上看到相似内容,可能是电脑安装的Java jdk版本问题,于是把jdk 1.7 换回到jdk 1.6,再启动果然问题解决了。所以如果要使用Neo4j的服务器模式运行,最好还是首先确定自己电脑安装的是jdk 1.6&nbsp;</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;服务运行起来之后就是研究它的功能和用法了。我用的是Java,所以一切内容都是以Java为语言基础的。服务器模式提供了REST API,但是由于水平有限,要自己通过Java使用这些API实在是不容易。于是寻找针对REST API的封装工具。<a href="http://docs.neo4j.org.cn/server-java-rest-client-example.html" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank">http://docs.neo4j.org.cn/server-java-rest-client-example.html</a>这里介绍了如何在Java中使用REST API,其中用到了Jersey,但是在网页上所给的例子中我发现了一个问题,在查询某个点的时候,他的参数用到了之前创建点的时候的临时变量URI firstNode,这就意味着如果所有点已经创建完毕,而我想通过某个点的属性查询到它的话就没有办法了。遗憾的是Java使用REST API这部分只有这一页的例子,其他地方也没有搜索到相关资料。这种方法只能先告一段落。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;还有另外一种方法是通过Java-REST-Binding<a href="http://docs.neo4j.org.cn/rest-clients.html" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank">http://docs.neo4j.org.cn/rest-clients.html</a>&nbsp;它集成了REST API 可以通过Java远程连接Neo4j服务器GraphDatavaseService gds=new RestGraphDatabase("http://10.108.xxx.xx:7474/db/data");同时还支持Neo4j-core-API,这样就可以像使用嵌入式模式那样的代码形式对数据库进行响应操作,而且嵌入式模式下的代码实例相对较多。这样就可以很方便的进行创建节点,添加属性和关系,查询,创建索引等操作。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;与MongoDB的可视化操作工具MongoVUE相似的是,针对Neo4j也有一个工具-neoclipse。cfeibiao的博客<a href="http://blog.csdn.net/cfeibiao/article/details/6842941" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank">http://blog.csdn.net/cfeibiao/article/details/6842941</a>有对它的基本介绍。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> <a href="http://photo.blog.sina.com.cn/showpic.html#blogid=5fa2a27e0101cku5&amp;url=http://s16.sinaimg.cn/orignal/5fa2a27e4da16c8de6f2f" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank"><img src="http://s16.sinaimg.cn/mw690/5fa2a27e4da16c8de6f2f&amp;690" name="image\_operate\_19481365691791857" alt="Neo4j&nbsp;<wbr>的一些使用心得" title="Neo4j&nbsp;<wbr>的一些使用心得" style="border:0px;list-style:none;"></a></div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;如果你的数据库已经对应点的属性建立了索引,则可以通过某个点的属性值对其进行查询,比如“name”属性的“张三”。另外还支持cyper语言查询。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> &nbsp;&nbsp;&nbsp;&nbsp;另外一种检测工具就是web控制台,可以通过http://ip地址:7474/webadmin访问。</div> <div style="color:rgb(70,70,70);font-family:simsun;font-size:14px;line-height:21px;"> <a href="http://photo.blog.sina.com.cn/showpic.html#blogid=5fa2a27e0101cku5&amp;url=http://s9.sinaimg.cn/orignal/5fa2a27e4da16e6955598" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank"><img src="http://s9.sinaimg.cn/mw690/5fa2a27e4da16e6955598&amp;690" name="image\_operate\_48791365691917078" alt="Neo4j&nbsp;<wbr>的一些使用心得" title="Neo4j&nbsp;<wbr>的一些使用心得" style="border:0px;list-style:none;"></a><br><br><a href="http://photo.blog.sina.com.cn/showpic.html#blogid=5fa2a27e0101cku5&amp;url=http://s14.sinaimg.cn/orignal/5fa2a27e4da16e9b5fdcd" rel="nofollow" style="text-decoration:none;color:rgb(101,65,46);" target="\_blank"><img src="http://s14.sinaimg.cn/mw690/5fa2a27e4da16e9b5fdcd&amp;690" width="690" height="498" name="image\_operate\_31501365692121429" alt="Neo4j&nbsp;<wbr>的一些使用心得" title="Neo4j&nbsp;<wbr>的一些使用心得" style="border:0px;list-style:none;"></a><br> &nbsp;&nbsp;&nbsp;&nbsp;最终,一个致命的问题就是速度问题。从现有的MongoDB中把数据转存到Neo4j中,包括查重、设置属性、关系、建立索引等操作,完成一个点需要将近1秒的时间,这是无法忍受的速度。。。<br></div> <br><p></p> </div>
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

AndroidStudio封装SDK的那些事

<divclass"markdown\_views"<!flowchart箭头图标勿删<svgxmlns"http://www.w3.org/2000/svg"style"display:none;"<pathstrokelinecap"round"d"M5,00,2.55,5z"id"raphael