A flaw of `call apoc.meta.data()` and the order of labels

apoc

(Wunderbardan) #1

Hello,
I found there is a flaw of apoc procedure call apoc.meta.data() .
I used the example dataset:
cineasts_12k_movies_50k_actors.tgz (14MB).
When I execute call apoc.meta.data(),


For the relationship "RATED", it only records one label "User".
Then when I execute match (x:User)-[r:RATED]->(y:Movie) where labels(x)=["User"] return r, the result is (no changes, no records).
Then I execute match (x:User)-[r:RATED]->(y:Movie) return labels(x),r, there are many results like:

labels(x) r
["Person", "User"] { "stars": 5 }

Hence, there are two labels of the source in the "RATED" relationship.

Then, I execute match (x:User)-[r:RATED]->(y:Movie) where labels(x)=["Person","User"] return r, the result is correct.
But when I execute match (x:User)-[r:RATED]->(y:Movie) where labels(x)=["User","Person"] return r, the result is (no changes, no records).

Hence, there are mainly two problems of my post:

  1. Why does call apoc.meta.data() procedure not provide full labels of the source in the relationship "RATED"?
  2. Is there any method to ignore the order of labels in the where clause?
    Thank you!

(Michael Hunger) #2

What you call full labels is a combination of labels.

apoc.meta.data() only looks at individual labels.
We could add a column that lists "other labels", please raise a GH issue on the apoc repository.

Btw. you should use WHERE x:User for a faster query.