use of org.neo4j.ogm.cypher.query.CypherQuery 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.query.CypherQuery 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");
}
use of org.neo4j.ogm.cypher.query.CypherQuery in project neo4j-ogm by neo4j.
the class CountStatementsTest method testCountNodesWithLabelAndFilters.
@Test
public void testCountNodesWithLabelAndFilters() throws Exception {
CypherQuery query = statements.countNodes("Person", new Filters().add(new Filter("name", ComparisonOperator.EQUALS, "Jim")));
assertThat(query.getStatement()).isEqualTo("MATCH (n:`Person`) WHERE n.`name` = $`name_0` WITH n RETURN COUNT(n)");
assertThat(query.getParameters().toString()).isEqualTo("{name_0=Jim}");
}
use of org.neo4j.ogm.cypher.query.CypherQuery in project neo4j-ogm by neo4j.
the class NodeDeleteStatementsTest method testDeleteWithLabelAndFiltersAndList.
@Test
public void testDeleteWithLabelAndFiltersAndList() throws Exception {
CypherQuery query = statements.deleteAndList("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 RETURN ID(n)");
}
use of org.neo4j.ogm.cypher.query.CypherQuery in project neo4j-ogm by neo4j.
the class ExecuteQueriesDelegate method count.
public long count(Class<?> clazz, Iterable<Filter> filters) {
ClassInfo classInfo = session.metaData().classInfo(clazz.getSimpleName());
if (classInfo != null) {
resolvePropertyAnnotations(clazz, filters);
CypherQuery query;
if (classInfo.isRelationshipEntity()) {
query = new CountStatements().countEdges(classInfo.neo4jName(), filters);
} else {
query = new CountStatements().countNodes(classInfo.neo4jName(), filters);
}
return count(query, classInfo.isRelationshipEntity());
}
throw new RuntimeException(clazz.getName() + " is not a persistable class");
}
Aggregations