cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Label Usage Question

mbandor
Graph Voyager

I've apparently been interpreting "labels" as "types" when I've been creating nodes. For example looking at a list of software products I would have: software products (Product) and operating systems (OS)

sw: Product
os:OS

If I'm understanding the label concept correctly, I could actually have something like:
p:Product:OS

That meant it was both. When I modeled it (in Arrow) they were distinctly different types of nodes with the same properties.

Am I misunderstanding the concept and usage of labels?

1 REPLY 1

Labels basically in Neo4j represents kind of grouping of nodes under a category that are similar in nature. For example in here Product being a group of all product nodes and OS being the group of all operating system nodes.
Neo4j allows us to assign a node to more than 1 label, i.e. a single node could be a part of more than 1 group. So yes, we can have a node that contains both labels :Product as well as :OS . This wouldn't mean that both groups/labels are combined but this would mean that the node having both these labels fall under both the groups Product as well as OS.

On Neo4j through cypher when a node is created it can have one or more labels mentioned at that time of creation or once created can have more labels added to it through cypher. Whenever a new label gets added to a node that node gets added to the group/label on the newly added one as well as remains a part of the already existing one's.
While modelling on individual labels basis, they might seem as 2 distinctly different types of node with same properties but they actually can be understood as 2 separate reference to the same node/object shared under both the labels/groups.