Graph database schema design - Is this suitable for neo4j? -
scenario: simple address book user can create own contacts , organize them adding them in groups. contact may have multiple addresses.
i have created following diagram: ![schema-design][1]
i want query contacts placed in group x , live in country y.
is schema design enough purposes (i want use neo4j database)?
it looks notion of country
should first class citizen in graph since query depends on it. graph model design typically gets influenced lot query patterns.
so suggest have node labeled country
each country , connect address
node :located_in
relationships country. (consequently drop country property address nodes).
with change query easy as:
match (:group{name:'family'})<-[:placed_in_group]-(contact)-[:lives-at]->()-[:located_in]->(:country{name:'us'}) return contact
Comments
Post a Comment