Learning Cypher


Learning Cypher
eBook: $16.99
Formats: PDF, PacktLib, ePub and Mobi formats
$14.45
save 15%!
Print + free eBook + free PacktLib access to the book: $44.98    Print cover: $27.99
$42.44
save 6%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Overview
Table of Contents
Author
Support
Sample Chapters
  • Improve performance and robustness when you create, query, and maintain your graph database
  • Save time by writing powerful queries using pattern matching
  • Step-by-step instructions and practical examples to help you create a Neo4j graph database using Cypher

Book Details

Language : English
Paperback : 162 pages [ 235mm x 191mm ]
Release Date : May 2014
ISBN : 1783287756
ISBN 13 : 9781783287758
Author(s) : Onofrio Panzarino
Topics and Technologies : All Books, Big Data and Business Intelligence, Other, Open Source


Table of Contents

Preface
Chapter 1: Querying Neo4j Effectively with Pattern Matching
Chapter 2: Filter, Aggregate, and Combine Results
Chapter 3: Manipulating the Database
Chapter 4: Improving Performance
Chapter 5: Migrating from SQL
Appendix: Operators and Functions
Index
  • Chapter 1: Querying Neo4j Effectively with Pattern Matching
    • Setting up a new Neo4j database
      • Neo4j running modes
        • Neo4j Server
        • An embedded database
    • HR management tool – an example
      • Creating nodes and relationships using the Java API
      • A querying database
        • Invoking Cypher from Java
        • Finding nodes by relationships
        • Filtering properties
        • Filtering relationships
        • Dealing with missing parts
        • Working with paths
        • Node IDs as starting points
      • Query parameters
        • Passing parameters with Java
    • Summary
  • Chapter 2: Filter, Aggregate, and Combine Results
    • Filtering
      • The book store – an example
      • Text search
        • Working with regular expressions
        • Escaping the text
      • Value comparisons
        • The IN predicate
        • Boolean operators
      • Working with collections
      • Paging results – LIMIT and SKIP
    • Sorting
      • A descending sort
      • Dealing with null values using the COALESCE function
    • Aggregating results
      • Counting matching rows or non-null values
      • Summation
      • Average
      • Maximum and minimum
      • Standard deviation
      • Collecting values in an array
      • Grouping keys
      • Conditional expressions
      • Separating query parts using WITH
    • The UNION statement
    • Summary
  • Chapter 3: Manipulating the Database
    • Using Neo4j Browser
    • Creating nodes and relationships
      • Labels and properties
        • Multiple labels
        • Properties
        • Creating multiple patterns
      • Creating relationships
        • Creating full paths
        • Creating relationships between existing nodes using read-and-write queries
    • Modifying existing data
      • Creating unique patterns
        • Complex patterns
      • Setting properties and labels
        • Cloning a node
        • Adding labels to nodes
      • Merging matched patterns
        • Idempotent queries
    • Deleting data
      • Removing labels
      • Removing properties
      • Deleting nodes and relations
      • Clearing the whole database
    • Loops
      • Working with collections
    • Summary
  • Chapter 4: Improving Performance
    • Performance issues
    • Best practices and recommendations
      • Using parameterized queries
        • Parameterized queries with the REST API
      • Reusing ExecutionEngine
      • Finding the optimum transaction size
      • Avoiding unnecessary clauses
      • Specifying the direction of relationships and variable length paths
    • Profiling queries
      • Profiling using the Java API
      • Inside the execution plan description
      • Profiling with Neo4j Shell
      • Profiling with the REST API
    • Indexes and constraints
      • SCAN hints
      • Index hints
      • Constraints
    • Summary
  • Chapter 5: Migrating from SQL
    • Our example
    • Migrating the schema
      • Labels
      • Indexes and constraints
      • Relationships
    • Migrating the data
      • Entities
      • Relationships
    • Migrating queries
      • CRUD
      • Searching queries
      • Grouping queries
    • Summary
  • Appendix: Operators and Functions
    • Operators
      • Comparison operators
        • Ordering operators
        • Equality operators
        • NULL equality operators
      • Mathematical operators
      • The concatenation operator
      • The IN operator
      • Regular expressions
    • Functions
      • COALESCE
      • TIMESTAMP
      • ID
      • Working with nodes
        • NODES
        • LABELS
      • Working with paths and relationships
        • TYPE
        • ENDNODE and STARTNODE
        • SHORTESTPATH and ALLSHORTESTPATHS
        • RELATIONSHIPS
      • Working with collections
        • HEAD, TAIL, and LAST
        • LENGTH
        • EXTRACT
        • FILTER
        • REDUCE
        • RANGE
      • Working with strings
        • SUBSTRING, LEFT, and RIGHT
        • STR
        • REPLACE
        • Trimming functions
        • LOWER and UPPER
      • Aggregation functions
        • COUNT
        • SUM
        • AVG
        • PERCENTILEDISC and PERCENTILECONT
        • STDEV and STDEVP
        • MIN and MAX
      • Mathematical functions

Onofrio Panzarino

Onofrio Panzarino is a programmer with 15 years experience working with various languages (mostly with Java), platforms, and technologies. Before obtaining his Master of Science degree in Electronics Engineering, he worked as a digital signal processor programmer. Around the same time, he started working as a C++ developer for embedded systems and PCs. Currently, he is working with Android, ASP.NET or C#, and JavaScript for Wolters Kluwer Italia. During these years, he gained a lot of experience with graph databases, particularly with Neo4j.

Onofrio resides in Ancona, Italy. His Twitter handle is (@onof80). He is a speaker in the local Java user group and also a technical writer, mostly for Scala and NoSQL. In his spare time, he loves playing the piano with his family and programming with functional languages.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.

Sample chapters

You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

Frequently bought together

Learning Cypher +    D Cookbook =
50% Off
the second eBook
Price for both: $34.00

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Design and create flexible and fast graph databases using the Cypher declarative syntax
  • Write powerful, readable, and reusable queries with pattern matching and parameters
  • Develop fast applications using best practices to improve the performance of your Cypher queries
  • Transition smoothly from SQL to Neo4j
  • Migrate relational databases to the graph model, getting rid of O/R mismatch
  • Avoid the common mistakes and pitfalls in programming with Neo4j

In Detail

Neo4j is generating much interest among NoSQL database users for its features, performance and scalability, and robustness. The software also provides users with a very natural and expressive graph model and ACID transactions with rollbacks. However, utilizing Neo4j in a real-world project can be difficult compared to a traditional relational database. Cypher fills this gap with SQL, providing a declarative syntax and the expressiveness of pattern matching. This relatively simple but powerful language allows you to focus on your domain instead of getting lost in database access. As you will learn in this book, very complicated database queries can easily be expressed through Cypher.

This book is a practical, hands-on guide to designing, implementing, and querying a Neo4j database quickly and painlessly. Through a number of practical examples, this book uncovers all the behaviors that will help you to take advantage of Neo4j effectively, with tips and tricks to help you along the way. The book starts with the basic clauses and patterns to perform read-only queries with Cypher. You will then learn about clauses and tips that can be used with patterns to elaborate results coming from pattern matching. Next, you will master the clauses required to modify a graph. Once you have got these basics right with the help of practical examples, you will then learn about tools and practices to improve the performance of queries and how to migrate a database to Neo4j from the ground up. To finish off, the book covers Cypher operators and functions in detail.

Approach

An easy-to-follow guide full of tips and examples of real-world applications. In each chapter, a thorough example will show you the concepts in action, followed by a detailed explanation.

Who this book is for

If you want to learn how to create, query, and maintain a graph database, or want to migrate to a graph database from SQL, this is the book for you.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software