Database Reference
In-Depth Information
° Relationships are explicit : They are not inferred by some kind
of constraint or established at query time through a join operation.
They are equal citizens in the database; they have the same expressive
power as the nodes representing the entities in the database.
° Relationships can have properties too : They can have values
associated with them that can specify the length, capacity, or any
other characteristic of that relationship. This is terribly important,
and very different from anything we know from the relational world.
In Neo4j then, this data model has been enriched with a couple of key concepts that
extend the core property graph model. Two concepts are important, related but
different: node labels and relationship types.
Node labels
Node labels are a way of semantically categorizing the nodes in your graph. A
node can have zero, one, or more labels assigned to it—similar to how you would
use labels in something like your Gmail inbox. Labels are essentially a set-oriented
conceptinagraphstructure:itallowsyoutoeasilyandeficientlycreatesubgraphs
in your database, which can be useful for many different purposes. One of the most
important things you can do with labels is to create some kind of typing structure or
schema in your database without having to do this yourself (which is what people
used to do all the time before the advent of labels in Neo4j 2.0).
Relationship types
Relationship types achieve something similar to what you do with node labels,
but to relationships. The purpose of doing so, however, is mostly very different.
Relationship types are mandatory properties for relationships (every relationship
must have one and only one type) and will be used during complex, deep traversals
across the graph, when only certain kinds of paths from node to node are deemed
importantbyaspeciicquery.
This should give you a good understanding of the basic data model that we will be
using during the remainder of this topic. Neo4j implements a very well-documented
version of the property graph database, and as we will see later, is well suited for
a wide variety of different use cases. Let's explore the reasons for using a graph
database like Neo4j a bit more before proceeding.
 
Search WWH ::




Custom Search