문제

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