Query not returning always the same result

Adrián Abalde Méndez <aabalde@...>


I'm having a strange behaviour with janusgraph and I would like to post it here and see if anyone can give me some help.

The thing is that I'm doing a tree query for getting my graph data structured as a tree, and from there build the results I'm interested in. This query works fine, but the problem is that I don't get the same results every time. It doesn't have any sense that, if the graph is the same and hasn't changed, the query returns different trees, does it?

Both trees I'm getting are not very different between them. We have a node type called "group", and some other nodes hanging from this "groups" called "results", and is just that some times the tree comes with the results and others not, but it has always the "group" structure.

In case you want to know it, the query I'm performing is this one:

                        __.where(__.has("analysisId", analysisId))

where starting from an "analysis" node, I filter the graph to just have a tree with the groups and the results with the analysisId I'm interested in.

I guess that is not a problem of the query itself, because when it has the results, it works fine. But I don't know why I am getting this strange inconsistent behaviour.

Any ideas about this? Thanks in advance :)

Best regards,


Hi Adrian,

What happens if you rewrite the query to:

                        __.has("analysisId", analysisId),

I do not understand how leaving out the else clause leads to the random behavior you describe, but it won't hurt to state the intended else clause explicitly. If the else clause is not a valid case in your data model, you do not need the choose() step.

Best wishes,   Marc