[Neo4j] Attributes vs Properties in Data Modeling?
anders at neotechnology.com
Sat Dec 25 11:44:57 CET 2010
> "What can't be expressed nicely in the ER-Diagram are the attribute
> values, as the actual names of those attributes are defined as data
> elsewhere in the model. This mix of metadata and data may be a problem
> when using other underlying data models, but for a graph database,
> this is actually how it's supposed to be used."
> Are you saying that you should generally store attribute data
> individually in separate nodes rather than storing the data as node
No, the model has two levels. It stores metadata like if an attribute is
mandatory and it's value range in separate nodes/relationships. For
example, the metadata may define that all TV sets must have a screen
size. The actual values are then stored directly on the nodes.
So if we look at the bottom of the ER diagram:
the Product would normally have its attributes defined, and in this case
we put [AttributeValues] there instead, as the attribute names (keys)
are not known.
By traversing from the node of a product, we can determine what
attributes it can have, what attributes it must have and so on.
The point is that it's quite easy to have both flexibility and full type
safety when using a graph data model. Both data and metadata can be
stored in the same manner, and be directly connected to each other.
Does this make sense to you?
> For example, here is a blog entry with its data contained in one node,
> using the node-property key/value pairs:
> entry = graphdb.node(
> Title="Some Title",
> Body="bla bla bla",
> Alternatively, you could set it up so that the attributes in separate nodes:
> attribute_subref_node = Subreference.Node.ATTRIBUTE_ROOT(graphdb)
> When should you choose one way over the other?
> Neo4j mailing list
> User at lists.neo4j.org
More information about the User