use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeDeleteStatementsTest method testDeleteWithLabelAndFilters.
@Test
public void testDeleteWithLabelAndFilters() {
CypherQuery query = statements.delete("INFLUENCE", new Filters().add(new Filter("score", ComparisonOperator.EQUALS, -12.2)));
assertThat(query.getStatement()).isEqualTo("MATCH (n:`INFLUENCE`) " + "WHERE n.`score` = $`score_0` " + "WITH n " + "OPTIONAL MATCH (n)-[r0]-() " + "DELETE r0, n");
}
use of org.neo4j.ogm.cypher.Filters in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindByMultipleAndPropertiesLessThan.
// DATAGRAPH-629
@Test
public void testFindByMultipleAndPropertiesLessThan() {
Filter nameParam = new Filter("name", ComparisonOperator.EQUALS, "AST-1");
Filter diameterParam = new Filter("diameter", ComparisonOperator.LESS_THAN, 60);
diameterParam.setBooleanOperator(BooleanOperator.AND);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(nameParam).add(diameterParam), 2).getStatement()).isEqualTo("MATCH (n:`Asteroid`) WHERE n.`name` = $`name_0` AND n.`diameter` < $`diameter_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 testFindByNestedBaseAndREProperty.
// DATAGRAPH-632
@Test
public void testFindByNestedBaseAndREProperty() {
Filter planetParam = new Filter("totalDestructionProbability", ComparisonOperator.EQUALS, "20");
planetParam.setNestedPropertyName("collision");
// Collision is an RE
planetParam.setNestedEntityTypeLabel("Collision");
planetParam.setNestedRelationshipEntity(true);
// assume COLLIDES is the RE type
planetParam.setRelationshipType("COLLIDES");
planetParam.setRelationshipDirection(Relationship.Direction.OUTGOING);
planetParam.setNestedRelationshipEntity(true);
Filter moonParam = orbitsMoonFilter();
moonParam.setBooleanOperator(BooleanOperator.AND);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(planetParam, moonParam), 1).getStatement()).isEqualTo("MATCH (n:`Asteroid`) MATCH (n)-[r0:`COLLIDES`]->(m0) " + "WHERE r0.`totalDestructionProbability` = $`collision_totalDestructionProbability_0` " + "MATCH (m1:`Moon`) WHERE m1.`name` = $`moon_name_1` MATCH (n)<-[:`ORBITS`]-(m1) 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 testFindByPropertyGreaterThanEqual.
// DATAGRAPH-904
@Test
public void testFindByPropertyGreaterThanEqual() {
Filter parameter = new Filter("diameter", ComparisonOperator.GREATER_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 testFindByMultipleNestedREProperty.
// GH-279
@Test
public void testFindByMultipleNestedREProperty() {
Filter planetParam = new Filter("totalDestructionProbability", ComparisonOperator.EQUALS, "20");
planetParam.setNestedPropertyName("collision");
// Collision is an RE
planetParam.setNestedEntityTypeLabel("Collision");
planetParam.setNestedRelationshipEntity(true);
// assume COLLIDES is the RE type
planetParam.setRelationshipType("COLLIDES");
planetParam.setRelationshipDirection(Relationship.Direction.OUTGOING);
planetParam.setNestedRelationshipEntity(true);
Filter satelliteParam = new Filter("signalStrength", ComparisonOperator.GREATER_THAN_EQUAL, "400");
satelliteParam.setBooleanOperator(BooleanOperator.AND);
satelliteParam.setNestedPropertyName("monitoringSatellites");
// Collision is an RE
satelliteParam.setNestedEntityTypeLabel("Satellite");
satelliteParam.setNestedRelationshipEntity(true);
// assume COLLIDES is the RE type
satelliteParam.setRelationshipType("MONITORED_BY");
satelliteParam.setRelationshipDirection(Relationship.Direction.INCOMING);
satelliteParam.setNestedRelationshipEntity(true);
assertThat(queryStatements.findByType("Asteroid", new Filters().add(planetParam).add(satelliteParam), 1).getStatement()).isEqualTo("MATCH (n:`Asteroid`) MATCH (n)-[r0:`COLLIDES`]->(m0) WHERE r0.`totalDestructionProbability` = $`collision_totalDestructionProbability_0` " + "MATCH (n)<-[r1:`MONITORED_BY`]-(m1) WHERE r1.`signalStrength` >= $`monitoringSatellites_signalStrength_1` WITH DISTINCT n MATCH p=(n)-[*0..1]-(m) RETURN p, ID(n)");
}
Aggregations