use of org.neo4j.ogm.cypher.query.PagingAndSortingQuery in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindOneZeroDepthPrimaryIndex.
@Test
public void testFindOneZeroDepthPrimaryIndex() {
PagingAndSortingQuery query = primaryQueryStatements.findOne("test-uuid", 0);
assertThat(query.getStatement()).isEqualTo("MATCH (n) WHERE n.`uuid` = $id WITH n RETURN n");
}
use of org.neo4j.ogm.cypher.query.PagingAndSortingQuery in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindOnePrimaryIndex.
@Test
public void testFindOnePrimaryIndex() {
PagingAndSortingQuery query = primaryQueryStatements.findOne("test-uuid", 2);
assertThat(query.getStatement()).isEqualTo("MATCH (n) WHERE n.`uuid` = $id WITH n MATCH p=(n)-[*0..2]-(m) RETURN p");
assertThat(query.getParameters()).containsEntry("id", "test-uuid");
}
use of org.neo4j.ogm.cypher.query.PagingAndSortingQuery in project neo4j-ogm by neo4j.
the class NodeQueryStatementsTest method testFindOneByTypePrimaryIndex.
@Test
public void testFindOneByTypePrimaryIndex() {
PagingAndSortingQuery query = primaryQueryStatements.findOneByType("Orbit", "test-uuid", 2);
assertThat(query.getStatement()).isEqualTo("MATCH (n:`Orbit`) WHERE n.`uuid` = $id WITH n MATCH p=(n)-[*0..2]-(m) RETURN p");
assertThat(query.getParameters()).containsEntry("id", "test-uuid");
}
use of org.neo4j.ogm.cypher.query.PagingAndSortingQuery 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.query.PagingAndSortingQuery in project neo4j-ogm by neo4j.
the class ParameterisedStatementsTest method testStatement.
@Test
public void testStatement() throws Exception {
List<Statement> statements = new ArrayList<>();
PagingAndSortingQuery query = new NodeQueryStatements().findOne(123L, 1);
statements.add(new DefaultGraphModelRequest(query.getStatement(), query.getParameters()));
String cypher = mapper.writeValueAsString(new Statements(statements));
assertThat(cypher).isEqualTo("{\"statements\":[{\"statement\":\"MATCH (n) WHERE ID(n) = $id WITH n MATCH p=(n)-[*0..1]-(m) RETURN p\",\"parameters\":{\"id\":123},\"resultDataContents\":[\"graph\"],\"includeStats\":false}]}");
}
Aggregations