简体   繁体   English

Neo4j查询调试

[英]Neo4j query debugging on

I am trying to modify an existing neo4j cypher query in scala code which work but when I try to run the query below in debugger it gives me the error as below: Query: 我正在尝试在可用的Scala代码中修改现有的neo4j密码查询,但是当我尝试在调试器中运行以下查询时,它给我以下错误:查询:

START  doc = node:entities(type = "document-link")
MATCH  category-[:category]-doc<-[:`document-link`]-project-[?:`iati-identifier`]-id
RETURN COALESCE(project.`iati-identifier`?, id.`iati-identifier`?) as id,
   doc.title!                                                  as title,
   COALESCE(doc.format?, "text/plain")                         as format,
   doc.url                                                     as url,
   COLLECT(COALESCE(category.category?, ""))                   as categories

The error I get Question mark is no longer used for optional patterns - use OPTIONAL MATCH instead (line 2, column 64) " MATCH category-[:category]-doc<-[: document-link ]-project-[?: iati-identifier ]-id" 我收到的错误问号不再用于可选模式-改用OPTIONAL MATCH(第2行,第64列)“ MATCH类别-[:category] ​​-doc <-[: document-link ] iati-identifier [?: iati-identifier ] -id“

How can I rewrite the query so that it can be ran in the debugger as that will then allow me write my modification test the new cypher. 我该如何重写查询,以便可以在调试器中运行该查询,然后允许我将修改测试写入新密码。 Additionally, why is the debugger not willing to accept the code that I know is working in the main code base? 另外,为什么调试器不愿意接受我知道在主代码库中工作的代码?

sorry wanted to attach an image but I don't have enough reputation yet to post images. 抱歉,想要附加图像,但我没有足够的声誉来发布图像。

Not sure what you mean about the debugger, but the ? 不确定您对调试器的含义,但是? for an optional pattern hasn't been supported for a while now. 暂时尚不支持可选模式。 Which version of Neo4j are you using? 您正在使用哪个版本的Neo4j? The error message indicates that the version you're using does not support the ? 错误消息表明您使用的版本不支持? so you will have to rewrite your query using OPTIONAL MATCH. 因此您将不得不使用OPTIONAL MATCH重写查询。

It looks like your :iati-identifier relation is optional so move that into the OPTIONAL MATCH and then if it exists it will be matched, else id will be null. 看起来您的:iati-identifier关系是可选的,因此将其移动到OPTIONAL MATCH中,然后将其匹配,否则id为null。 Similarly remove all the ? 同样删除所有? from the properties in the return statement- they'll just be null if missing. 来自return语句中的属性-如果丢失,则它们将为null。

START  doc = node:entities(type = "document-link")
MATCH  category-[:category]-doc<-[:`document-link`]-project
OPTIONAL MATCH project-[:`iati-identifier`]-id
RETURN COALESCE(project.`iati-identifier`, id.`iati-identifier`) as id,
   doc.title                                                  as title,
   COALESCE(doc.format, "text/plain")                         as format,
   doc.url                                                    as url,
   COLLECT(COALESCE(category.category, ""))                   as categories

(untested query) (未经测试的查询)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM