Replace 'atom expression' in queries

Hi everyone,

I encounter a problem with the ‘atom expression’. Here is the query we send to the DB and right below, the error message thrown.

I understand that the fourth line of the query is involved, but unfortunately I didn’t succeed in rewriting it on my own without atom expression.
Do you have any advice or doc to help me to solve this problem in particular? I’m really a beginner with cypher queries so any suggestions will be warmly welcomed!

Thanks a lot!

2 Likes

Hi @powlinett!

An interesting query :smiley: I don’t have a clear idea of rewriting right now because I’m not sure what’s the goal.

The main problem is that Memgraph doesn’t support paths in expressions yet. In general, these filters containing paths might be rewritten using OPTIONAL MATCH + WITH, but in this case, that might be very verbose because of the variable length path. Another idea I have is to use Memgraph’s variable-length filtering expression, so, e.g., here https://docs.memgraph.com/memgraph/reference-overview/graph-algorithms#breadth-first-search, in the query:

MATCH (a {id: 723})-[*bfs..10 (e, n | e.x > 12 AND n.y < 3)]-() RETURN *;

part

e.x > 12 AND n.y < 3

is the filter on each node (n) / edge (e), maybe that could be used to achieve a similar thing. NOTE: variable-length path doesn’t have to be bfs, standard dfs (only *, also can have the filter).

Could you write down in plain English what the query has to achieve? I’ll try to write an alternative query :smiley:

1 Like

If I understand the query correctly, Memgraph’s variable-length path filter + startNode & endNode functions used within the filtering expression could be used to rewrite the query by keeping the same semantics. In addition, that might be significantly faster because the whole WITH part would be redundant in that case :smiley:

1 Like

Hi buda,

thanks for your very complete answers.

It turned out it was an outdated cypher query.

At that time, the goal was to retrieve paths where the user wasn’t directly related to a permission set (but today in our DB these two node types can’t be directly related anymore).

However, the variable-length filtering expression seems really useful in our use case since we only need r:accessRole relation with r.role = ‘manager’.

We’ll try to implement your suggestions,

Thanks again!