UNIT III - Many-To-One and Many-To-Many Relationships, Network Data Models, Cypher Query Language
UNIT III - Many-To-One and Many-To-Many Relationships, Network Data Models, Cypher Query Language
SQL Query
SELECT * FROM Company WHERE name =
"GeeksforGeeks";
Cypher was inspired by an ASCII-art type of syntax where
(nodes)-[:ARE_CONNECTED_TO]->(otherNodes) using rounded
brackets for circular (nodes), and -[:ARROWS]-> for
relationships.
When you write a query, you draw a graph pattern through your
data.
Neo4j users use Cypher to construct expressive and efficient
queries to do any kind of create, read, update, or delete (CRUD)
on their graph, and Cypher is the primary interface for Neo4j.
CYPHER QUERY LANGUAGE
Pattern recognition is fundamental to the way that the
brain works.
Because of this, humans are very good at working with
patterns (think of visual diagrams or even memory-
matching games).
Cypher is also heavily based on patterns and is designed
to recognize various versions of these patterns in data,
making it a simple and logical language for users to learn.
How would you represent the below data in
English?
Sally likes Graphs. Sally is friends with John. Sally works for Neo4j.
BENEFITS OF CYPHER QUERY LANGUAGE
1. Easy to Learn
A Cypher statement is quite compact.
It expresses references between nodes as visual
patterns, which makes them easy to understand.
Cypher has a low-learning curve, which helps users
quickly write expressive, intuitive queries to
retrieve results faster.
BENEFITS OF CYPHER QUERY LANGUAGE
2. Secure, Reliable, and Data-Rich
Cypher is well-suited for application development
and data analytics.
It reduces repeated calls to the database and
expresses use-case specific data needs in single,
compact queries.
Neo4j drivers use reactive programming
approaches that save cloud computing resources
and manage back-pressure.
BENEFITS OF CYPHER QUERY LANGUAGE
3. Visual and Logical
Match patterns of nodes and relationships in the
graph using ASCII-Art syntax.
These patterns map directly to the domain model
drawn in diagrams or on whiteboards.
As a result, there is no impedance mismatch
between the model, the database, and the query
language.
BENEFITS OF CYPHER QUERY LANGUAGE