Permalink
Fetching contributors…
Cannot retrieve contributors at this time
47 lines (41 sloc) 1.75 KB
interface Person {
name: ID!
born: Int
movies: [Movie]
score(value:Int!): Int @cypher(statement:"RETURN {value}")
}
type Actor implements Person {
name: ID!
born: Int
movies: [Movie] @relation(name:"ACTED_IN")
score(value:Int!): Int @cypher(statement:"RETURN {value}")
totalMoviesCount: Int @cypher(statement: "WITH {this} AS this MATCH (this)-[:ACTED_IN]->() RETURN count(*) AS totalMoviesCount")
recommendedColleagues: [Person] @cypher(statement: "WITH {this} AS this MATCH (this)-[:ACTED_IN]->()<-[:ACTED_IN]-(other) RETURN other")
namedColleagues(name: String!): [Person] @cypher(statement: "WITH {this} AS this MATCH (this)-[:ACTED_IN]->()<-[:ACTED_IN]-(other) WHERE other.name CONTAINS {name} RETURN other")
}
type Director implements Person {
name: ID!
born: Int
movies: [Movie] @relation(name:"DIRECTED")
score(value:Int!): Int @cypher(statement:"RETURN {value}")
}
type Movie {
title: ID!
released: Int
tagline: String
actors: [Actor] @relation(name:"ACTED_IN",direction:"IN")
directors: [Director] @relation(name:"DIRECTED",direction:"IN")
}
schema {
mutation: MutationType
query: QueryType
}
type MutationType {
newPerson(name:ID!, born:Int) : String @cypher(statement:"CREATE (:Person {name:{name},born:{born}})")
newMovie(title:ID!, released:Int, tagline:String) : Movie @cypher(statement:"MERGE (m:Movie {title:{title}}) ON CREATE SET m += {released:{released}, tagline:{tagline}} RETURN m")
}
type QueryType {
personByName(name:ID!) : Person @cypher(statement:"MATCH (p:Person {name:{name}}) RETURN p")
personByBorn(born:Int!) : [Person] @cypher(statement:"MATCH (p:Person {born:{born}}) RETURN p")
movieCount : Int @cypher(statement:"MATCH (:Movie) RETURN count(*)")
}