filmov
tv
05. Cypher Introduction
Показать описание
Cypher Query Language - Introduction
According to Neo4j Documentation:
Cypher is a declarative, SQL-inspired language for describing patterns in graphs. It allows us to describe what we want to select, insert, update or delete from a graph database without requiring us to describe exactly how to do it.
Cypher uses ASCII-Art to represent patterns. We surround nodes with parentheses which look like circles, e.g. (node). If we later want to refer to the node, we’ll give it an identifier like (p) for person or (t) for thing. In real-world queries, we’ll probably use longer, more expressive variable names like (person) or (thing).
If we wanted to retrieve everyone who likes a thing, we would describe the pattern (person)-[:LIKE]-)(thing) to retrieve only nodes that had a relationship typed LIKE with other nodes (thing). Those nodes would then be persons as implied by the LIKE relationship.
Labels allow us to assign roles or types to our nodes. For example, we might want to distinguish things from persons or companies (both deal with things). By matching for (person:Person)-[:LIKE]-)(thing), it will return John, but not ACME Inc–a well known manufacturer.
According to Neo4j Documentation:
Cypher is a declarative, SQL-inspired language for describing patterns in graphs. It allows us to describe what we want to select, insert, update or delete from a graph database without requiring us to describe exactly how to do it.
Cypher uses ASCII-Art to represent patterns. We surround nodes with parentheses which look like circles, e.g. (node). If we later want to refer to the node, we’ll give it an identifier like (p) for person or (t) for thing. In real-world queries, we’ll probably use longer, more expressive variable names like (person) or (thing).
If we wanted to retrieve everyone who likes a thing, we would describe the pattern (person)-[:LIKE]-)(thing) to retrieve only nodes that had a relationship typed LIKE with other nodes (thing). Those nodes would then be persons as implied by the LIKE relationship.
Labels allow us to assign roles or types to our nodes. For example, we might want to distinguish things from persons or companies (both deal with things). By matching for (person:Person)-[:LIKE]-)(thing), it will return John, but not ACME Inc–a well known manufacturer.