use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByMultipleAndPropertiesGreaterThanWithDifferentOrder.
// DATAGRAPH-629
@Test
public void testFindByMultipleAndPropertiesGreaterThanWithDifferentOrder() {
Filter nameParam = new Filter("name", ComparisonOperator.EQUALS, "AST-1");
nameParam.setBooleanOperator(BooleanOperator.AND);
Filter diameterParam = new Filter("diameter", ComparisonOperator.GREATER_THAN, 60);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(diameterParam).add(nameParam), 2).getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`diameter` > $`diameter_0` AND n.`name` = $`name_1` WITH n MATCH p=(n)-[*0..2]-(m) RETURN p, ID(n)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByNestedPropertiesOnTheSameEntityOredNotFollowingEachOtherDirectlyWithAnotherFilter.
// Would be something like findByMoonSomethingORFindByPlanetXOrFindByPlanetY
@Test(expected = UnsupportedOperationException.class)
public void testFindByNestedPropertiesOnTheSameEntityOredNotFollowingEachOtherDirectlyWithAnotherFilter() {
Filter planetParam = collidesWithEarthFilter();
Filter planetParam2 = collidesWithMarsFilter();
planetParam2.setBooleanOperator(BooleanOperator.OR);
Filter moonParam = orbitsMoonFilter();
moonParam.setBooleanOperator(BooleanOperator.OR);
queryStatements.findByType("Asteroid", new Filters().add(planetParam).add(moonParam).add(planetParam2), 1).getStatement();
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByProperty.
@Test
public void testFindByProperty() {
String statement = queryStatements.findByType("Asteroid", new Filters().add(new Filter("diameter", ComparisonOperator.EQUALS, 60.2)), 4).getStatement();
assertThat(statement).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`diameter` = $`diameter_0` WITH n MATCH p=(n)-[*0..4]-(m) RETURN p, ID(n)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByPropertyGreaterThan.
// DATAGRAPH-629
@Test
public void testFindByPropertyGreaterThan() {
Filter parameter = new Filter("diameter", ComparisonOperator.GREATER_THAN, 60);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(parameter), 4).getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`diameter` > $`diameter_0` WITH n MATCH p=(n)-[*0..4]-(m) RETURN p, ID(n)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByDifferentNestedPropertiesAnded.
// DATAGRAPH-629
@Test
public void testFindByDifferentNestedPropertiesAnded() {
Filter planetParam = collidesWithEarthFilter();
Filter moonParam = orbitsMoonFilter();
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` " + "MATCH (m1:`Moon`) WHERE m1.`name` = $`moon_name_1` MATCH (n)-[:`COLLIDES`]->(m0) " + "MATCH (n)<-[:`ORBITS`]-(m1) WITH DISTINCT n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
}
Aggregations