0
我有一個像'Persons'這樣的節點和一個名爲'RELATION'的關係與一個像'BIOLOGICAL_MOTHER'這樣的動態類型的圖。在Cypher中只返回一個布爾行,而不是零
要檢查,如果一個人在家長的角色我想用一個暗號查詢返回一個布爾值列,而不是NULL或別的東西。
我使用Spring數據的Neo4j 4,這是人的倉庫下面的方法:
@Query("OPTIONAL MATCH (child)-[r:RELATION]->(parent) " +
"RETURN DISTINCT " +
"CASE " +
"WHEN id(parent)={0} AND r IS NOT NULL AND (r.type='BIOLOGICAL_MOTHER' OR r.type='BIOLOGICAL_FATHER') " +
"THEN true " +
"ELSE false " +
"END")
boolean isParentRole(long id);
如果我查詢這對父母的人,下面的錯誤回報:
More than one element in org.neo4j.helpers.collection.IterableWrapper
[email protected]
First element is 'true' and the second element is 'false'
如何使用所有結果行的「或」來返回只有一行(在這種情況下爲true)?