use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByPropertyLessThan.
// DATAGRAPH-629
@Test
public void testFindByPropertyLessThan() {
Filter parameter = new Filter("diameter", ComparisonOperator.LESS_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 testFindByMultipleNestedProperties.
// DATAGRAPH-629
@Test
public void testFindByMultipleNestedProperties() {
Filter diameterParam = new Filter("diameter", ComparisonOperator.GREATER_THAN, 60);
Filter planetParam = new Filter("name", ComparisonOperator.EQUALS, "Earth");
planetParam.setBooleanOperator(BooleanOperator.AND);
planetParam.setNestedPropertyName("collidesWith");
planetParam.setNestedEntityTypeLabel("Planet");
planetParam.setRelationshipType("COLLIDES");
planetParam.setRelationshipDirection(Relationship.Direction.OUTGOING);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(diameterParam).add(planetParam), 1).getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`diameter` > $`diameter_0` MATCH (m0:`Planet`) WHERE m0.`name` = $`collidesWith_name_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 NodeQueryStatementsTest method testFindByPropertyLessThanEqual.
// DATAGRAPH-904
@Test
public void testFindByPropertyLessThanEqual() {
Filter parameter = new Filter("diameter", ComparisonOperator.LESS_THAN_EQUAL, 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 testFindByPropertyWithInfiniteValue.
// DATAGRAPH-781
@Test
public void testFindByPropertyWithInfiniteValue() {
PagingAndSortingQuery pagingAndSortingQuery = queryStatements.findByType("Asteroid", new Filters().add(new Filter("albedo", ComparisonOperator.EQUALS, -12.2)), 0);
assertThat(pagingAndSortingQuery.getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`albedo` = $`albedo_0` WITH n RETURN n");
assertThat((double) pagingAndSortingQuery.getParameters().get("albedo_0")).isEqualTo(-12.2, within(0.005));
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByNestedPropertyIncoming.
// DATAGRAPH-629
@Test
public void testFindByNestedPropertyIncoming() {
Filter planetParam = new Filter("name", ComparisonOperator.EQUALS, "Earth");
planetParam.setNestedPropertyName("collidesWith");
planetParam.setNestedEntityTypeLabel("Planet");
planetParam.setRelationshipType("COLLIDES");
planetParam.setRelationshipDirection(Relationship.Direction.INCOMING);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(planetParam), 1).getStatement()).isEqualTo("MATCH (n:`Asteroid`) MATCH (m0:`Planet`) WHERE m0.`name` = $`collidesWith_name_0` MATCH (n)<-[:`COLLIDES`]-(m0) WITH DISTINCT n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
}
Aggregations