Database Reference
In-Depth Information
Figure 2.3. Three people in two groups
The pattern shown in figure 2.2 appears in the figure 2.3 diagram in several places; in fact,
the whole diagram can be composed by overlaying copies of figure 2.2 on top of each oth-
er.
When it comes to querying the data in this model, there are two questions you might want
to answer. First, for a given person, to what groups does that person belong? Second, for a
givengroup,whatpeoplebelongtothatgroup?BothqueriesareeasytoexpressinNeo4j's
query language, Cypher:
Itseemsthatthismodelissuitableforourusecases.Bystartingwithasimplerelationship,
“a person belongs to a group,” we've been able to generate a more complex graph by just
repeating that relationship. Our initial graph fragment in figure 2.2 actually captures the
entire model.
 
Search WWH ::




Custom Search