use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByMultipleNestedPropertiesAnded.
// DATAGRAPH-629
@Test
public void testFindByMultipleNestedPropertiesAnded() {
Filter planetParam = collidesWithEarthFilter();
Filter moonParam = new Filter("size", ComparisonOperator.EQUALS, "5");
moonParam.setNestedPropertyName("collidesWith");
moonParam.setNestedEntityTypeLabel("Planet");
moonParam.setRelationshipType("COLLIDES");
moonParam.setRelationshipDirection(Relationship.Direction.OUTGOING);
moonParam.setBooleanOperator(BooleanOperator.AND);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(planetParam).add(moonParam), 1).getStatement()).isEqualTo("MATCH (n:`Asteroid`) MATCH (m0:`Planet`) WHERE m0.`name` = $`collidesWith_name_0` AND m0.`size` = $`collidesWith_size_1` MATCH (n)-[:`COLLIDES`]->(m0) WITH DISTINCT n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class ParameterisedStatementTest method findByPropertyStandardForm.
@Test
public void findByPropertyStandardForm() throws Exception {
query = nodeQueryStatements.findByType("Asteroid", new Filters().add(new Filter("diameter", ComparisonOperator.EQUALS, 6.02E1)), 1);
assertThat(query.getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`diameter` = $`diameter_0` WITH n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
assertThat(mapper.writeValueAsString(query.getParameters())).isEqualTo("{\"diameter_0\":60.2}");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class ParameterisedStatementTest method testFindByPropertyWithIllegalCharacter.
// DATAGRAPH-631
@Test
public void testFindByPropertyWithIllegalCharacter() throws Exception {
query = new RelationshipQueryStatements().findByType("HAS-ALBUM", new Filters().add(new Filter("fake-property", ComparisonOperator.EQUALS, "none")), 1);
assertThat(query.getStatement()).isEqualTo("MATCH (n)-[r0:`HAS-ALBUM`]->(m) WHERE r0.`fake-property` = $`fake-property_0` WITH DISTINCT(r0) as r0,startnode(r0) AS n, endnode(r0) AS m MATCH p1 = (n)-[*0..1]-() WITH r0, COLLECT(DISTINCT p1) AS startPaths, m MATCH p2 = (m)-[*0..1]-() WITH r0, startPaths, COLLECT(DISTINCT p2) AS endPaths WITH r0,startPaths + endPaths AS paths UNWIND paths AS p RETURN DISTINCT p, ID(r0)");
assertThat(mapper.writeValueAsString(query.getParameters())).isEqualTo("{\"fake-property_0\":\"none\"}");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class RelationshipDeleteStatementsTest method testDeleteWithTypeAndFiltersAndList.
@Test
public void testDeleteWithTypeAndFiltersAndList() {
CypherQuery query = statements.deleteAndList("INFLUENCE", new Filters().add(new Filter("score", ComparisonOperator.EQUALS, -12.2)));
assertThat(query.getStatement()).isEqualTo("MATCH (n)-[r0:`INFLUENCE`]->(m) WHERE r0.`score` = $`score_0` DELETE r0 RETURN ID(r0)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class RelationshipDeleteStatementsTest method testDeleteWithTypeAndFilters.
@Test
public void testDeleteWithTypeAndFilters() {
CypherQuery query = statements.delete("INFLUENCE", new Filters().add(new Filter("score", ComparisonOperator.EQUALS, -12.2)));
assertThat(query.getStatement()).isEqualTo("MATCH (n)-[r0:`INFLUENCE`]->(m) WHERE r0.`score` = $`score_0` DELETE r0");
}
Aggregations