Closed michael-simons closed 4 years ago
Sure @michael-simons! As soon the build is done, I will test it.
@michael-simons, I still have troubles with AND group. here is my unit test with the expected assertion:
@Test
void gh184() {
final Node r = node("Resume").named("r");
final Node u = node("UserSearchable").named("u");
final Node o = node("Offer").named("o");
Statement s = match(r.relationshipFrom(u, "HAS"))
.where(r.hasLabels(LastResume.name()).not())
.and(coalesce(o.property("valid_only"), literalFalse()).isEqualTo(literalFalse())
.and(r.hasLabels(InvalidStatus.name()).not())
.or(o.property("valid_only").isTrue()
.and(r.hasLabels(ValidStatus.name()))))
.and(r.property("is_internship").isTrue()
.and(size(r.relationshipTo(Cypher.anyNode(),"PART_OF")).isEmpty())
.not())
.and(r.property("is_sandwich_training").isTrue()
.and(size(r.relationshipTo(Cypher.anyNode(),"PART_OF")).isEmpty())
.not())
.returningDistinct(r, o)
.build();
assertThat(cypherRenderer.render(s))
.isEqualTo("MATCH (r:`Resume`)<-[:`HAS`]-(u:`UserSearchable`) WHERE (NOT (r:`LastResume`) AND (((coalesce(o.valid_only, false) = false) AND NOT r:`InvalidStatus`) OR (o.valid_only = true AND r:`ValidStatus`)) AND NOT ((r.is_internship = true AND size(size((r)-[:`PART_OF`]->())) = 0)) AND NOT ((r.is_sandwich_training = true AND size(size((r)-[:`PART_OF`]->())) = 0))) RETURN DISTINCT r, o");
}
FYI, I'm using the 1.0.0-cd2216fe697ca7555db026423fbeac2555da8291 build release.
Actually, I think the output is correct. Added a formatted test… Please have a look @meistermeier as well.
Ok, got it… Gerrit focused my view on all those (
👍
All good! Thanks! Tested on built branch (1.0.0-508859e0acbc8ba889240d00b2bc946721957087)
Please, @romain-rossi, would you mind having a look as well?