Learning Cypher
eBook - ePub

Learning Cypher

Onofrio Panzarino

Buch teilen
  1. 162 Seiten
  2. English
  3. ePUB (handyfreundlich)
  4. Über iOS und Android verfügbar
eBook - ePub

Learning Cypher

Onofrio Panzarino

Angaben zum Buch
Buchvorschau
Inhaltsverzeichnis
Quellenangaben

Über dieses Buch

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.

Häufig gestellte Fragen

Wie kann ich mein Abo kündigen?
Gehe einfach zum Kontobereich in den Einstellungen und klicke auf „Abo kündigen“ – ganz einfach. Nachdem du gekündigt hast, bleibt deine Mitgliedschaft für den verbleibenden Abozeitraum, den du bereits bezahlt hast, aktiv. Mehr Informationen hier.
(Wie) Kann ich Bücher herunterladen?
Derzeit stehen all unsere auf Mobilgeräte reagierenden ePub-Bücher zum Download über die App zur Verfügung. Die meisten unserer PDFs stehen ebenfalls zum Download bereit; wir arbeiten daran, auch die übrigen PDFs zum Download anzubieten, bei denen dies aktuell noch nicht möglich ist. Weitere Informationen hier.
Welcher Unterschied besteht bei den Preisen zwischen den Aboplänen?
Mit beiden Aboplänen erhältst du vollen Zugang zur Bibliothek und allen Funktionen von Perlego. Die einzigen Unterschiede bestehen im Preis und dem Abozeitraum: Mit dem Jahresabo sparst du auf 12 Monate gerechnet im Vergleich zum Monatsabo rund 30 %.
Was ist Perlego?
Wir sind ein Online-Abodienst für Lehrbücher, bei dem du für weniger als den Preis eines einzelnen Buches pro Monat Zugang zu einer ganzen Online-Bibliothek erhältst. Mit über 1 Million Büchern zu über 1.000 verschiedenen Themen haben wir bestimmt alles, was du brauchst! Weitere Informationen hier.
Unterstützt Perlego Text-zu-Sprache?
Achte auf das Symbol zum Vorlesen in deinem nächsten Buch, um zu sehen, ob du es dir auch anhören kannst. Bei diesem Tool wird dir Text laut vorgelesen, wobei der Text beim Vorlesen auch grafisch hervorgehoben wird. Du kannst das Vorlesen jederzeit anhalten, beschleunigen und verlangsamen. Weitere Informationen hier.
Ist Learning Cypher als Online-PDF/ePub verfügbar?
Ja, du hast Zugang zu Learning Cypher von Onofrio Panzarino im PDF- und/oder ePub-Format sowie zu anderen beliebten Büchern aus Computer Science & Data Processing. Aus unserem Katalog stehen dir über 1 Million Bücher zur Verfügung.

Information

Jahr
2014
ISBN
9781783287758

Learning Cypher


Table of Contents

Learning Cypher
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Querying Neo4j Effectively with Pattern Matching
Setting up a new Neo4j database
Neo4j running modes
Neo4j Server
An embedded database
Preparing the development environment
Creating an embedded database
Configuration
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
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
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
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
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
A. 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
Index

Learning Cypher

Copyright © 2014 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2014
Production Reference: 1070514
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78328-775-8
www.packtpub.com
Cover Image by Jaroslaw Blaminsky ()

Credits

Author
Onofrio Panzarino
Reviewers
Riccardo Mancinelli
Rohit Mukherjee
Timmy Storms
Craig Taverner
Commissioning Editor
Antony Lowe
Acquisition Editor
Owen Roberts
Content Development Editor
Priyanka S
Technical Editors
Taabish Khan
Nikhil Potdukhe
Akash Rajiv Sharma
Copy Editors
Mradula Hegde
Gladson Monteiro
Project Coordinator
Harshal Ved
Proofreader
Ameesha Green
Indexer
Mariammal Chettiyar
Graphics
Yuvraj Mannari
Abhinash Sahu
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat

About the Author

Onofrio Panzarino is a programmer with 15 years experience working with various langua...

Inhaltsverzeichnis