Hello,
I'm building a GremlinPipeline (v 2.5.0) and I think I've run into good use case for a loop, but I'm struggling with the plumbing (pun intended). Any suggestions are appreciated.
Here's my graph of framed vertices...
Message
|
[transmission]
|
v
/----[knows]---> Transmission <---[knows]---\
| ^ |
| | |
| [event] |
| | |
Host ---[contact]---> Contact <---[contact]--- Host
...where Know edges have a long "time" property and Hosts vertices have a String "id" property.
What I'd like is to obtain all of the Transmissions "known" by a particular Host up to a certain time along a traversal "up" a tree (back in time).
Here's an example. Given the following binary-tree-like graph of Hosts with one (not shown) Contact having one (not shown) Transmission per Host-Host edge...
Host2 ---
/ \
/ Host5
Host1 ---
\ Host6
\ /
Host3 ---
\
Host7
...beginning at Host7, my desired output would be [Transmission(3, 7), Transmission(3, 6), Transmission(1, 3), Transmission(1, 2)], where Transmission(X, Y) means the Transmission that occurred on the Contact between HostX and HostY. Basically I would like the path from Host7 to the root (Host1) and the neighbors at each level along the way.
So given a host and a time and beginning from a message (this), my attempt at this so far looks like...
new GremlinPipeline(this)
.out("transmission") // all message transmissions
.as("x")
.inE("knows")
.has("time", Compare.LESS_THAN_EQUAL, time) // known time <= time
.outV() // hosts "knowing" the transmissions
.retain(Arrays.asList(host)) // just the desired host
.back("x") // now we have all transmissions of this message known by the host <= time
.as("y")
.loop("y"
// this is where I'm stuck...
// I'd like to loop backwards in time along transmissions on contacts between hosts on the path to the root
// and emit the transmission at its neighbors at each level
).gather()
Am I on the right track...?
Thanks!