Hello everyone! I would like to build a travel planner chatbot (only 1 city for now) by using neo4j graph database. However, I am not quite sure how to sort the nodes and relationships out. I’d love some advice on node and relationship modeling, particularly after the Town
node, where the complexity increases.
My Challenge:
Each Town
contains various types of places: museums, seas, islands, historical sites, etc. Each place also has contextual attributes like whether it’s indoor or outdoor, family-friendly, scenic, etc.
Design Options I'm Considering:
Option 1:
Use a single :Place
node with multiple labels like :Museum
, :Island
, :HistoricalSite
, :Sea
, :Bay
, etc.
I know the Neo4j Graph Academy recommends a max of 4 labels per node.
Will exceeding this cause performance or design issues?
Image:
option-1 graph model image
Option 2:
Model each type of place as a separate node and use different relationships:
Image:
option-2 graph model design
Option 3:
Having seperate nodes after :Town
node, which is connected with either INDOOR or OUTDOOR relationship to the other nodes.
(:Town)-[:INDOOR]->(:Museum)
(:Place)-[:OUTDOOR]->(:Beach)
This introduces extra nodes but separates semantics more cleanly. Also, there might be some nodes which have both INDOOR
and OUTDOOR
relationship.
Image:
[option-3 graph model design](https://ibb.co/yFbVRfpN)
Option 4:
This has extra :Place
node which connects all other points.
General Explanation about other Nodes:
City
will be only 1 for now, so this is where the graph model starts.
City
has multiple Region
, even the city centre should be named as centre.
Region
might have another Subregion
. Some holiday regions in a city might have different famous points, where I addressed it as Subregion
. Thats why I found such a solution. All of them will be connected to Town
eventually, where all of the travelling plan takes place.
Note:I can upload only 1 embedded image in here as I am new user, so you can check the other ones through the link.