What determines how nodes are named?

I'm trying to create a graph that is structured like so:

Region - hasDivision -> Division - hasSalesRep -> Sales Rep - hasCustomer -> Customer

This works pretty well until the very end. The problem is that all the customer nodes have the same names as the sales reps they're associated with.

Each of these grey 'Christian T Hinderson' nodes has an actual customer name attached to it as a property, and that's what should be displayed, but it isn't.

The mysterious thing to me is that I'm using the same code, the same labeling scheme, and the same property scheme I've used for region, division, and sales rep, all of which has worked fine.

Here's loading the region

LOAD CSV WITH HEADERS FROM 'file:///location_dim.csv' AS region
WITH 
	region.REGION_NM AS REGION_NM
MERGE (n:region {reg: REGION_NM})
RETURN n

Here's loading the division.

LOAD CSV WITH HEADERS FROM 'file:///location_dim.csv' AS division
WITH 
	division.REGION_NM AS REGION_NM,
	division.DIVISION_NM AS DIVISION_NM,
    division.STATE_PROVINCE_CD AS STATE_PROVINCE_CD
MERGE (n:division {div: DIVISION_NM, reg: REGION_NM, state: STATE_PROVINCE_CD})
RETURN n

Here's loading sales rep.

LOAD CSV WITH HEADERS FROM 'file:///sales_rep_dim.csv' AS row
WITH 
	row.SALES_REP_KEY AS SALES_REP_KEY,
	row.SALES_REP_NM AS SALES_REP_NM,
    row.JOB_DESC AS JOB_DESC,
    row.WORK_STATE_PROVINCE_CD AS WORK_STATE_PROVINCE_CD
MERGE (n:Sales_rep {sales_rep_key:SALES_REP_KEY, rep_name: SALES_REP_NM, job:JOB_DESC, state:WORK_STATE_PROVINCE_CD})
RETURN n

Here's customers

LOAD CSV WITH HEADERS FROM 'file:///customer_dim.csv' AS customer
WITH
	customer.CUSTOMER_NM AS CUSTOMER_NM,
	customer.SALES_REP_NM AS SALES_REP_NM
MERGE (n:customer {customer_name:CUSTOMER_NM, rep_name:SALES_REP_NM})
RETURN n

And here's me creating all the relationships

MATCH (a:region), (b:division), (c:Sales_rep), (d:customer)
WHERE a.reg = b.reg AND b.state = c.state AND c.rep_name = d.rep_name
MERGE (a)-[:hasDiv]->(b)
MERGE (b)-[:hasRep]->(c)
MERGE (c)-[:hasCustomer]->(d)
RETURN a,b,c,d

I've tried removing and reordering the properties, but I keep running into the same issues.

You have a bar at the top of the Graph Tab visualiser under directly under the query where you can see the name of the entities and relationships involve in your result.

Click on one of them and you will be able to choose the Caption for it at the bottom of the window among the size and colour of the bubble if it's a node.

1 Like

Thanks for your reply. Do you have any clues as to what I've done wrong syntactically? It's less about getting this one display correct and more about understanding the technology.

Browser has a heuristic for picking the caption which in your case picked an unsuitable one.

Either change it as outlined.

Also it indicates that storing the rep name on the customer is most likely not what you want i your model