Daniel Kuppitz created TINKERPOP-1817:
-----------------------------------------

             Summary: OLAP loses vertex labels
                 Key: TINKERPOP-1817
                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1817
             Project: TinkerPop
          Issue Type: Bug
          Components: process
    Affects Versions: 3.2.6, 3.3.0
            Reporter: Daniel Kuppitz


Working on this SO question: 
https://stackoverflow.com/questions/46962237/how-to-perform-cross-join-on-different-vertices-in-gremlin-tinkerpop/46977603
...I noticed that the connected components query randomly loses the vertex 
labels.

*Init Graph:*
{noformat}
graph = TinkerGraph.open()
g = graph.traversal()

a = graph.addVertex(label, "person", "user", "A")
b = graph.addVertex(label, "person", "user", "B")
c = graph.addVertex(label, "person", "user", "C")
d = graph.addVertex(label, "person", "user", "D")

one = graph.addVertex('rec_id')
one.property('ids', '1')

two = graph.addVertex('rec_id')
two.property('ids', '2')

three = graph.addVertex('rec_id')
three.property('ids', '3')

four = graph.addVertex('rec_id')
four.property('ids', '4')

five = graph.addVertex('rec_id')
five.property('ids', '5')

a.addEdge('part_of',one)
a.addEdge('part_of',two)
b.addEdge('part_of', three)
b.addEdge('part_of',four)
c.addEdge('part_of',five)
d.addEdge('part_of',four)
d.addEdge('part_of',two)

g = graph.traversal().withComputer()
{noformat}

*Query:*
{noformat}
g.V().
  emit(cyclicPath().or().not(both())).
    repeat(both()).
    until(cyclicPath()).
  aggregate("p").by(path()).cap("p").
  unfold().limit(local, 1).dedup().
  map(__.as("v").select("p").unfold().
         filter(unfold().where(eq("v"))).
         unfold().dedup().order().by(id).fold()).dedup().
  project("Users","associated_ids").
    by(unfold().label().fold()).
    by(unfold().label().fold())
{noformat}

*Sample Output:*
{noformat}
gremlin> g.V().
......1>   emit(cyclicPath().or().not(both())).
......2>     repeat(both()).
......3>     until(cyclicPath()).
......4>   aggregate("p").by(path()).cap("p").
......5>   unfold().limit(local, 1).dedup().
......6>   map(__.as("v").select("p").unfold().
......7>          filter(unfold().where(eq("v"))).
......8>          unfold().dedup().order().by(id).fold()).dedup().
......9>   project("Users","associated_ids").
.....10>     by(unfold().label()./*hasLabel("person").*/fold()).
.....11>     by(unfold().label()./*hasLabel("rec_id").*/fold())
==>[Users:[person,person,person,vertex,vertex,vertex,vertex],associated_ids:[person,person,person,vertex,vertex,vertex,vertex]]
==>[Users:[vertex,rec_id],associated_ids:[vertex,rec_id]]
gremlin> g = graph.traversal().withComputer()
==>graphtraversalsource[tinkergraph[vertices:9 edges:7], graphcomputer]
gremlin> g.V().
......1>   emit(cyclicPath().or().not(both())).
......2>     repeat(both()).
......3>     until(cyclicPath()).
......4>   aggregate("p").by(path()).cap("p").
......5>   unfold().limit(local, 1).dedup().
......6>   map(__.as("v").select("p").unfold().
......7>          filter(unfold().where(eq("v"))).
......8>          unfold().dedup().order().by(id).fold()).dedup().
......9>   project("Users","associated_ids").
.....10>     by(unfold().label()./*hasLabel("person").*/fold()).
.....11>     by(unfold().label()./*hasLabel("rec_id").*/fold())
==>[Users:[person,person,person,rec_id,vertex,vertex,vertex],associated_ids:[person,person,person,rec_id,vertex,vertex,vertex]]
==>[Users:[vertex,rec_id],associated_ids:[vertex,rec_id]]
{noformat}




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to