Last active
December 8, 2021 15:50
-
-
Save jexp/750d4b7c72a6596025a7f0f09d47106b to your computer and use it in GitHub Desktop.
GraphQL Training Queries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
movies(options: { limit: 10 }) { | |
title | |
actors { | |
name | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
directors(where: | |
{name:"Robert Redford"}) { | |
name | |
directed { | |
title | |
plot | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createBooks( | |
input: { | |
isbn: "1492047686" | |
title: "Graph Algorithms" | |
price: 37.48 | |
description: | |
"Practical Examples in Apache Spark and Neo4j" | |
} | |
) { | |
books { | |
isbn | |
title | |
price | |
description | |
__typename | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createReviews( | |
input: { | |
rating: 5 | |
text: "Best overview of graph data science!" | |
book: { connect: { where: { node: { title: "Graph Algorithms" } } } } | |
} | |
) { | |
reviews { | |
rating | |
text | |
createdAt | |
book { | |
title | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createCustomers( | |
input: { | |
username: "EmilEifrem7474" | |
reviews: { | |
connect: { | |
where: { node: { text: "Best overview of graph data science!" } } | |
} | |
} | |
orders: { | |
create: { | |
node: { | |
books: { | |
connect: { where: { node: { title: "Graph Algorithms" } } } | |
} | |
shipTo: { | |
create: { | |
node: { | |
address: "111 E 5th Ave, San Mateo, CA 94401" | |
location: { | |
latitude: 37.5635980790 | |
longitude: -122.322243272725 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
) { | |
customers { | |
username | |
orders { | |
placedAt | |
books { | |
title | |
} | |
shipTo { | |
address | |
} | |
} | |
reviews { | |
text | |
rating | |
book { | |
title | |
} | |
} | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
match (a) detach delete a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createBooks( | |
input: [ | |
{ | |
isbn: "1492047686" | |
title: "Graph Algorithms" | |
price: 37.48 | |
description: "Practical Examples in Apache Spark and Neo4j" | |
} | |
{ | |
isbn: "1119387507" | |
title: "Inspired" | |
price: 21.38 | |
description: "How to Create Tech Products Customers Love" | |
} | |
{ | |
isbn: "190962151X" | |
title: "Ross Poldark" | |
price: 15.52 | |
description: "Ross Poldark is the first novel in Winston Graham's sweeping saga of Cornish life in the eighteenth century." | |
} | |
] | |
) { | |
books { | |
title | |
} | |
} | |
createCustomers( | |
input: [ | |
{ | |
username: "EmilEifrem7474" | |
reviews: { | |
create: { | |
node: { | |
rating: 5 | |
text: "Best overview of graph data science!" | |
book: { connect: { where: { node: { isbn: "1492047686" } } } } | |
} | |
} | |
} | |
orders: { | |
create: { | |
node: { | |
books: { | |
connect: { where: { node: { title: "Graph Algorithms" } } } | |
} | |
shipTo: { | |
create: { | |
node: { | |
address: "111 E 5th Ave, San Mateo, CA 94401" | |
location: { | |
latitude: 37.5635980790 | |
longitude: -122.322243272725 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
{ | |
username: "BookLover123" | |
reviews: { | |
create: { | |
node: { | |
rating: 4 | |
text: "Beautiful depiction of Cornwall." | |
book: { connect: { where: { node: { isbn: "190962151X" } } } } | |
} | |
} | |
} | |
orders: { | |
create: { | |
node: { | |
books: { | |
connect: [ | |
{ where: { node: { title: "Ross Poldark" } } } | |
{ where: { node: { isbn: "1119387507" } } } | |
{ where: { node: { isbn: "1492047686" } } } | |
] | |
} | |
shipTo: { | |
create: { | |
node: { | |
address: "Nordenskiöldsgatan 24, 211 19 Malmö, Sweden" | |
location: { | |
latitude: 55.6122270502 | |
longitude: 12.99481772774 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
) { | |
customers { | |
username | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
books { | |
title | |
description | |
price | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Order { | |
orderID: ID! @id | |
placedAt: DateTime @timestamp | |
shippingCost: Float | |
shipTo: Address @relationship(type: "SHIPS_TO", direction: OUT) | |
customer: Customer @relationship(type: "PLACED", direction: IN) | |
books: [Book] @relationship(type: "CONTAINS", direction: OUT) | |
} | |
type Customer { | |
username: String | |
orders: [Order] @relationship(type: "PLACED", direction: OUT) | |
reviews: [Review] @relationship(type: "WROTE", direction: OUT) | |
} | |
type Address { | |
address: String | |
location: Point | |
order: Order @relationship(type: "SHIPS_TO", direction: IN) | |
} | |
type Book { | |
isbn: ID! | |
title: String | |
price: Float | |
description: String | |
authors: [Author] @relationship(type: "AUTHOR_OF", direction: IN) | |
subjects: [Subject] @relationship(type: "ABOUT", direction: OUT) | |
reviews: [Review] @relationship(type: "REVIEWS", direction: IN) | |
} | |
type Review { | |
rating: Int | |
text: String | |
createdAt: DateTime @timestamp | |
book: Book @relationship(type: "REVIEWS", direction: OUT) | |
author: Customer @relationship(type: "WROTE", direction: IN) | |
} | |
type Author { | |
name: String! | |
books: [Book] @relationship(type: "AUTHOR_OF", direction: OUT) | |
} | |
type Subject { | |
name: String! | |
books: [Book] @relationship(type: "ABOUT", direction: IN) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
inspired: updateBooks( | |
where: { title: "Inspired" } | |
create: { | |
subjects: [ | |
{ node: { name: "Product management" } } | |
{ node: { name: "Design" } } | |
] | |
} | |
) { | |
books { | |
title | |
subjects { | |
name | |
} | |
} | |
} | |
poldark: updateBooks( | |
where: { title: "Ross Poldark" } | |
create: { | |
subjects: [ | |
{ node: { name: "Historical fiction" } } | |
{ node: { name: "Cornwall" } } | |
] | |
} | |
) { | |
books { | |
title | |
subjects { | |
name | |
} | |
} | |
} | |
algorithms: updateBooks( | |
where: { title: "Graph Algorithms" } | |
create: { | |
subjects: [ | |
{ node: { name: "Graph theory" } } | |
{ node: { name: "Neo4j" } } | |
] | |
} | |
) { | |
books { | |
title | |
subjects { | |
name | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createBooks( | |
input: [ | |
{ | |
isbn: "1492047686" | |
title: "Graph Algorithms" | |
price: 37.48 | |
description: "Practical Examples in Apache Spark and Neo4j" | |
subjects: { | |
create: [ | |
{ node: { name: "Graph theory" } } | |
{ node: { name: "Neo4j" } } | |
] | |
} | |
authors: { | |
create: [ | |
{ node: { name: "Mark Needham" } } | |
{ node: { name: "Amy E. Hodler" } } | |
] | |
} | |
} | |
{ | |
isbn: "1119387507" | |
title: "Inspired" | |
price: 21.38 | |
description: "How to Create Tech Products Customers Love" | |
subjects: { | |
create: [ | |
{ node: { name: "Product management" } } | |
{ node: { name: "Design" } } | |
] | |
} | |
authors: { create: { node: { name: "Marty Cagan" } } } | |
} | |
{ | |
isbn: "190962151X" | |
title: "Ross Poldark" | |
price: 15.52 | |
description: "Ross Poldark is the first novel in Winston Graham's sweeping saga of Cornish life in the eighteenth century." | |
subjects: { | |
create: [ | |
{ node: { name: "Historical fiction" } } | |
{ node: { name: "Cornwall" } } | |
] | |
} | |
authors: { create: { node: { name: "Winston Graham" } } } | |
} | |
] | |
) { | |
books { | |
title | |
} | |
} | |
createCustomers( | |
input: [ | |
{ | |
username: "EmilEifrem7474" | |
reviews: { | |
create: { | |
node: { | |
rating: 5 | |
text: "Best overview of graph data science!" | |
book: { connect: { where: { node: { isbn: "1492047686" } } } } | |
} | |
} | |
} | |
orders: { | |
create: { | |
node: { | |
books: { | |
connect: { where: { node: { title: "Graph Algorithms" } } } | |
} | |
shipTo: { | |
create: { | |
node: { | |
address: "111 E 5th Ave, San Mateo, CA 94401" | |
location: { | |
latitude: 37.5635980790 | |
longitude: -122.322243272725 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
{ | |
username: "BookLover123" | |
reviews: { | |
create: { | |
node: { | |
rating: 4 | |
text: "Beautiful depiction of Cornwall." | |
book: { connect: { where: { node: { isbn: "190962151X" } } } } | |
} | |
} | |
} | |
orders: { | |
create: { | |
node: { | |
books: { | |
connect: [ | |
{ where: { node: { title: "Ross Poldark" } } } | |
{ where: { node: { isbn: "1119387507" } } } | |
{ where: { node: { isbn: "1492047686" } } } | |
] | |
} | |
shipTo: { | |
create: { | |
node: { | |
address: "Nordenskiöldsgatan 24, 211 19 Malmö, Sweden" | |
location: { | |
latitude: 55.6122270502 | |
longitude: 12.99481772774 | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
] | |
) { | |
customers { | |
username | |
} | |
} | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJCb2JMb2JsYXc3Njg3Iiwicm9sZXMiOlsiYWRtaW4iXSwiaWF0IjoxNTE2MjM5MDIyfQ.f2GKIu31gz39fMJwj5_byFCMDPDy3ncdWOIhhqcwBxk"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dFt8QaYykR6PauvxcyKVXKauxvQuWQTc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJNeVVzZXIxMjMiLCJpYXQiOjE1MTYyMzkwMjJ9.SNXGvSS3NaEVIUNHKxfN_FTXQGMjVnm7qZW7QFb5ur8"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createBooks( | |
input: { | |
isbn: "1492047686" | |
title: "Ancillary Justice" | |
price: 6.05 | |
description: "Once, she was the Justice of Toren -- a colossal starship with an artificial intelligence linking thousands of soldiers in the service of the Radch, the empire that conquered the galaxy." | |
} | |
) { | |
books { | |
isbn | |
title | |
} | |
} | |
createCustomers(input: { username: "MyUser123" }) { | |
customers { | |
username | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createOrders( | |
input: { | |
books: { connect: { where: { node: { title: "Ancillary Justice" } } } } | |
customer: { connect: { where: { node: { username: "MyUser123" } } } } | |
shipTo: { | |
create: { | |
node: { | |
address: "Via Nemorense, Roma, Italy" | |
location: { latitude: 41.883333, longitude: 12.483333 } | |
} | |
} | |
} | |
} | |
) { | |
orders { | |
placedAt | |
books { | |
title | |
} | |
customer { | |
username | |
} | |
shipTo { | |
address | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mutation { | |
createReviews( | |
input: { | |
rating: 5 | |
text: "Great SF Book" | |
book: { connect: { where: { node: { title: "Ancillary Justice" } } } } | |
author: { connect: { where: { node: { username: "MyUser123" } } } } | |
} | |
) { | |
reviews { | |
rating | |
text | |
createdAt | |
book { | |
title | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query { | |
customers { | |
username | |
orders { | |
placedAt | |
books { | |
title | |
} | |
shipTo { | |
address | |
} | |
} | |
reviews { | |
text | |
rating | |
book { | |
title | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment