i_use_the_internet
i_use_the_internet

Reputation: 614

Is there a way to store more information on the Edges of Amazon Neptune Graph?

I am doing a small POC project where I want to represent the road network of a village using Amazon's Neptune Graph.

I have intersections that I intend to use as Vertex in this graph, and streets as the Edges. A simple representation is:

Intersection {
   id: 1089238983,
   name: 'Madrid & 99th'
   labels: ['has_pedestrian_signals', 'four_way_intersection']
}

Street {
   id: 9808787868,
   name: 'Madrid St'
   from_int_id: 1089238983,
   to_int_id: 1089238973, 
   labels: ['has_hospital_on_street', 'is_snow_route', 'is_one_way_street']
}

The thing is AWS's documentation states that Edges can only have 1 label.

I want to be able to eventually perform traversals based on the properties of the edges. I have tried looking for ways to incorporate more data into a Tinkerpop graph, but not found anything useful.

If there are any suggestions, I will appreciate that.

Upvotes: 3

Views: 1245

Answers (1)

The-Big-K
The-Big-K

Reputation: 2830

Gremlin does support Edge Properties just like Vertex properties. http://tinkerpop.apache.org/docs/3.4.6/reference/#addedge-step

// define 'a' and 'b' vertices
g.addE('friendlyCollaborator').from('a').to('b').
                 property(id,23).property('project',select('c').values('name'))

The only callout is that fetching an edge property is an added hop as compared to just reading the edge label.

Eg:

g.V(1).outE('knows') -> Gets the matching out edge in 2 hops.
g.V(1).outE().hasProperty('knows') -> An added hop to get to your edge.

Upvotes: 5

Related Questions