Relationship Properties

Is it possible for properties of a relationship to have their own properties? I am using people as a relationship between my nodes, and each person has their own properties (name, height, etc.). Between each node, there are many people/edges. I was wondering, could I have all these people in a single relationship as properties and each property (person) having their own properties? So I could search for relationship.person.name or something of that sort?

Hi @GraphExplorer

It is possible.
However, I don't think it is a good graph design.
For example, if the name changes, you would need to rename the relationship or add a new one.
Then, if you are looking for people over a certain height, it would be better to have a relationship that does not include person names.

Hello @koji

Thank you for the reply! How would it be possible? Why would it be bad to have relationships include name if I am searching by height, the relationships I already have include both of those properties anyways? Also, would it then be better graph design to leave each person as their own edge? Sorry for all the questions, I am new to graph databases.

Hi @GraphExplorer

This is good blog about the Dark Side.

If you're referring to map properties, or more complex structures as properties, that's not currently possible.

For structures as properties, we only support simple lists. You cannot use lists of maps, or lists of other lists, and you can't use maps as properties.

You can turn such structures into JSON strings, which you can save as properties instead (since they're just strings), but in order to explore the structure, you would need to project them out and transform them from JSON strings back to structures first.

There are some convert functions in APOC Procedures that can help:

apoc.convert.toJson()
apoc.convert.fromJsonList()
apoc.convert.fromJsonMap()