我很确定我应该看到我自己做的错误。我也很确定,我应该知道如何在java中构建一个体面的密码查询,但我根本无法。现在已经很晚了,自从过去4个小时以来,我一直对此感到震惊。所以,我放弃了。java neo4j密码查询匹配节点
我有一个相对简单的暗号询问我要执行对打开的事务端点
http://localhost:7474/db/data/transaction/[# number]
所以我想,我这样做只是创造一个节点,当我做到这一点,而只是匹配,而不是创建:
{"statements": [ {"statement": "MATCH (p:POST {properties}) RETURN p", "parameters": {"properties":{"sn_id": "TW", "id": "536627264453353472"}} } ] }
但是服务器告诉我,我不能在比赛中喜欢使用的参数图:
TRACE Neo4JPersistence - sending cypher {"statements": [ {"statement": "MATCH (p:POST {properties}) RETURN p", "parameters": {"properties":{"sn_id": "TW", "id": "536627264453353472"}} } ] } to endpoint http://localhost:7474/db/data/transaction/75
TRACE Neo4JPersistence - GET to http://localhost:7474/db/data/transaction/75 returned status code 200, returned data: {"commit":"http://localhost:7474/db/data/transaction/75/commit","results":[],"transaction":{"expires":"Sun, 23 Nov 2014 21:09:05 +0000"},"errors":[{"code":"Neo.ClientError.Statement.InvalidSyntax","message":"Parameter maps cannot be used in MATCH patterns (use a literal map instead, eg. \"{id: {param}.id}\") (line 1, column 15)\n\"MATCH (p:POST {properties}) RETURN p\"\n ^"}]}
ERROR Neo4JPersistence - ERROR :: [{"message":"Parameter maps cannot be used in MATCH patterns (use a literal map instead, eg. \"{id: {param}.id}\") (line 1, column 15)\n\"MATCH (p:POST {properties}) RETURN p\"\n ^","code":"Neo.ClientError.Statement.InvalidSyntax"}] - could not execute cypher statement at location http://localhost:7474/db/data/transaction/75
所以,好吧,我想。让我们去的东西简单,我构建了我的暗号是这样的:
{"statements": [ {"statement": "MATCH (p:SOCIALNETWORK {"sn_id": "TW"}) RETURN p"} ] }
但对于这一点,服务器返回它无法反序列化的要求,它不喜欢的S - 无论s表示是。
这里的堆栈跟踪它:
TRACE Neo4JPersistence - sending cypher {"statements": [ {"statement": "MATCH (p:SOCIALNETWORK {"sn_id": "TW"}) RETURN p"} ] } to endpoint http://localhost:7474/db/data/transaction/76
TRACE Neo4JPersistence - GET to http://localhost:7474/db/data/transaction/76 returned status code 200, returned data: {"commit":"http://localhost:7474/db/data/transaction/76/commit","results":[],"transaction":{"expires":"Sun, 23 Nov 2014 21:18:01 +0000"},"errors":[{"code":"Neo.ClientError.Request.InvalidFormat","message":"Unable to deserialize request: Unexpected character ('s' (code 115)): was expecting comma to separate OBJECT entries\n at [Source: [email protected]{[email protected]{r=10,a=DISPATCHED,uri=/db/data/transaction/76},[email protected]{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=END,87 of 87}}; line: 1, column: 59]"}]}
ERROR Neo4JPersistence - ERROR :: [{"message":"Unable to deserialize request: Unexpected character ('s' (code 115)): was expecting comma to separate OBJECT entries\n at [Source: [email protected]{[email protected]{r=10,a=DISPATCHED,uri=\/db\/data\/transaction\/76},[email protected]{FILLING},g=HttpGenerator{s=START},p=HttpParser{s=END,87 of 87}}; line: 1, column: 59]","code":"Neo.ClientError.Request.InvalidFormat"}] - could not execute cypher statement at location http://localhost:7474/db/data/transaction/76
我被卡住,现在感到沮丧。任何人都可以帮助我吗?
感谢这么多提前,
基督教
非常感谢。我得到它与您的答案一起工作。但是仍有一个问题。我如何获得id,或者甚至更好的是通过上面的查询找到的节点的url。我希望能够通过查询接收扩展json结构,所以我可以在json中使用自己的字段。但它看起来并不像返回。你能指导我吗? – siliconchris 2014-11-24 20:28:43
返回ID(p)会给你另一个带有节点ID的列。如果您想要节点的完整URL,请在{“statements”中包含resultDataContents:[“REST”]:[{“statement”:“MATCH(p:SOCIALNETWORK {sn_id:'TW'})RETURN p”, “resultDataContents”:[“REST”]}]}请参阅http://neo4j.com/docs/stable/rest-api-transactional.html#rest-api-execute-statements-in-an-open-transaction-in -rest-format-for-the return – Luanne 2014-11-25 03:58:22
得到它的工作。对于所有人来说,她是一个 – siliconchris 2014-11-27 11:14:17