问题标签 [neo4jphp]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
neo4j - Neo4j 和 Php 在事务中处理计数器
那么场景是这样的:
我创建了一个名为counter node
. 它的初始值为 0 并随着用户在我的网站上创建其帐户而递增。
所以发生了三个操作来操作这个:
读取counter node
值
在 php 中做一些逻辑。这里就像对计数器节点的先前值 +1
写计数器节点的新值
现在的问题是,如果两个或更多用户在同一时间到达并创建这样的条件
在第一个用户向计数器节点写入新值之前,第二个用户正在读取它。因此,这将使我的“计数器节点”的值处于不稳定状态。
希望你明白我的意思..
任何解决方案??
我正在使用 neo4j 1.9.5 和 php
php 贾德尔:
https://github.com/jadell/Neo4jPHP </p>
我听说过批处理,但不确定它是否会起作用。如果有任何解决方案,请给我一个简短的例子。
谢谢阿米特阿加瓦尔
neo4j - Neo4j PHP 获取写入锁
陷入大麻烦,
那么谁能告诉我,我怎样才能通过密码获得写锁。注意:我将使用 REST API,所以我的密码会在 php.ini 中。
编辑:场景:
我正在使用 Neo4j REST 服务器和 PHP 来访问它。
现在我创建了一个节点说'counter-node',它生成新的用户ID。逻辑只是将前一个值加 1。
现在,如果两个用户同时出现,那么第一个用户在将其更新为 1 之前读取了“counter-node”值,第二个用户读取了它。因此,“反节点”中的值与预期不同。
任何帮助
transactions - what does transaction mean in reference with neo4j database
I got a bit confuse with term transaction. Suppose in transaction A we have two commands C1 and C2 and same in transaction B. Now both transaction come at same time then Are these observations correct?
All commands of transaction A C1 and C2 will be done first (assuming A enter first) , then only commands of transaction B will be executed.
Any command of transaction A or B can be executed but with assurance that If any of the command fails of any of the transaction then that transaction will be rollback.
If second case is true then in transaction by default, it do not lock any resource until its completion
If first case is true then by default transaction hold lock on resources until their completion.
thanks
Amit Aggarwal
php - 如何解析 Everyman\Neo4j\Exception
解析 Everyman\Neo4j\Exception 的最佳方法是什么?
getMessage() 方法返回相当长的字符串,我只对
字符串的一部分。
rest - 在不使用密码的情况下使用 neo4jphp/RESTAPI 进行分页
任何人都可以帮助我了解如何使用 neo4j php 或 REST API 实现分页,但我不想使用 cypher。我正在寻找 neo4j Traversal 和 neo4j Fulltext Index 结果的分页。
对于遍历结果,我试图找到一种使用偏移和限制结果的方法,但除了 cypher 之外我没有看到其他任何地方。
我看到有可以在 neojphp 中创建的 Pager 对象,但它允许的唯一选项是调整页面大小和租用时间,除非我遍历所有以前的 n,否则我无法登陆特定页面偏移量或偏移量-1 页使用 getNextResults() 函数获取第 n 页。这似乎是一种低效的方式。
我还可以看到 java api 中有一个 PagingIterator 类或惰性迭代器,它具有允许设置迭代的当前页面的页面功能,这似乎解决了这个问题,但我无法理解如何使用 neo4jphp 或 REST api 使用它.
对于 neo4j 全文索引(lucene),我仍然看不到我应该如何使用 FT 索引的分页。我认为在lucene中应该是可能的。但我不确定如何使用 neo4jphp 或 REST API 做到这一点。总的来说,我认为 PagingIterator 类在这里也可能有所帮助,但不确定如何。需要一些帮助或指导。谢谢!
rest - 如何在 neo4j FT 索引查询中仅获取前 100 个匹配结果
如何在 neo4j FT 索引查询中仅获取前 100 个匹配结果。我确信对于常见的搜索,索引将匹配数千个节点,但我只需要说前 100 个得分最高的匹配项。我应该设置什么配置设置或查询上下文来实现这一点。在没有密码的 REST API 中这怎么可能。要获得这 100 个得分最高的全文匹配项,必须使用 cypher。谢谢你的帮助!
neo4j - 插入数据时出现 Neo4j 异常
我正在尝试使用脚本将批量数据插入 Neo4j。一段时间后,脚本因以下异常而中断。
相同的查询从控制台工作,并从发生异常的同一点重新启动脚本再次工作一段时间,直到它再次失败。捕获异常并使脚本休眠几秒钟不会破坏脚本。
关于这里可能发生的事情有什么建议吗?
更新:添加了一个示例查询
security - neo4j:身份验证 - 只允许读取密码查询
我正在使用 neo4j 1.9.4,我想在使用 neo4jphp 的(公共)网站上显示有关图表的一些信息。为了获取一些数据,我在 neo4jphp 中使用密码查询。这些查询显然只从图中读取数据。
我必须确保网站的访问者无法修改图表中的任何数据。因此,我设置了身份验证扩展插件并创建了两个用户(一个具有只读“RO”和一个具有读写“RW”访问权限),如文档所述。但是,neo4jphp 中的密码查询仅适用于具有 RW 权限的用户,但不适用于具有 RO 权限的用户。
我知道http://docs.neo4j.org/chunked/stable/security-server.html#_security_in_depth几乎解释了如何保护 neo4j,但我绝对不知道如何做到这一点。特别是“arbitrary_code_execution”部分似乎很有趣,但我不知道如何利用它。
如何实现可以从 Web 服务器执行读取密码查询?顺便说一句:Web 服务器(显示一些结果)和 neo4j 在不同的机器上运行。
我将不胜感激任何帮助,谢谢!
编辑:我的场景实际上并没有那么复杂,所以我确信必须有一个解决方案:从 localhost 授予任何访问权限(读写),而来自远程 Web 服务器的访问权限仅限于从图形中读取。我怎样才能做到这一点?如果这是不可能的:我如何限制从远程 Web 服务器对某些预定义(密码)查询的访问,其中用户只能提供一些参数?
neo4j - Neo4j - 遍历以找到特定的连接组件
使用neo4j 1.9.4,我试图从关系具有特定属性(' since ')的起始节点找到连接的组件(所有可达节点),并且该属性具有定义的整数值,例如20130101。
我最初的方法是使用密码查询,但我觉得如果图中有一个循环,这个查询会循环到无穷大?至少如果我不限制路径长度并且限制长度不是我想要做的。
所以同时我开始使用遍历。使用 neo4jphp 遍历看起来像这样:
我认为我需要的是这样的:
显然,RELATIONSHIP和EQUALS似乎是错误的。我从示例https://github.com/jadell/neo4jphp/wiki/Traversals中采用了这一点,其中设置了以下有效且有效的 pruneElevater:
我绝对不熟悉 JavaScript,所以我不知道该怎么做。此外,如果存在不具有属性“因为”的关系,我如何确保遍历不会导致错误?如果我可以使用密码查询来实现相同的目标,我也会接受。
编辑:顺便说一句,我使用密码的方法是这样的:
EDIT2:尝试从 ulkas 建议的密码查询给我以下错误:
EDIT3:LameCode 的建议看起来很有希望,但它仍然返回错误:
我使用了以下 pruneEvaluator:
当从lastRelationship()更改为endNode( )时,它至少不会返回错误,尽管我想知道它返回的许多结果,因为没有一个节点完全具有这个 since 属性?!因此,即使在那时,修剪评估器似乎也没有开始工作。如果没有自属性或者它不等于给定日期,我希望它在每个 endNode 处停止?我做错了什么,有什么想法吗?
performance - Neo4j 1.9.4 (REST Server,CYPHER) performance issue
I have Neo4j 1.9.4 installed on 24 core 24Gb ram (centos) machine and for most queries CPU usage spikes goes to 200% with only few concurrent requests.
Domain:
some sort of social application where few types of nodes(profiles) with 3-30 text/array properties and 36 relationship types with at least 3 properties. Most of nodes currently has ~300-500 relationships.
Current data set footprint(from console):
which is IMHO really small. most queries looks like this one(with more or less WITH .. MATCH .. statements and few queries with variable length relations but the often fast):
it runs in ~1s-3s(for first run) and ~1s-70ms (for consecutive and it depends on query) and there is about 5-10 queries runs for each impression. Another interesting behavior is when i try run query from console(neo4j) on my local machine many consecutive times(just press ctrl+enter for few seconds) it has almost constant execution time but when i do it on server it goes slower exponentially and i guess it somehow related with my problem.
Problem:
So my problem is that neo4j is very CPU greedy(for 24 core machine its may be not an issue but its obviously overkill for small project). First time i used AWS EC2 m1.large instance but over all performance was bad, during testing, CPU always was over 100%.
Some relevant parts of configuration:
note: I already tried configuration where all memory related parameters where HIGH and it didn't worked(no change at all).
Question:
Where to digg? configuration? scheme? queries? what i'm doing wrong?
if need more info(logs, configs) just ask ;)