The blog entry "Modeling Categories in a Graph Database"
(http://blog.neo4j.org/2010/03/modeling-categories-in-graph-database.html)
provides an example for modeling a store with products, and the
product attributes are modeled as separate nodes instead of storing
the  data in a single product node, using the node property key/value
pairs. The article says:

"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
properties?

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",
        Summary="",
        Body="bla bla bla",
        langauge="US",
        Created=2010-12-24,
        Published=2010-12-24,
        Revised=2010-12-24)

Alternatively, you could set it up so that the attributes in separate nodes:

attribute_subref_node = Subreference.Node.ATTRIBUTE_ROOT(graphdb)
attribute_subref_node.ATTRIBUTE_TYPE(title_node)
attribute_subref_node.ATTRIBUTE_TYPE(summary_node)
attribute_subref_node.ATTRIBUTE_TYPE(body_node)
attribute_subref_node.ATTRIBUTE_TYPE(language_node)
attribute_subref_node.ATTRIBUTE_TYPE(published_date_node)
attribute_subref_node.ATTRIBUTE_TYPE(revision_date_node)


When should you choose one way over the other?

Thanks.

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

Reply via email to