Cypher Query Examples | Query Neo4j Database (in Progress)

05/16/2023

ANNa-cropped

Cypher is a query language that is used to query graph-oriented databases. It uses a simple syntax that allows users to express complex graph queries in a readable way. It supports a wide range of graph database operations, including graph pattern matching, filtering, aggregation, sorting, and more.

Some of the key features of Cypher include:

  • Pattern matching: Cypher allows users to specify patterns in a graph that they want to match, and then retrieve the matching data.
  • Node and relationship properties: Users can filter and match nodes and relationships based on their properties.
  • Path traversal: Cypher supports traversing paths through a graph, allowing users to find relationships between nodes that are several degrees apart.
  • Aggregation and sorting: Cypher supports aggregating and sorting query results.
  • Built-in functions: Cypher provides a range of built-in functions for working with graph data, such as functions for computing shortest paths, calculating distances, and more.

Examples for Web Analysis

MATCH (s:Session)-[r:VISIT]-(p:PAGE) RETURN s,r,p LIMIT 100
MATCH (p:PAGE),(t:Textbook)
WHERE p.url CONTAINS t.`Persistent identifier`
CREATE (p)-[r:EQUALS_OBJECT]->(t)
RETURN r