我知道我使用的云代码如下
LOAD CSV WITH HEADERS FROM "https://gist.githubusercontent.com/jexp/d788e117129c3730a042/raw/c5f98f269b4a219ebb88bd3eb83d331f439a8201/people.csv"
AS line
WITH line
WHERE line.PersonName IS NOT NULL
RETURN line.PersonName, coalesce(line.Company,"None")
但在我的情况下,line的许多属性为null。我可以在neo4j中迭代行(map结构)吗?可能像for k,v in line
。
答案 0 :(得分:1)
正如MicTech所说,COALESCE
这里将完成这项工作。
对于你的问题,你可以迭代线图的k,v:
LOAD CSV
WITH HEADERS FROM "https://gist.githubusercontent.com/ikwattro/29d133f8b2a8f022f5c9/raw/adbab9762ff0a15df18b49c9765ba3377d0e3ece/mockdata.csv" AS line
WITH line
UNWIND keys(line) as k
RETURN k, line[k] as v
答案 1 :(得分:1)
应该可以在2.3
WHERE none(k in keys(line) WHERE line[key] IS NULL)
在2.2.x中,我认为迭代的唯一方法是使用LOAD CSV FROM ... AS line
语法将该行作为字符串集合返回。但是你失去了通过钥匙的访问权。
LOAD CSV FROM ... AS line
WHERE NONE(value in line WHERE values IS null)
...