Schemas and Types in Cypher

Learn about the potential of using Cypher for managing indexes and constraints over labels, and take a quick look at its type system.

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 book graph:

Get hands-on with 1400+ tech skills courses.