Problem when traversing the graph with multiple levels


#1

Hi all,

I have a problem when traversing the graph and would like to ask for some help.

As the graph I show in the attached picture, I would traverse from the node with blue border with 3 levels and return nodes of the third level , the expected result should be only the node with yellow border, but actually it returned not only the node with yellow border but also the node with red border. So, how can I get my expected result?

My query is as below, and my orientdb version is 3.0.13:

match {Class:NODE1,as: n,where:(node_id=‘193403’)}.both(‘hasLink’)
{as:m ,where: ($matched.n != $currentMatch and $depth > 2) ,while:($depth < 3)}
return distinct n.node_id, m ,m.node_id ,m.node_type


#2

Find a bug again with the MATCH syntax :joy:

Just as below, the “where” condition didn’t make a difference in QUERY2, and it returned a different result from QUERY1.

QUERY1:
match {Class:NODE1,as: n,where:(node_id=‘193403’)}.both(‘hasLink’)
{as:m ,while:($depth < 3),where: ($matched.n != $currentMatch and $depth > 2)}
return distinct n.node_id, m ,m.node_id ,m.node_type

QUERY2:
match {Class:NODE1,as: n,where:(node_id=‘193403’)}.(bothE(‘hasLink’).bothV())
{as:m ,while:($depth < 3),where: ($matched.n != $currentMatch and $depth > 2)}
return distinct n.node_id, m ,m.node_id ,m.node_type


#3

Hi all,

 Is there any solutions for this problem?

#4

Hi,

let me check if I’ve understand correctly: you want retrive all the nodes of third level except for the one with the red borders. Am I right?

Thanks
Regards,
Michela


#5

The key point is, the node with red border is the second level of the node with blue border, not the third level, and shouldn’t be included in the result.