官术网_书友最值得收藏!

A declarative query language - Cypher

One of the defining features of the Neo4j graph database product today is its wonderful query language called Cypher. Cypher is a declarative, pattern-matching query language that makes graph database management systems understandable and workable for any database user--even the less technical ones.

The key characteristic of Cypher, in my opinion, is that it is a declarative language, opposed to other imperative query languages that have existed for quite some time. Why is this so important? Here are your answers:

  • Declarative languages allow you to state what you're looking for, declare
    the pattern that you would like to see retrieved, and then let the database worry about how to go about retrieving that data.
    • In an imperative (query) language, you would have to tell the database specifically what to do to get to the data and retrieve it.
  • Declarative languages separate the concern of stating the problem from solving it. This allows greater readability of the queries that you write, which is important, as people tend to read their database queries more often than they write them. This piece of your software will therefore become more readable and shareable with others, and long term maintenance of that easy-to-read query becomes so much easier.
  • Declarative languages will allow the database to use the information about the nature and structure of the data that it holds to answer your question more efficiently. Essentially, it allows query optimizations that you would never have known of or thought about in an imperative approach. Therefore, declarative languages can be faster--at least over time, as the optimization algorithms mature.
  • Declarative languages are great for ad hoc querying of your database, without you having to write complex software routines to do so.

Part of the reason why I feel that Cypher is such an important part of Neo4j is that we know that declarative languages, especially in the database management systems world, are critical to mass adoption. Most application developers do not want to worry about the nitty-gritty of how to best interact with their data. They want to focus on the business logic and that the data should just be there when I want it, as I want it. This is exactly how relational database systems evolved in the seventies . (Refer to Chapter 1, Graph Theory and Databases.) It is highly likely that we will be seeing a similar evolution in the graph database management system space. Cypher, therefore, is in a unique position and makes it so much easier to work with the database. It is already an incredible tool today, and it will only become better with time and the OpenCypher initiative. Cypher will be covered in Chapter 4, Getting Started with Cypher

主站蜘蛛池模板: 巴南区| 大英县| 孝义市| 永仁县| 南康市| 大姚县| 调兵山市| 海阳市| 东阿县| 黄冈市| 合川市| 金乡县| 沂源县| 从化市| 黄石市| 寿阳县| 黄浦区| 云霄县| 通江县| 襄樊市| 金坛市| 兴安县| 玉龙| 团风县| 南华县| 通道| 文登市| 海伦市| 庆阳市| 鄂伦春自治旗| 唐海县| 弋阳县| 英德市| 永修县| 丽江市| 瓮安县| 裕民县| 永和县| 满洲里市| 金门县| 宁武县|