use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class ValueMapperTest method parameters.
private static Stream<AnyValue> parameters() {
NodeValue node1 = nodeValue(1, stringArray(), EMPTY_MAP);
NodeValue node2 = nodeValue(2, stringArray(), EMPTY_MAP);
NodeValue node3 = nodeValue(3, stringArray(), EMPTY_MAP);
RelationshipValue relationship1 = relationshipValue(100, node1, node2, stringValue("ONE"), EMPTY_MAP);
RelationshipValue relationship2 = relationshipValue(200, node2, node2, stringValue("TWO"), EMPTY_MAP);
return Stream.of(node1, relationship1, path(new NodeValue[] { node1, node2, node3 }, new RelationshipValue[] { relationship1, relationship2 }), map(new String[] { "alpha", "beta" }, new AnyValue[] { stringValue("one"), numberValue(2) }), NO_VALUE, list(numberValue(1), stringValue("fine"), node2), stringValue("hello world"), stringArray("hello", "brave", "new", "world"), booleanValue(false), booleanArray(new boolean[] { true, false, true }), charValue('\n'), charArray(new char[] { 'h', 'e', 'l', 'l', 'o' }), byteValue((byte) 3), byteArray(new byte[] { 0x00, (byte) 0x99, (byte) 0xcc }), shortValue((short) 42), shortArray(new short[] { 1337, (short) 0xcafe, (short) 0xbabe }), intValue(987654321), intArray(new int[] { 42, 11 }), longValue(9876543210L), longArray(new long[] { 0xcafebabe, 0x1ee7 }), floatValue(Float.MAX_VALUE), floatArray(new float[] { Float.NEGATIVE_INFINITY, Float.MIN_VALUE }), doubleValue(Double.MIN_NORMAL), doubleArray(new double[] { Double.POSITIVE_INFINITY, Double.MAX_VALUE }), datetime(2018, 1, 16, 10, 36, 43, 123456788, ZoneId.of("Europe/Stockholm")), localDateTime(2018, 1, 16, 10, 36, 43, 123456788), date(2018, 1, 16), time(10, 36, 43, 123456788, ZoneOffset.ofHours(1)), localTime(10, 36, 43, 123456788), duration(399, 4, 48424, 133701337), pointValue(Cartesian, 11, 32), pointArray(new Point[] { pointValue(Cartesian, 11, 32), pointValue(WGS84, 13, 56) }));
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class AnyValueComparatorTest method shouldTernaryCompareRelationships.
@Test
void shouldTernaryCompareRelationships() {
NodeValue start = nodeValue(42, stringArray("L"), EMPTY_MAP);
NodeValue end = nodeValue(43, stringArray("L"), EMPTY_MAP);
MapValue propMap = map("foo", "bar");
RelationshipValue rel1 = relationshipValue(42, start, end, stringValue("R"), propMap);
RelationshipValue rel2 = relationshipValue(43, start, end, stringValue("R"), propMap);
assertTernaryCompare(rel1, rel1, EQUAL);
assertTernaryCompare(rel1, rel2, SMALLER_THAN);
assertTernaryCompare(rel1, relationship(rel1.id()), EQUAL);
assertTernaryCompare(rel1, intValue(42), UNDEFINED);
assertTernaryCompare(rel1, propMap, UNDEFINED);
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class BoltRequestMessageV3Test method shouldSerializeRelationship.
@Test
void shouldSerializeRelationship() throws Throwable {
RelationshipValue rel = relationshipValue(12L, nodeValue(1L, stringArray(), VirtualValues.EMPTY_MAP), nodeValue(2L, stringArray(), VirtualValues.EMPTY_MAP), stringValue("KNOWS"), map(new String[] { "name", "age" }, new AnyValue[] { stringValue("Bob"), intValue(14) }));
assertThat(serialized(rel)).isEqualTo("B1 71 91 B5 52 0C 01 02 85 4B 4E 4F 57 53 A2 84" + lineSeparator() + "6E 61 6D 65 83 42 6F 62 83 61 67 65 0E");
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class CypherFunctions method asPoint.
private static Value asPoint(DbAccess access, VirtualRelationshipValue relationshipValue, RelationshipScanCursor relationshipScanCursor, PropertyCursor propertyCursor) {
MapValueBuilder builder = new MapValueBuilder();
for (String key : POINT_KEYS) {
Value value = access.relationshipProperty(relationshipValue.id(), access.propertyKey(key), relationshipScanCursor, propertyCursor, true);
if (value == NO_VALUE) {
continue;
}
builder.add(key, value);
}
return PointValue.fromMap(builder.build());
}
use of org.neo4j.values.virtual.RelationshipValue in project neo4j by neo4j.
the class PathValueBuilderTest method shouldHandleLongerPathWithMultiRelWhereEndNodeIsKnown.
@Test
void shouldHandleLongerPathWithMultiRelWhereEndNodeIsKnown() {
// Given (n1)<--(n2)-->(n3)
NodeValue n1 = node(42);
NodeValue n2 = node(43);
NodeValue n3 = node(44);
RelationshipValue r1 = relationship(1337, n2, n1);
RelationshipValue r2 = relationship(1338, n2, n3);
PathValueBuilder builder = builder(n1, n2, n3, r1, r2);
// When (n1)<--(n2)--(n3)
builder.addNode(n1);
builder.addMultipleUndirected(list(r1, r2), n3);
// Then
assertEquals(path(n1, r1, n2, r2, n3), builder.build());
}
Aggregations