|
| 1 | +type Movie { |
| 2 | + _id: String |
| 3 | + movieId: ID! |
| 4 | + title: String |
| 5 | + year: Int |
| 6 | + released: Int # was DateTime |
| 7 | + plot: String |
| 8 | + poster: String |
| 9 | + imdbRating: Float |
| 10 | + genres: [Genre] @relation(name: "IN_GENRE", direction: "OUT") |
| 11 | + similar(first: Int = 3, offset: Int = 0): [Movie] @cypher(statement: "WITH {this} AS this MATCH (this)--(:Genre)--(o:Movie) RETURN o") |
| 12 | + mostSimilar: Movie @cypher(statement: "WITH {this} AS this RETURN this") |
| 13 | + degree: Int @cypher(statement: "WITH {this} AS this RETURN SIZE((this)--())") |
| 14 | + actors(first: Int = 3, offset: Int = 0, name: String): [Actor] @relation(name: "ACTED_IN", direction:"IN") |
| 15 | + avgStars: Float |
| 16 | + filmedIn: State @relation(name: "FILMED_IN", direction:"OUT") |
| 17 | + scaleRating(scale: Int = 3): Float @cypher(statement: "WITH $this AS this RETURN $scale * this.imdbRating") |
| 18 | + scaleRatingFloat(scale: Float = 1.5): Float @cypher(statement: "WITH $this AS this RETURN $scale * this.imdbRating") |
| 19 | + actorMovies: [Movie] @cypher(statement: "MATCH (this)-[:ACTED_IN*2]-(other:Movie) RETURN other") |
| 20 | + ratings: [Rated] |
| 21 | +} |
| 22 | +type Genre { |
| 23 | + _id: String! |
| 24 | + name: String |
| 25 | + movies(first: Int = 3, offset: Int = 0): [Movie] @relation(name: "IN_GENRE", direction: "IN") |
| 26 | + highestRatedMovie: Movie @cypher(statement: "MATCH (m:Movie)-[:IN_GENRE]->(this) RETURN m ORDER BY m.imdbRating DESC LIMIT 1") |
| 27 | +} |
| 28 | +type State { |
| 29 | + name: String |
| 30 | +} |
| 31 | +# interface Person { |
| 32 | +# userId: ID! |
| 33 | +# name: String |
| 34 | +#} |
| 35 | +type Actor # implements Person |
| 36 | +{ |
| 37 | + userId: ID! |
| 38 | + name: String |
| 39 | + movies: [Movie] @relation(name: "ACTED_IN", direction:"OUT") |
| 40 | +} |
| 41 | +type User # implements Person |
| 42 | +{ |
| 43 | + userId: ID! |
| 44 | + name: String |
| 45 | + rated(rating: Int): [Rated] |
| 46 | + friends(since: Int): [FriendOf] |
| 47 | +} |
| 48 | +type FriendOf { |
| 49 | + from: User |
| 50 | + since: Int |
| 51 | + to: User |
| 52 | +} |
| 53 | +type Rated { |
| 54 | + from: User |
| 55 | + rating: Int |
| 56 | + to: Movie |
| 57 | +} |
| 58 | +enum BookGenre { |
| 59 | + Mystery, |
| 60 | + Science, |
| 61 | + Math |
| 62 | +} |
| 63 | +type Book { |
| 64 | + genre: BookGenre |
| 65 | +} |
| 66 | +enum _MovieOrdering { |
| 67 | + title_desc, |
| 68 | + title_asc |
| 69 | +} |
| 70 | +enum _GenreOrdering { |
| 71 | + name_desc, |
| 72 | + name_asc |
| 73 | +} |
| 74 | +type Query { |
| 75 | + Movie(_id: String, movieId: ID, title: String, year: Int, plot: String, poster: String, imdbRating: Float, first: Int, offset: Int, orderBy: _MovieOrdering): [Movie] |
| 76 | + MoviesByYear(year: Int): [Movie] |
| 77 | + MovieById(movieId: ID!): Movie |
| 78 | + MovieBy_Id(_id: String!): Movie |
| 79 | + GenresBySubstring(substring: String): [Genre] @cypher(statement: "MATCH (g:Genre) WHERE toLower(g.name) CONTAINS toLower($substring) RETURN g") |
| 80 | + Books: [Book] |
| 81 | +} |
| 82 | +# scalar DateTime |
0 commit comments