Search in sources :

Example 21 with MapValueBuilder

use of org.neo4j.values.virtual.MapValueBuilder 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());
}
Also used : MapValueBuilder(org.neo4j.values.virtual.MapValueBuilder) TemporalValue(org.neo4j.values.storable.TemporalValue) ArrayValue(org.neo4j.values.storable.ArrayValue) Values.doubleValue(org.neo4j.values.storable.Values.doubleValue) NodeValue(org.neo4j.values.virtual.NodeValue) Value(org.neo4j.values.storable.Value) Values.longValue(org.neo4j.values.storable.Values.longValue) StringValue(org.neo4j.values.storable.StringValue) RelationshipValue(org.neo4j.values.virtual.RelationshipValue) TextValue(org.neo4j.values.storable.TextValue) PointValue(org.neo4j.values.storable.PointValue) SequenceValue(org.neo4j.values.SequenceValue) PathValue(org.neo4j.values.virtual.PathValue) AnyValue(org.neo4j.values.AnyValue) DoubleValue(org.neo4j.values.storable.DoubleValue) DurationValue(org.neo4j.values.storable.DurationValue) MapValue(org.neo4j.values.virtual.MapValue) NumberValue(org.neo4j.values.storable.NumberValue) LongValue(org.neo4j.values.storable.LongValue) BooleanValue(org.neo4j.values.storable.BooleanValue) ListValue(org.neo4j.values.virtual.ListValue) Values.stringValue(org.neo4j.values.storable.Values.stringValue) VirtualNodeValue(org.neo4j.values.virtual.VirtualNodeValue) IntegralValue(org.neo4j.values.storable.IntegralValue) VirtualRelationshipValue(org.neo4j.values.virtual.VirtualRelationshipValue)

Example 22 with MapValueBuilder

use of org.neo4j.values.virtual.MapValueBuilder in project neo4j by neo4j.

the class LiteralInterpreter method asMapValue.

private static MapValue asMapValue(Map<String, ?> map) {
    int size = map.size();
    if (size == 0) {
        return VirtualValues.EMPTY_MAP;
    }
    MapValueBuilder builder = new MapValueBuilder(size);
    for (Map.Entry<String, ?> entry : map.entrySet()) {
        builder.add(entry.getKey(), Values.of(entry.getValue()));
    }
    return builder.build();
}
Also used : MapValueBuilder(org.neo4j.values.virtual.MapValueBuilder) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MapValueBuilder (org.neo4j.values.virtual.MapValueBuilder)22 AnyValue (org.neo4j.values.AnyValue)6 SocketAddress (org.neo4j.configuration.helpers.SocketAddress)5 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)5 Map (java.util.Map)4 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)4 EnumSource (org.junit.jupiter.params.provider.EnumSource)4 Point (org.neo4j.graphdb.spatial.Point)3 HostnamePort (org.neo4j.internal.helpers.HostnamePort)3 LongValue (org.neo4j.values.storable.LongValue)3 Value (org.neo4j.values.storable.Value)3 Values.doubleValue (org.neo4j.values.storable.Values.doubleValue)3 Values.longValue (org.neo4j.values.storable.Values.longValue)3 Values.stringValue (org.neo4j.values.storable.Values.stringValue)3 NodeValue (org.neo4j.values.virtual.NodeValue)3 PathValue (org.neo4j.values.virtual.PathValue)3 RelationshipValue (org.neo4j.values.virtual.RelationshipValue)3 VirtualNodeValue (org.neo4j.values.virtual.VirtualNodeValue)3 VirtualRelationshipValue (org.neo4j.values.virtual.VirtualRelationshipValue)3 SequenceValue (org.neo4j.values.SequenceValue)2