This is the first of a series of courses which I am putting together for anyone interested in learning about a world class graph database. This technology provides many entity relationship situations which are difficult to express in traditional relational or key-value NOSQL solutions.
2. The Story – If Seeing is Believing, The Unseen is Unknown
The Motivation
Several groups and individuals independently have approached me
concerning several issues all which have a common theme. They are
Graph Based.
I started on my own to relearn and research this topic from Long
Ago, in a City, Far Far Away.
This is the First of Many Classes I am Putting Together for Us in
Hopes of Making a Real Difference for All Of Us.
If Seeing is Believing, The Unseen is Unknown
Find the Force, Learn to See What You Can Not See Now, It will Guild Your Path
3. The Major Player in Data and Discovery
It is NOT our intent to
play one database structure
off of another, but to
augment our
understanding, and tool
selection, to use the right
tool for the right job.
Not all problems are
represented well in Rows
and Columns, nor in Key-
Value maps, some are
relationship based.
4. In most cases, a design, or its
refinement, starts with a
whiteboard drawing.
Our nature is to draw components
and their relationships to each
other.
The next step for both relational
and NOSQL platforms is to
convert this diagram into their
respective paradigms.
For such problems, a native graph
solution is the best approach.
Understanding such a platform is
the purpose of these courses.
Graphs Are Whiteboard Friendly
5. What is a Graph, What Are the Components
Rows and Columns for Relational,
Keys mapping to a Structure for
NOSQL, what are the components of
a Graph Database.?
They are relatively simple and
intuitive. We call this thinking
‘Whiteboard Friendly’. There is no
‘conversion’ to an underlying
paradigm. The underlying paradigm
matches our natural way of thinking
and understanding the problem.
A Graph Database thinks as we do. As
we will see, there are many
advantages to this approach and the
underlying technology of a native
graph solution.
Not all graph databases are native graph, some are abstractions over relational or key-values databases
Graphs are Whiteboard Friendly
6. Understand Patterns is Key to Seeing the Unseen A Light Onto My Path
Patterns are 90 % of the foundational
building blocks of a graph. Understanding
a graph is simple, and intuitive.
A Node can be of any type, person, place,
thing, etc. Nodes have relationships to each
other, forming a graph.
We have invented, using standard text, Art
which visually describes these components,
we call it ASCII Art.
A Node has one or more types which we
call a Label. Nodes can also have
Properties.
Nodes are joined through Relationships
which are also named. Relationships can
have a direction but are always stored
bidirectionally.
7. Cypher Commands are Declarative in Nature A Lamp Onto My Feet
Understanding Patterns is the key, they
are universally used across all of
Cypher, the declarative language used by
the leading graph database technology,
Neo4J.
Declarative means that through patterns
we specify ‘What We Want’ instead of
‘How to Create or Find It’. There is no
concept of schema.
The three most important commands to
understand is how to Create a path
(nodes & relationships) and how to
Match a graph element (node,
relationship, path, etc.)
These commands form the foundation
of Neo4J and they are all based on the
Patterns we have shown.
8. From Whiteboard to Graph A SimpleVisual Grammar
many ways to visualize and
explore a graph in Neo4J, but this
is basically what you will see. A
simple visual grammar has been
presented in the Legend of this
diagram. Circles are Nodes, lines
are Relati0onships, which are
bidirectional internally, and
Labels are show in gray
rectangles.
Here is what
our original
graph would
look like from
our opening
slide.There are
9. Expanding Existing Graphs is Easy
Whiteboard Friendly means no
abstractions exist between the vision, and
the underlying mechanics of a native graph
solution.
Model changes are frequent in projects
but, unlike schema-based solution, are
easily performed, either through adding
new node and relationships, or refactoring
existing ones.
In this model, we are adding the Software
Licenses held by each Member. When a
project ends, those licenses can easily be
reclaimed, and made available for others.
This graph also makes it easy to explore
and adhere to our license agreements.
No schema changes, no rewrites or
modifications to existing code, everything
is easily understood and maps to our native
thinking.
10. Some Requirements are Hierarchical in Nature
Sometimes solutions are
hierarchical in nature, as
in the case of who
reports to whom, etc.
Graphs are perfectly
positioned to handle
such scenarios.
A few simple Cypher
statements, or loading
from an external
resource through prebuilt
adapters, builds out the
graph structure easily.
Notice that nodes can
have multiple labels
(types Boss and
Manager).
Sometimes Structures are Complex
11. Graphs Simplify Seeing the Unseen Graph Solution and Our Current Mechanism
Let’s compare the effort in
processing a simple
hierarchical request between a
graph solution and our current
mechanism.
Here is all the Cypher code
required to find the reports
for each manager three level
deep and generate a report.
We are also showing the SQL
stored procedure written by a
very skilled person to
accomplish the same task
which is over two pages.
Using one of the many visual
engines that comes with
Neo4J this could even be done
without Cypher.
12. Performance Comparisons
Let compare our current mechanisms
against graph technology. Let’s increase
the number of people in a social graph
and compare. Then, let’s preform a
comparison of depth searches, two
common operations in any solution.
Index Free Adjacency: Because there
are no indexes between nodes.
Relationships are stored natively in the
graph itself at time of creation,
therefore no compute (table scanning,
indexes and foreign keys) is required to
traverse the structure. Also, because the
structure is self-contained it can reside,
as is, in cache. Notice: unlike our
current solutions, increasing the
Number of People by 1000 times, or
depth, has no, or very little, effect on
performance.
Index Free Adjacency: There is no Spoon
13. Ideas of Graphy Problems AnytimeYou See A ‘This is Related toThat’,Think Graph
I am just one
person, one
perspective, with
limited
understanding.
These are only a
few of the areas
which I feel Graph
Theory can make a
real difference.
Anytime you see a
‘This is Related to
That’, think Graph.
14. Future Classes Your Needs Should Determine Our Future Courses
Just as needs should
determine the solutions,
your needs should
determine our future
courses. I have taken a
reasonable guess at
possible topics for the
next series of classes on
GraphTheory and Neo4J.
But the real decision is up
to you based on what
you need.
Certainly, a more in-
depth understanding of
Patterns and the Cypher
Language should be next