You could do something like this:
gremlin> graph = TinkerGraph.open()
==>tinkergraph[vertices:0 edges:0]
gremlin> g = graph.traversal()
==>graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
gremlin> g.addV('transition').property('name','transition1').as('t1').
......1> addV('transition').property('name','transition2').as('t2').
......2> addV('transition').property('name','transition3').as('t3').
......3> addV('place').property('token',1).as('p1').
......4> addV('place').property('token',1).as('p2').
......5> addV('place').property('token',0).as('p3').
......6> addV('place').property('token',0).as('p4').
......7> addE('at').from('p1').to('t1').
......8> addE('at').from('p1').to('t2').
......9> addE('at').from('p2').to('t1').
.....10> addE('at').from('p3').to('t2').
.....11> addE('at').from('p3').to('t3').
.....12> addE('at').from('p4').to('t3').iterate()
gremlin> g.V().hasLabel('transition').
......1> filter(__.in().values('token').
......2> dedup().fold().
......3> is(eq([1])))
==>v[0]
Note that in this case, v[0]
is the vertex that is labelled "t1" in the sample data I generated. It has two edges from "p1" and "p2" which both have a "token" equivalent to "1" whereas the "t2" vertex has two edges from "p1" and "p3" where "p3" has a token of "0" which forces "t2" to be filtered out. There is also a "t3" which has two places with "token" properties equal to "0".
The basic pattern here is to use a filter()
step that gets the unique list of "token" values, then ensures that they are equal to a list with the value "1" in it.