Node/relationship properties are simple key/value pairs, where the values
are simple primitive values (exception: array of a single type of primitive
value), so I was wondering what people do to store more complex properties.

One solution is of course to store a JSON string. We'd like to avoid that
monolithic route though as it's a hack that'll make maintenance difficult.
E.g. we can't just go into the web admin and tweak a property as needed.

We currently have a property "schema" that looks something like this, for
one of our nodes:

title: ""
description: ""
image:
    url: ""
    width: #
    height: #


We've mapped that to this "schema" in Neo4j:

title: ""
description: ""
image.url: ""
image.width: #
image.height: #


You can see we've "flattened" the object to derive the flat list of keys and
values. This works okay, but it makes "discovery" of image properties
difficult. E.g. with a regular JS object, you could just do this to see if
this node had an image:

if (node.image) {
    ...
}


But the equivalent in Neo4j won't work (pseudocode):

if node has property "image"
    ...


So you have to check for specific subproperties. Not a huge annoyance for
simple structures, but for deep structures that could get pretty silly, so
you would then have to iterate over all properties and see if any begin with
"image." for example.

Anyway, just wanted to see if any of you guys have come up with any better /
more creative solutions for this problem. =D Would love to hear if so!
Thanks.

Cheers,
Aseem
_______________________________________________
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to