neo4j 在Cypher中分隔花括号是什么意思?

9fkzdhlc  于 2023-01-13  发布在  其他
关注(0)|答案(2)|浏览(133)

我已经阅读了该文档,发现花括号通常用于形成子查询,或者可以用于描述节点或关系的属性。
但是我注意到有时花括号是分开使用的,我不明白它到底在做什么。
下面是单独使用的花括号的一些示例:

MATCH (p:Person)
RETURN
  p,
  p.name AS name,
  toUpper(p.name),
  coalesce(p.nickname, 'n/a') AS nickname,
  {name: p.name, label: head(labels(p))} AS person    // what is this sentence doing?
MATCH (e:Entity)-[r1:{}]-(t1:Entity)
WHERE e.lid IN {{qids}} AND e.name <> ""
WITH e, r1, t1
OPTIONAL MATCH  (t1)-[r2]-(t2:Entity)
WHERE t1.name = ""
   AND t2.name <> ""
   AND t2 <> e
WITH e, r1,  t1, r2, t2
WHERE t1.name <> "" OR (t2 IS NOT NULL AND  t2.name <> "")
RETURN e,
   { name : r1.name, labelId: r1.labelId, type: type(r1)  } as r1,  // this
   t1,
   { name : r2.name, labelId: r2.labelId, type: type(r2)  } as r2,  // and this
   t2
ORDER BY t2.score IS NOT NULL DESC, t1.score IS NOT NULL DESC,
   t2.score DESC, t1.score DESC
LIMIT 20

先谢谢你!

vuktfyat

vuktfyat1#

您实际上是在创建键值对的Map。

{ name: "Some-name", labelId: "some-value" ... }

相关问题