Suppose I have A class which HAS A class B. Then in the graph the direction is outgoing from A or incoming to A? My main question is how to figure out direction between nodes based on class relationships in a OOD. Thanks in advance.

有帮助吗?

解决方案

You can easily traverse both ways in Neo4j. My usual default here is outgoing, that said... it depends on your model.

As an exercise, think about people and houses. Does a person have a house or a house have occupants Try thinking about relationship names here. Do they OWN the house, LIVE AT the house or what?

Person--{has}-->house
Person--{livesat}-->house
Person--{owns}-->house
House--{has}-->occupant

They're all slightly different relationships. Apply this thinking to your own model and go for what you think's best. I'm not a fan of "by" relationships, e.g house--{ownedby}-->person as they're simply traversing an "own" relationship backwards and are better expressed that way around.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top