0
私の前の質問に続けてNeo4j Cypher query null or INTenant
ノードにisPublic
プロパティを追加しました。Neo4j Cypherブール条件とIN
今すぐfrant.hartmで作成されたクエリを拡張して、parentD
とchildD
テナントのisPublic
条件の追加チェックを追加する必要があります。
私は次の私の文を拡張しています
t.isPublic OR t in tenants WHERE (parentD)-[:BELONGS_TO]-(t)
が、それは次の例外で失敗します
MATCH (t:Tenant) WHERE ID(t) in {tenantIds}
WITH COLLECT(t) as tenants
MATCH (parentD)-[:CONTAINS]->(childD:Decision)-[ru:CREATED_BY]->(u:User)
WHERE
id(parentD) = {decisionId}
AND
(not(parentD)-[:BELONGS_TO]-(:Tenant) OR any(t.isPublic OR t in tenants WHERE (parentD)-[:BELONGS_TO]-(t)))
AND
(not (childD)-[:BELONGS_TO]-(:Tenant) OR any(t.isPublic OR t in tenants WHERE (childD)-[:BELONGS_TO]-(t)))
RETURN ru, u, childD
ORDER BY childD.createDate ASC
SKIP 0 LIMIT 100
:完全なクエリは、今のように見える
org.neo4j.ogm.exception.CypherException: Error executing Cypher; Code: Neo.ClientError.Statement.SyntaxError; Description: Invalid input 'W': expected whitespace, comment, '{', node labels, MapLiteral, a parameter, a relationship pattern, '(', '.', '[', "=~", IN, STARTS, ENDS, CONTAINS, IS, '^', '*', '/', '%', '+', '-', '=', "<>", "!=", '<', '>', "<=", ">=", AND, XOR, OR, ',' or ')' (line 1, column 254 (offset: 253))
"MATCH (t:Tenant) WHERE ID(t) in {tenantIds} WITH COLLECT(t) as tenants MATCH (parentD)-[:CONTAINS]->(childD:Decision)-[ru:CREATED_BY]->(u:User) WHERE id(parentD) = {decisionId} AND (not(parentD)-[:BELONGS_TO]-(:Tenant) OR any(t.isPublic OR t in tenants WHERE (parentD)-[:BELONGS_TO]-(t))) AND (not (childD)-[:BELONGS_TO]-(:Tenant) OR any(t.isPublic OR t in tenants WHERE (childD)-[:BELONGS_TO]-(t))) RETURN ru, u, childD ORDER BY childD.createDate ASC SKIP 0 LIMIT 100"
^
at org.neo4j.ogm.drivers.embedded.request.EmbeddedRequest.executeRequest(EmbeddedRequest.java:175)
at org.neo4j.ogm.drivers.embedded.request.EmbeddedRequest.execute(EmbeddedRequest.java:66)
t.isPublic
をサポートするためにこのクエリを修正するにはどうすればよいですか?
この回答に感謝します。この場合、クエリは例外なく動作しますが、ここで 't.isPublic'のように見えるのは意味がありません。最終的に' tennats'で 't'をチェックします。しかし' tenant'は 't .isPublic == true' ..代わりに 't.isPublic'条件専用の3番目の' OR'文を追加するべきでしょうか? – alexanoid
以前私は{テナント}のテナントに属する決定のために、どのテナントにも属さない決定のために2つの条件を持っていましたが、今はisPublic == trueでテナントに属する決定の第3条件を追加しなければなりません。今私は追加のORステートメントのためにこのブールステートメントを書く方法を知らない – alexanoid