Filtering Queries

Module overview

There are many ways that you can query a subset or subgraph of the data in the graph.

In this module, you will:

  • Review basic query filtering.

  • Evaluate strings in your query filtering.

  • Retrieve data using patterns in the graph.

  • Learn how to specify multiple or optional MATCH clauses.

Data model for this course

This course uses the movie dataset for all the queries you will be running and writing. This is the same dataset that will be used for the application development courses in GraphAcademy.

Here is the graph data model:

Movie Data Model

You can view the data model in the sandbox to the right by executing this query:

cypher
CALL db.schema.visualization()

The node labels for the graph include:

  • Person

  • Actor

  • Director

  • Movie

  • Genre

  • User

The relationships for the graph include:

  • ACTED_IN (with an optional role property)

  • DIRECTED (with an optional role property)

  • RATED (with rating and timestamp properties)

  • IN_GENRE

Also notice that the nodes have a number of properties, along with the type of data that will be used for each property. It is important that you understand the property types defined in the data model.

You can view the property types for nodes in the graph by executing this query:

cypher
CALL db.schema.nodeTypeProperties()

You can view the property types for relationships in the graph by executing this query:

cypher
CALL db.schema.relTypeProperties()

Each node with a given label has a property that uniquely identifies the node. These nodes are indexed in the graph.

  • Movie nodes use movieId.

  • Person nodes use tmdbId.

  • User nodes use userId.

  • Genre nodes use name.

You can view the uniqueness constraint indexes in the graph by executing this query:

cypher
SHOW CONSTRAINTS

Resources

During this course, you can refer to: