Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Neo4j node property containing raw json as metadata

Tags:

json

neo4j

cypher

Is this possible to have a node property as json raw string and to filter on it with cypher ? I have a node with some defined properties and metadata (json raw string). I would like to select or filter on those metadata property. This is something like this :

START movie=node:TYPE_INDEX(Type = 'MOVIE') // Start with the reference
MATCH movie-[t:TAG]->tag 
WHERE collect(movie.Metadata).RatingPress > 3
RETURN distinct movie.Label

And metadata are something like this :

{"RatingPress" : "0","RatingSpectator" : 3"}

I have expected to use collect function in order to call the property like this :

collect(movie.Metadata).RatingPress

But, of course it fails...

Is this a way to bind some json string from a node property with cypher ?

Thanks for your help

like image 866
Fred Avatar asked Feb 17 '23 21:02

Fred


1 Answers

That's going against the principles of properties. Why not set the properties in the JSON metadata directly on the node?

But to answer your question:

No, cypher has no knowledge about JSON.

like image 120
Werner Kvalem Vesterås Avatar answered Mar 03 '23 14:03

Werner Kvalem Vesterås