docs / grandstack-server / Reference

Schema reference

Every type and field below comes from schema/schema.graphql. @neo4j/graphql also generates queries, mutations, filters and sort inputs for each @node type (for example movies, moviesConnection, createMovies, updateMovies, deleteMovies); those are not listed here. See mutations and the live schema at /graphql for the generated parts.

Movie

node type (stored in Neo4j). A film in the Movies graph.

FieldTypeDescription
titleString!Film title. Unique within the dataset.
taglineStringTagline shown on the poster.
releasedIntYear the film was released.
ratingFloatAudience rating from 0 to 10. Sample data, approximate.
runtimeIntRunning time in minutes.
genres[Genre!]!Genres the film belongs to. (relationship IN_GENRE (OUT))
actors[Person!]!People who acted in the film. (relationship ACTED_IN (IN), properties ActedIn)
directors[Person!]!People who directed the film. (relationship DIRECTED (IN))
similar(limit: Int = 8)[Movie!]!Films most like this one, best match first. Scored by shared director (3 points), shared cast member (2) and shared genre (1). Argument limit: Maximum number of films to return. (computed by a @cypher statement (see below))

Person

node type (stored in Neo4j). A person who acted in or directed films.

FieldTypeDescription
nameString!Full name. Unique within the dataset.
bornIntYear the person was born. Only known for some people.
actedCountIntNumber of films the person acted in. Stored on the node and recalculated by the server after every mutation.
directedCountIntNumber of films the person directed. Stored on the node and recalculated by the server after every mutation.
actedIn[Movie!]!Films the person acted in. (relationship ACTED_IN (OUT), properties ActedIn)
directed[Movie!]!Films the person directed. (relationship DIRECTED (OUT))
collaborators(limit: Int = 8)[Collaboration!]!People this person has worked with most, ranked by number of shared films (acting or directing). Argument limit: Maximum number of collaborators to return. (computed by a @cypher statement (see below))

Collaboration

plain object type. A person someone has worked with, and how many films they share.

FieldTypeDescription
nameString!Name of the collaborator. Look the person up by this name.
filmsInt!Number of films the two people worked on together.

Genre

node type (stored in Neo4j). A film genre.

FieldTypeDescription
nameString!Genre name, for example Drama.
movies[Movie!]!Films in this genre. (relationship IN_GENRE (IN))

ActedIn

relationship properties. Properties on the ACTED_IN relationship.

FieldTypeDescription
roles[String!]!Character names played in the film.

Computed fields (@cypher)

These fields run a Cypher statement on request, so they always reflect the current graph.

Movie.similar

MATCH (this)-[r1:IN_GENRE|ACTED_IN|DIRECTED]-(shared)-[r2:IN_GENRE|ACTED_IN|DIRECTED]-(other:Movie)
WHERE other <> this AND type(r1) = type(r2)
WITH other, sum(CASE type(r1) WHEN 'DIRECTED' THEN 3 WHEN 'ACTED_IN' THEN 2 ELSE 1 END) AS score
ORDER BY score DESC, other.rating DESC, other.title
RETURN other LIMIT $limit

Person.collaborators

MATCH (this)-[:ACTED_IN|DIRECTED]->(m:Movie)<-[:ACTED_IN|DIRECTED]-(other:Person)
WHERE other <> this
WITH other, count(DISTINCT m) AS films
ORDER BY films DESC, other.name
LIMIT $limit
RETURN {name: other.name, films: films} AS result

Source: grandstack-server/docs/schema-reference.md (this page is a copy; edit it in the repository)