Search⌘ K
AI Features

Schemas and Types in Cypher

Explore how Cypher handles schemas, including indexes and constraints, to improve graph query performance and maintain data integrity. Understand Cypher property types and their role in managing graph data within Neo4j.

We have hardly touched upon the full power of Cypher for building and querying graph stores. Cypher also offers a couple of data management facilities—schemas and data typing.

Schemas

One aspect that we didn’t discuss yet is schemas. Cypher includes support for managing both indexes and constraints over labels, which together constitute a property graph schema.

Indexes

Indexes (both simple and composite) are used for expediting query lookup. For nodes with a given label, an index can be created on a single property (simple) or on a number of properties (composite).

Let’s say we want an index on the name property for nodes with an Author label, as we have in the ...