I have a general question about modeling in a graph database that I just can't seem to wrap my head around.
How do you model this type of relationship: "Newton invented Calculus"?
In a simple graph, you could model it like this:
Newton (node) -> invented (relationship) -> Calculus (node)
...so you'd have a bunch of "invented" graph relationships as you added more people and inventions.
The problem is, you start needing to add a bunch of properties to the relationship:
- invention_date
- influential_concepts
- influential_people
- books_inventor_wrote
...and you'll want to start creating relationships between those properties and other nodes, such as:
- influential_people: relationship to person nodes
- books_inventor_wrote: relationship to book nodes
So now it seems like the "real-world relationships" ("invented") should actually be a node in the graph, and the graph should look like this:
Newton (node) -> (relationship) -> Invention of Calculus (node) -> (relationship) -> Calculus (node)
And to complicate things more, other people are also participated in the invention of Calculus, so the graph now becomes something like:
Newton (node) ->
(relationship) ->
Newton's Calculus Invention (node) ->
(relationship) ->
Invention of Calculus (node) ->
(relationship) ->
Calculus (node)
Leibniz (node) ->
(relationship) ->
Leibniz's Calculus Invention (node) ->
(relationship) ->
Invention of Calculus (node) ->
(relationship) ->
Calculus (node)
So I ask the question because it seems like you don't want to set properties on the actual graph database "relationship" objects, because you may want to at some point treat them as nodes in the graph.
Is this correct?
I have been studying the Freebase Metaweb Architecture, and they seem to be treating everything as a node. For example, Freebase has the idea of a Mediator/CVT, where you can create a "Performance" node that links an "Actor" node to a "Film" node, like here: http://www.freebase.com/edit/topic/en/the_last_samurai. Not quite sure if this is the same issue though.
What are some guiding principles you use to figure out if the "real-world relationship" should actually be a graph node rather than a graph relationship?
If there are any good books on this topic I would love to know. Thanks!