# Object/Element Parity

Because Objects (Gremlin Maps) and Elements are similar in structure...
    - String Keyed Maps
    - Map Values of Vertex/Edge Property type

```ts
type Value = PrimitiveType | Value[] | Map<Value, Value>;
type Objects = Record<string | ID | LABEL, Value>

// Only supported by TinkerPop Gremlin Server
type Element = Record<string | ID | LABEL, Value>
// AWS Neptune only supports primitive types for Vertex Properties, see Addendum #1.
type Element = Record<string | ID | LABEL, PrimitiveType | PrimitiveType[]>
```

## [DONE] `find()` - filtering

```ts
// Element
g.V()
  .has('prop1');

// Object (Gremlin Map)
g.V().valueMap().by(_.unfold())
  .where(_.select(P1).is(P1_V1));
```

## [DONE] `valueObj()` - selecting multiple property values into an Object/Map

```ts
// Element
g.V()
  .valueMap('prop1')
    .by(_.unfold());

// Object (Gremlin Map)
g.V().valueMap().by(_.unfold())
  .project(P1)
    .by(_.select(P1));
```

## [DONE] `value` - selecting a single property's values

```ts
// Element
g.V()
  .values('prop1')

// Object (Gremlin Map)
g.V().valueMap().by(_.unfold())
  .select(P1);
```

## [DONE] `merge`
## [DONE] `groupBy/groupByMap`
## [DONE] `project`

## Addendum #1: Supporting other Graph Providers - customized property value type support

Some Graph Providers do NOT support certain types for Vertex/Edge property values.
Gremlin allows Graph Providers the granularity of supporting different types for an Edge Property independent from Vertex Property.
- ex. Numbers types could be allowed for Vertex Properties, but not for Edge properties.

This could greatly complicate how GTO (typing/deserialization) is configured with types. Does configuration need to be in a type that is somehow fed back into GTO?

```ts
// GTO code
// --------
// @gto/db-configuration-neptune
export const AWSNeptuneConfiguration = {
   vertexProperty: {
       BooleanValues: true,
       MapValues: true,
       // ... the rest of the properties specified here: 
       // https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/structure/Graph.Features.DataTypeFeatures.html
   }   
} as const;

// Client code
// -----------
// ./gtoConfig.ts
import { AWSNeptuneConfiguration } from '@gto/db-configuration-neptune';  // Versionable, ex. 1.0.4.1
import { Node as GTONode} from '@gto/gto';
export const Node = (props) => GTONode(AWSNeptuneConfiguration, props);

// ./models.ts
import { Node } from './gtoConfig';
class MyNode extends Node({ prop1: 'number' }) {} // whew, no changes! Is exactly what it was before configuration.
```

All value types that a Graph Provider can choose to support for Vertices and Edges:
- https://tinkerpop.apache.org/javadocs/current/full/org/apache/tinkerpop/gremlin/structure/Graph.Features.DataTypeFeatures.html
- AWS Neptune
    - See "Gremlin Graph Supported Features" in https://docs.aws.amazon.com/neptune/latest/userguide/access-graph-gremlin-differences.html#feature-gremlin-differences
