0
請提供一些示例以在使用java的密碼查詢中使用set子句。在春季密碼查詢中使用set子句
我只想更新關係對象的屬性,但總是失敗。 如果我運行查詢像
ExecutionResult executionResult = engine.execute("start n=node:Person(name=\"suresh\"),n2=node:Email(subject=\"Hi\") match (n)-[r]-(n2) return r ");
System.out.println(executionResult);
我得到像下面
+-----------------------------------------------------------------------------------------------------------------------------+
| r |
+-----------------------------------------------------------------------------------------------------------------------------+
| :DynamicRelationshipType[Have][69] {accessed->true,__type__->"org.test.spring.neo.domain.EmailRelationShip",relation->"To"} |
+-----------------------------------------------------------------------------------------------------------------------------+
1 rows, 260 ms
,但是當我試圖像
start n=node:Person(name=\"suresh\"),n2=node:Email(subject=\"Hi\") match (n)-[r]-(n2) CREATE SET r.accessed=true return r
運行查詢它總是失敗 堆棧跟蹤恰當的反應
expected return clause
"start n=node:Person(name="suresh"),n2=node:Email(subject="Hi") match (n)-[r]-(n2) CREATE SET r.accessed=true return r "
^
at org.neo4j.cypher.internal.parser.v1_6.CypherParserImpl.parse(CypherParserImpl.scala:65)
at org.neo4j.cypher.CypherParser.parse(CypherParser.scala:42)
at org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:60)
at org.neo4j.cypher.ExecutionEngine$$anonfun$prepare$1.apply(ExecutionEngine.scala:60)
at org.neo4j.cypher.internal.LRUCache.getOrElseUpdate(LRUCache.scala:31)
at org.neo4j.cypher.ExecutionEngine.prepare(ExecutionEngine.scala:60)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:54)
at org.neo4j.cypher.ExecutionEngine.execute(ExecutionEngine.scala:51)
at org.neo4j.cypher.javacompat.ExecutionEngine.execute(ExecutionEngine.java:63)
at org.test.spring.neo.controller.MediatorController.main(MediatorController.java:34)
我試圖執行像下面也不過這一個也沒有
ExecutionResult executionResult = engine.execute("start n=node:Person(name=\"suresh\"),n2=node:Email(subject=\"Hi\") match (n)-[r]-(n2) SET r.accessed=false return r ");
我指http://docs.neo4j.org/refcard/1.9/創建讀寫查詢
我使用SDN 1.8版。
請幫助
感謝您的答覆邁克爾。 這個解決方案完美的工作,當我在neo4j控制檯中使用它,如果我還沒有使用return子句。 但是當我試圖從java執行查詢時,這不起作用。 – user3169084
我試圖執行此查詢,就像 \t @Query(value =「start n = node:Person(name = {0}),n2 = node:Email(subject = {1})match(n) - [r ] - (n2)set r.accessed = true「) \t void setRead(String person,String Subject); 來自Spring應用程序,我在執行此操作時出錯。 – user3169084
你沒有添加return語句! –