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

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

主站蜘蛛池模板: 金寨县| 绥棱县| 沾益县| 清水河县| 枝江市| 新宁县| 太和县| 克山县| 罗田县| 盐边县| 屏东县| 镇赉县| 崇明县| 开平市| 沁源县| 金溪县| 三江| 宁陕县| 梁河县| 白银市| 拜城县| 白城市| 四子王旗| 平山县| 乌什县| 南平市| 乌审旗| 湟中县| 陇川县| 衡阳市| 上饶市| 共和县| 娄底市| 喜德县| 尚志市| 苍南县| 遵义县| 南华县| 南部县| 云浮市| 都江堰市|