Avoid These Labels

Semantically orthogonal labels

“Semantically orthogonal” is a fancy term that means that labels should have nothing to do with one another. You should be careful not to use the same type of label in different contexts. For example, using the region for all types of nodes is not useful for most queries.

Here is an example where both Person nodes and User nodes are labeled with regions. If there are no use cases where the region is significant for both types of nodes, it is not helpful to use these same labels for Person nodes and User nodes.

Don’t do this:

Orthogonal labels

Representing class hierarchies

You also want to avoid labeling your nodes to represent hierarchies.

Suppose we have this hierarchy of Screen Actors Guild memberships:

Hierarchy of labels

This is often called “inheritance” or “IS-A” relationships. You should not do this where nodes have multiple labels that represent a hierarchy such as this:

Hierarchy of labels

Instead, you should do this:

Membership instead

Check your understanding

Do not do this!

What label practices should you avoid when creating your graph data model?

  • ✓ Adding labels to nodes when no use case exists.

  • ❏ Labels that can be used to group nodes effectively.

  • ✓ Labels to represent class hierarchies for your data.

  • ❏ Labels that will help to reduce the number of nodes retrieved for your use cases.

Hint

You have learned two examples of types of labels not to model in your graph.

Solution

The two practices that you should avoid are Semantically orthogonal labels and labels that represent hierarchies.

Summary

In this lesson, you learned some ways of using labels that you should avoid in your model. In the next module, you learn about refactoring to eliminate duplicate data.

Chatbot

Hi, I am an Educational Learning Assistant for Intelligent Network Exploration. You can call me E.L.A.I.N.E.

How can I help you today?