use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByMultipleOrPropertiesGreaterThanWithDifferentOrder.
// DATAGRAPH-629
@Test
public void testFindByMultipleOrPropertiesGreaterThanWithDifferentOrder() {
Filter nameParam = new Filter("name", ComparisonOperator.EQUALS, "AST-1");
nameParam.setBooleanOperator(BooleanOperator.OR);
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` OR 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 testFindByNestedPropertyOutgoing.
// DATAGRAPH-629
@Test
public void testFindByNestedPropertyOutgoing() {
Filter planetParam = collidesWithEarthFilter();
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)");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByMultipleNestedPropertiesOred.
// DATAGRAPH-662
@Test(expected = UnsupportedOperationException.class)
public void testFindByMultipleNestedPropertiesOred() {
Filter diameterParam = new Filter("diameter", ComparisonOperator.GREATER_THAN, 60);
Filter planetParam = new Filter("name", ComparisonOperator.EQUALS, "Earth");
planetParam.setBooleanOperator(BooleanOperator.OR);
planetParam.setNestedPropertyName("collidesWith");
planetParam.setNestedEntityTypeLabel("Planet");
planetParam.setRelationshipType("COLLIDES");
planetParam.setRelationshipDirection(Relationship.Direction.OUTGOING);
queryStatements.findByType("Asteroid", new Filters().add(diameterParam).add(planetParam), 1).getStatement();
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class ParameterisedStatementTest method findByPropertyWildcardLike.
@Test
public void findByPropertyWildcardLike() throws JsonProcessingException {
Filter filter = new Filter("ref", ComparisonOperator.LIKE, "*nia");
query = nodeQueryStatements.findByType("Asteroid", new Filters().add(filter), 1);
assertThat(mapper.writeValueAsString(query.getParameters())).isEqualTo("{\"ref_0\":\"(?i).*nia\"}");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class ParameterisedStatementTest method findByPropertyStringValue.
@Test
public void findByPropertyStringValue() throws Exception {
query = nodeQueryStatements.findByType("Asteroid", new Filters().add(new Filter("ref", ComparisonOperator.EQUALS, "45 Eugenia")), 1);
assertThat(query.getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`ref` = $`ref_0` WITH n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
assertThat(mapper.writeValueAsString(query.getParameters())).isEqualTo("{\"ref_0\":\"45 Eugenia\"}");
}
Aggregations