Leanpub Header

Skip to main content

Cypher 103 with ladybugdb

Learn graph databases the hands-on way — no servers, no setup, no fluff.

Hands-On LadybugDB Cypher takes you from your first MATCH to complex recursive queries, shortest-path algorithms, and real-world AI agent graphs — all running locally in under a minute. 27 chapters. One evolving project. Every Cypher concept you need. Start querying graphs today.

Minimum price

$8.77

$12.62

You pay

$12.62

Author earns

$10.09
$

...Or Buy With Credits!

You can get credits with a paid monthly or annual Reader Membership, or you can buy them here.
PDF
EPUB
WEB
About

About

About the Book

Hands-On LadybugDB Cypher is a comprehensive, example-driven guide to graph querying with LadybugDB — an embedded, high-performance graph database. Starting from zero, readers build a single evolving project — a social network of AI agents, the companies that own them, tools they use, certifications, legal agreements, and cooperative task execution — while mastering every Cypher concept LadybugDB offers.

Across 27 chapters, the book covers installation, schema design, data types, pattern matching, recursive queries, shortest-path algorithms, subqueries, macros, transactions, external data integration, and much more. Every concept is taught through runnable examples you can execute instantly — no servers, no setup friction, just a one-line install and you're writing graph queries.

Whether you're a developer, data engineer, or architect, this book gives you production-grade Cypher skills that transfer directly to Neo4j and other openCypher databases, while teaching you to think in graphs from the ground up.

Share this book

Categories

Author

About the Author

Volodymyr Pavlyshyn

Hey I am Volodymyr 

Seasoned Developer's Journey from COBOL to Web 3.0, SSI, Privacy First Edge AI, and Beyond

 As a seasoned developer with over 20 years of experience, I have worked with various programming languages, including some that are considered "dead," such as COBOL and Smalltalk. However, my passion for innovation and embracing cutting-edge technology has led me to focus on the emerging fields of Web 5.0, Self-Sovereign Identity (SSI),AI Agents, Knowledge Graphs, Agentiic memory systems, and the architecture of a decentralized world that empowers data democratization.

A firm believer in the potential of agent systems and the concept of a "soft" internet, I am dedicated to exploring and promoting these transformative ideas. In addition to writing, I also enjoy sharing my knowledge and insights through videoblogging. Most of my Medium posts serve as supplementary content to the videos on my YouTube channel, which you can explore here: https://www.youtube.com/c/VolodymyrPavlyshyn. 

Join me on this exciting journey as we delve into the future of technology and the possibilities it holds.

Contents

Table of Contents

Hands-On LadybugDB Cypher

  1. A Comprehensive, Example-Driven Guide to Graph Querying with LadybugDB

Getting Started

What Is a Graph? — The Mental Model You Already Have

Graphs vs. Relational Databases — Why Tables Struggle with Connections

  1. The JOIN tax
  2. The “relationship table explosion”
  3. When relational is still the right choice

Graphs vs. Document Databases — Why Nesting Isn’t Connecting

  1. The problems with embedding relationships
  2. Side-by-side comparison
  3. When document databases are still the right choice

The Labeled Property Graph Model — Why Developers Love It

  1. The four building blocks
  2. Why LPG maps naturally to object-oriented code
  3. LPG vs. RDF — why LPG won developer hearts
  4. The takeaway
  5. 🏋️ Exercises

Chapter 0: Why LadybugDB Is a Great First Graph Database

  1. Zero infrastructure, instant feedback
  2. Schema-first teaches you to think in graphs
  3. Full Cypher — not a subset
  4. Columnar storage means fast even on a laptop
  5. Interoperability — connect to what you already know
  6. Built-in visualization
  7. Open source and free
  8. The bottom line
  9. 🏋️ Exercises

Chapter 0.1: Installing LadybugDB

  1. Command Line (CLI Shell)
  2. Python
  3. Node.js
  4. Rust
  5. Java
  6. Go
  7. C/C++
  8. Nightly builds
  9. On-disk vs. in-memory
  10. 🏋️ Exercises

Chapter 0.2: Ladybug Explorer — Visualize and Explore Your Graph

  1. Installing and launching
  2. The four panels
  3. AI-assisted query generation
  4. Launch options reference
  5. Recommended workflow for this book
  6. 🏋️ Exercises

Part I: Foundations

Chapter 1: Introduction to LadybugDB and Cypher

  1. What is LadybugDB?
  2. Cypher at a glance
  3. Our running example: The Agent Network
  4. Setting up LadybugDB
  5. 🏋️ Exercises

Chapter 2: Cypher Syntax Fundamentals

  1. Statements, clauses, and terminators
  2. Multi-line statements
  3. Comments
  4. Case insensitivity
  5. Naming rules
  6. Escaping reserved words
  7. Unicode support
  8. Parameters
  9. Reserved keywords
  10. Putting it all together: anatomy of a well-written query
  11. 🏋️ Exercises

Chapter 3: Data Types

  1. Numeric types
  2. Boolean
  3. String
  4. UUID
  5. NULL
  6. Temporal types
  7. SERIAL — auto-incrementing IDs
  8. Composite types
  9. BLOB
  10. JSON
  11. Logical graph types
  12. 🏋️ Exercises

Part II: Defining Your Graph

Chapter 4: Data Definition Language (DDL) — Creating the Schema

  1. Creating node tables
  2. Creating relationship tables
  3. Altering tables
  4. Dropping tables
  5. Typed graphs vs. open type graphs
  6. 🏋️ Exercises

Part III: Populating the Graph

Chapter 5: Creating Data — INSERT Operations

  1. Inserting nodes
  2. Inserting relationships
  3. General CREATE semantics
  4. MERGE — “get or create”
  5. CREATE TABLE AS — bulk creation from queries
  6. 🏋️ Exercises

Part IV: Querying the Graph

Chapter 6: MATCH — Pattern Matching

  1. Matching nodes
  2. Matching relationships
  3. Matching multiple patterns
  4. Equality predicates as syntactic sugar
  5. 🏋️ Exercises

Chapter 7: OPTIONAL MATCH

  1. 🏋️ Exercises

Chapter 8: WHERE — Filtering Results

  1. Boolean operators
  2. Comparison operators
  3. String functions in WHERE
  4. NULL handling in WHERE
  5. List membership with IN
  6. WHERE subquery on a relationship
  7. 🏋️ Exercises

Chapter 9: RETURN — Projecting Results

  1. Returning properties
  2. Return all properties with *
  3. RETURN *
  4. DISTINCT
  5. Group by and aggregations
  6. 🏋️ Exercises

Chapter 10: ORDER BY, SKIP, and LIMIT

  1. ORDER BY
  2. SKIP
  3. LIMIT
  4. Pagination pattern
  5. 🏋️ Exercises

Chapter 11: WITH — Intermediate Projections

  1. WITH for aggregation then filtering
  2. WITH for top-k
  3. Chaining WITH multiple times
  4. 🏋️ Exercises

Chapter 12: UNION

  1. UNION (removes duplicates)
  2. UNION ALL (keeps duplicates)
  3. 🏋️ Exercises

Chapter 13: UNWIND — Exploding Lists

  1. Basic usage
  2. Creating multiple nodes from a list
  3. UNWIND with WHERE (requires WITH)
  4. UNWIND nested lists
  5. 🏋️ Exercises

Chapter 14: Recursive Relationships and Path Queries

  1. Variable-length paths
  2. Walk, trail, and acyclic semantics
  3. Filtering inside recursive patterns
  4. Projecting intermediate properties
  5. Shortest path
  6. 🏋️ Exercises

Chapter 15: Named Paths

  1. Basic named path
  2. Extracting nodes and relationships
  3. Multiple named paths
  4. 🏋️ Exercises

Part V: Modifying the Graph

Chapter 16: SET — Updating Properties

  1. Update a node property
  2. Set to NULL (remove a value)
  3. Update a relationship property
  4. Bulk update
  5. RETURN after update
  6. 🏋️ Exercises

Chapter 17: DELETE — Removing Data

  1. Delete a node
  2. DETACH DELETE
  3. Delete a relationship
  4. Delete everything
  5. 🏋️ Exercises

Part VI: Advanced Query Features

Chapter 18: Subqueries — EXISTS and COUNT

  1. EXISTS
  2. COUNT subquery
  3. 🏋️ Exercises

Chapter 19: Expressions, Operators and Functions

  1. CASE expression
  2. Comparison operators
  3. Logical operators
  4. Numeric operators
  5. String operators and functions
  6. Date and timestamp operators
  7. NULL operators
  8. List operators
  9. Aggregate functions
  10. Casting
  11. Node and relationship functions
  12. 🏋️ Exercises

Chapter 20: Macros

  1. 🏋️ Exercises

Chapter 21: Transactions

  1. Basic transaction syntax
  2. Rolling back
  3. Transaction isolation
  4. 🏋️ Exercises

Part VII: Real-World Patterns

Chapter 22: Putting It All Together — Complex Queries

  1. Query 1: Full agent inventory with company and tools
  2. Query 2: Agents certified by TrustChain with their capabilities
  3. Query 3: Companies with legal agreements — network view
  4. Query 4: Find all cooperation chains from Atlas
  5. Query 5: Companies whose certified agents cooperate
  6. Query 6: Agent task load — who is overloaded?
  7. Query 7: Shortest cooperation path between Cipher and Dash
  8. Query 8: Companies reachable through legal agreements from TrustChain
  9. Query 9: CASE-based agent status report
  10. Query 10: Using UNWIND to batch-assign agents to a new task
  11. Query 11: Schema evolution — adding a new dimension
  12. Query 12: WITH pipeline — average reputation by company, then filter
  13. 🏋️ Exercises

Chapter 23: Typed Graphs vs. Neo4j — A Detailed Comparison

  1. Philosophical difference
  2. Why this matters for agent ecosystems
  3. Semantic differences
  4. Typed graph as ontology
  5. Open type graphs — best of both worlds
  6. 🏋️ Exercises

Chapter 24: LOAD FROM and External Data

  1. 🏋️ Exercises

Chapter 25: Attach/Detach External Databases

  1. 🏋️ Exercises

Chapter 26: The Social Graph Memory — Our Running Example Explained

  1. What is a social graph memory?
  2. Why “memory” and not just “database”?
  3. The social graph memory as the foundation for agentic AI
  4. Relationship to knowledge graphs and RAG
  5. 🏋️ Exercises

Chapter 27: Why Modern AI Needs Graphs

  1. The problem: AI systems work with strings, not things
  2. Vector RAG: good, but not enough
  3. GraphRAG: the convergence of graphs and AI
  4. Why graphs specifically?
  5. Agentic AI: where graphs become essential
  6. The future: graphs as the backbone of AI systems
  7. Connecting back to our example
  8. 🏋️ Exercises

Part VIII: Reference

Appendix A: Complete Schema for the Agent Network Example

Appendix B: Quick Reference — Cypher Clauses

Appendix C: Quick Reference — Data Types

Appendix D: Quick Reference — Key Differences from Neo4j

About This Book

Appendix E: Exercise Solutions

  1. Graph Fundamentals Solutions
  2. Chapter 0 Solutions
  3. Chapter 0.1 Solutions
  4. Chapter 0.2 Solutions
  5. Chapter 1 Solutions
  6. Chapter 2 Solutions
  7. Chapter 3 Solutions
  8. Chapter 4 Solutions
  9. Chapter 5 Solutions
  10. Chapter 6 Solutions
  11. Chapter 7 Solutions
  12. Chapter 8 Solutions
  13. Chapter 9 Solutions
  14. Chapter 10 Solutions
  15. Chapter 11 Solutions
  16. Chapter 12 Solutions
  17. Chapter 13 Solutions
  18. Chapter 14 Solutions
  19. Chapter 15 Solutions
  20. Chapter 16 Solutions
  21. Chapter 17 Solutions
  22. Chapter 18 Solutions
  23. Chapter 19 Solutions
  24. Chapter 20 Solutions
  25. Chapter 21 Solutions
  26. Chapter 22 Solutions
  27. Chapter 23 Solutions
  28. Chapter 24 Solutions
  29. Chapter 25 Solutions
  30. Chapter 26 Solutions
  31. Chapter 27 Solutions

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earned over $14 million writing, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub