Skip to content

Commit 9461d7c

Browse files
flora-jinandreachildkmcginnes
authored
docs: Update outdated documentation and fix small grammar or spelling mistakes (aws#107)
- Update all outdated documentation to account for changes made to the utility. - Proofread and edit grammar or spelling mistakes - Update outdated images that are referenced in the docs Updated documentation list: - CHANGELOG.md - README.md - doc/cdk.md - doc/routesExample.md - doc/todoExample.md - samples/airports.source.schema.graphql Updated images: - doc/images/AppSyncQuery.png - doc/images/todoCreate.png - doc/images/todoGetTodos.png - doc/images/todoNestedQuery.png --------- Co-authored-by: andreachild <andrea.child@improving.com> Co-authored-by: Kris McGinnes <kris@mcginnes.io>
1 parent a84c082 commit 9461d7c

14 files changed

+531
-201
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,5 @@ This release contains new support for Apollo Server integration.
6161
* Enabled mutations for the Apollo Server ([#98](https://github.com/aws/amazon-neptune-for-graphql/pull/98))
6262
* Refactored integration tests to be less vulnerable to resolver logic changes ([#99](https://github.com/aws/amazon-neptune-for-graphql/pull/99))
6363
* Enabled usage of query fragments with Apollo Server ([#103](https://github.com/aws/amazon-neptune-for-graphql/pull/103))
64-
* Compressed resolver schema file and moved schema initialization outside of event handlers to improve performance ([#111](https://github.com/aws/amazon-neptune-for-graphql/pull/111))
64+
* Compressed resolver schema file and moved schema initialization outside of event handlers to improve performance ([#111](https://github.com/aws/amazon-neptune-for-graphql/pull/111))
65+
* Updated and proofread outdated documentation ([#107](https://github.com/aws/amazon-neptune-for-graphql/pull/107))

README.md

Lines changed: 28 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@
55

66
The Amazon Neptune utility for GraphQL&trade; is a Node.js command-line utility to help with the creation and maintenance of a GraphQL API for the Amazon Neptune Database or Neptune Analytics graph. It is a no-code solution for a GraphQL resolver when GraphQL queries have a variable number of input parameters and return a variable number of nested fields.
77

8-
If you **start from a Neptune database with data**, the utility discover the graph database schema including nodes, edges, properties and edges cardinality, generate the GraphQL schema with the directives required to map the GraphQL types to the graph databases nodes and edges, and auto-generate the resolver code. We optimized the resolver code to reduce the latency of querying Amazon Neptune by returning only the data requested by the GraphQL query. *(Note: the utility works only for Property Graph databases, not RDF yet)*
8+
If you **start from a Neptune database with data**, the utility discovers the graph database schema including nodes, edges, properties and edges cardinality. This database schema is then used to generate the GraphQL schema with the directives required to map the GraphQL types to the graph databases nodes and edges, and auto-generate the resolver code. We optimized the resolver code to reduce the latency of querying Amazon Neptune by returning only the data requested by the GraphQL query.
99

10-
You can also **start with a GraphQL schema with your types and an empty Neptune database**. The utility will process your starting GraphQL schema and inference the directives required to map it to the Neptune database graph nodes and edges. You can also **start with GraphQL schema with the directives**, that you have modified or created.
10+
> [!NOTE]
11+
>
12+
> This utility works for Property Graph databases only. Support for RDF has not yet been added.
13+
14+
You can also **start with a GraphQL schema with your types and an empty Neptune database**. The utility will process your starting GraphQL schema and inference the directives required to map it to the Neptune database graph nodes and edges. You can also **start with a GraphQL schema with the directives**, that you have modified or created.
1115

1216
The utility has the option to **generate the AWS resources** of the entire pipeline, including the AWS AppSync API, configuring the roles, data source, schema and resolver, and the AWS Lambda that queries Amazon Neptune.
1317

@@ -85,7 +89,13 @@ To rollback, removing all the AWS resources run:
8589
<br>
8690

8791
# Starting from a GraphQL schema and an empty Neptune database
88-
You can start from an empty Neptune database and use a GraphQL API to create the data and query it. Running the command below, the utility will automate the creation of the AWS resources. Your *your-graphql-schema-file* must include the GraphQL schema types, like in the TODO example [here](/doc/todoExample.md). The utility will analyze your schema and create an extended version based on your types. It will add queries and mutations for the nodes stored in the graph database, and in case your schema have nested types, it will add relationships between the types stored as edges in the graph database, again see the TODO example [here](/doc/todoExample.md). The utility creates an AppSync GraphQL API, and the required AWS resources, like a pair of IAM roles and a Lambda function with the GraphQL resolver code. As soon as the utility complete the execution, you will find in the AppSync console your new GraphQL API called *your-new-GraphQL-API-name*API. To test it, use the AppSync “Queries” from the menu. (*Note: follow the setup instructions below to enable your environment to reach the Neptune database and create AWS resources.*)
92+
You can start from an empty Neptune database and use a GraphQL API to create the data and query it. Running the command below, the utility will automate the creation of the AWS resources.
93+
Your *your-graphql-schema-file* must include the GraphQL schema types, like in the [TODO example](/doc/todoExample.md). The utility will analyze your schema and create an extended version based on your types. It will add queries and mutations for the nodes stored in the graph database, and in case your schema have nested types, it will add relationships between the types stored as edges in the graph database, again see the [TODO example](/doc/todoExample.md).
94+
The utility creates an AppSync GraphQL API and the required AWS resources, like a pair of IAM roles and a Lambda function with the GraphQL resolver code. As soon as the utility completes the execution, you will find in the AppSync console your new GraphQL API called *your-new-GraphQL-API-name*API. To test it, use the AppSync “Queries” from the menu.
95+
96+
> [!TIP]
97+
>
98+
> Follow the setup instructions below to enable your environment to reach the Neptune database and create AWS resources.
8999
90100
`neptune-for-graphql --input-schema-file `<*your-graphql-schema-file*>` --create-update-aws-pipeline --create-update-aws-pipeline-name` <*your-new-GraphQL-API-name*>` --create-update-aws-pipeline-neptune-endpoint` <*your-neptune-database-endpoint:port*> ` --output-resolver-query-https`
91101

@@ -106,7 +116,7 @@ You can start from a GraphQL schema with directives for a graph database. For th
106116
<br>
107117

108118
# Customize the GraphQL schema with directives
109-
The utility generate a GraphQL schema with directives, queries and mutations. You might want to use it as is, or change it. Here below ways to change it.
119+
The utility generates a GraphQL schema with directives, queries and mutations. You might want to use it as is, or change it. Below are ways to change it.
110120

111121
### Please no mutations in my schema
112122
In case you don't want your Graph API having the option of updating your database data, add the the CLI option `--output-schema-no-mutations`.
@@ -141,15 +151,15 @@ type Airport @alias(property: "airport") {
141151
### @graphQuery, @cypher
142152
You can define your openCypher queries to resolve a field value, add queries or mutations.
143153

144-
Here new a field *outboundRoutesCount* is added to the type *Airport* to count the outboud routes:
154+
Here a new field *outboundRoutesCount* is added to the type *Airport* to count the outbound routes:
145155

146156
```graphql
147157
type Airport @alias(property: "airport") {
148158
...
149159
outboundRoutesCount: Int @graphQuery(statement: "MATCH (this)-[r:route]->(a) RETURN count(r)")
150160
}
151161
```
152-
Here an example of new queries and mutations. Note that if you omit the *RETURN*, the resolver will assume the keyword *this* is the returning scope.
162+
Here is an example of new queries and mutations. Note that if you omit the *RETURN*, the resolver will assume the keyword *this* is the returning scope.
153163
```graphql
154164
type Query {
155165
getAirportConnection(fromCode: String!, toCode: String!): Airport @cypher(statement: "MATCH (:airport{code: '$fromCode'})-[:route]->(this:airport)-[:route]->(:airport{code:'$toCode'})")
@@ -171,7 +181,7 @@ type Query {
171181
```
172182

173183
### @id
174-
The directive @id identify the field mapped to the graph database entity id. Graph databases like Amazon Neptune always have a unique id for nodes and edges assigned during bulk imports or autogenerated.
184+
The directive @id identifies the field mapped to the graph database entity id. Graph databases like Amazon Neptune always have a unique id for nodes and edges assigned during bulk imports or autogenerated.
175185
In the example below _id
176186
```graphql
177187
type Airport {
@@ -182,7 +192,7 @@ type Airport {
182192
```
183193

184194
### Reserved types, queries and mutations names
185-
The utility autogenerates queries and mutations to enable you to have a working GraphQL API just after having ran the utility. The pattern of these names are recognized by the resolver and are reserved. Here an example for the type *Airport* and the connecting type *Route*:
195+
The utility auto generates queries and mutations to enable you to have a working GraphQL API just after having ran the utility. The pattern of these names are recognized by the resolver and are reserved. Here is an example for the type *Airport* and the connecting type *Route*:
186196

187197
The type *Options* is reserved.
188198
```graphql
@@ -191,18 +201,18 @@ input Options {
191201
}
192202
```
193203

194-
The function parameters *filter*, and *options* are reserved.
204+
The function parameters *filter*, *options*, and *sort* are reserved.
195205
```graphql
196206
type Query {
197-
getNodeAirports(filter: AirportInput, options: Options): [Airport]
207+
getNodeAirports(filter: AirportInput, options: Options, sort: [AirportSort!]): [Airport]
198208
}
199209
```
200210

201211
The beginning of query names *getNode...*, and the beginning of the mutations names like *createNode...*, *updateNode...*, *deleteNode...*, *connectNode...*, *updateEdge...*, and *deleteEdge...*.
202212
```graphql
203213
type Query {
204214
getNodeAirport(id: ID, filter: AirportInput): Airport
205-
getNodeAirports(filter: AirportInput): [Airport]
215+
getNodeAirports(filter: AirportInput, options: Options, sort: [AirportSort!]): [Airport]
206216
}
207217

208218
type Mutation {
@@ -246,30 +256,30 @@ You have three option to created the GraphQL API pipeline:
246256
- You manually create the AWS resources
247257

248258
Independently of the method you or the utility will need to create the following resources:
249-
- Create a IAM role for Lambda called LambdaExecutionRole
259+
- Create an IAM role for Lambda called LambdaExecutionRole
250260
- Attach to the LambdaExecutionRole the IAM policy AWSLambdaBasicExecutionRole
251261
- For VPC (default) attach to the LambdaExecutionRole the IAM policy AWSLambdaVPCAccessExecutionRole
252262
- For IAM create and attach to the LambdaExecutionRole a new IAM policy that only allow to connect and query Neptune
253263
- Create a Lambda function with the LambdaExecutionRole
254-
- Create a IAM for AppSync API to call the Lambda called LambdaInvocationRole
264+
- Create an IAM for AppSync API to call the Lambda called LambdaInvocationRole
255265
- Attach to the LambdaInvocationRole the policy LambdaInvokePolicy
256266
- Create the AppSync GraphQL API
257267
- Add to the AppSync API a Function with the LambdaInvocationRole to call the Lambda
258268

259269

260270
### Let the utility create the resources
261-
With the CLI option `--create-update-aws-pipeline`, and its accesory options ([see the commands reference](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/cliReference.md)), the utility automatically creates the resources.<br>
271+
With the CLI option `--create-update-aws-pipeline`, and its accessory options ([see the commands reference](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/cliReference.md)), the utility automatically creates the resources.<br>
262272
You need to run the utility from a shell in which you installed the AWS CLI, and it is configured for a user with the permission of creating AWS resources. <br>
263273
The utility creates a file with the list of resources named *pipeline-name.resources.json*. Then it uses the file to modify the existing resources when the user runs the command again, or when the user wants to delete the AWS resources with the command option `--remove-aws-pipeline-name <value>`.
264-
The code of the utility uses the JavaScript AWS sdk v3, if you'd like to review the code is only in [this file](https://github.com/aws/amazon-neptune-for-graphql/blob/main/src/pipelineResources.js).
274+
The code of the utility uses the JavaScript AWS sdk v3, if you'd like to review the code, it is only in [this file](https://github.com/aws/amazon-neptune-for-graphql/blob/main/src/pipelineResources.js).
265275

266276
### I prefer a CDK file
267-
To option to trigger the creation of the CDK file starts with `--output-aws-pipeline-cdk`, and its accessory options ([see the commands reference](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/cliReference.md)). <br>
268-
After you ran it, you will find in the *output* folder the file *CDK-pipeline-name-cdk.js* and *CDK-pipeline-name.zip*. The ZIP file is the code for the Lambda function.
277+
The option to trigger the creation of the CDK file starts with `--output-aws-pipeline-cdk`, and its accessory options ([see the commands reference](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/cliReference.md)). <br>
278+
After running, you will find in the *output* folder the file *CDK-pipeline-name-cdk.js* and *CDK-pipeline-name.zip*. The ZIP file is the code for the Lambda function.
269279
See CDK end to end example [here](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/cdk.md).
270280

271281
### Let me setup the resources manually or with my favorite DevOps toolchain
272-
[Here](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/resources.md) the detailed list of resources needed to configure the GraphQL API pipeline.
282+
[Here](https://github.com/aws/amazon-neptune-for-graphql/blob/main/doc/resources.md) is the detailed list of resources needed to configure the GraphQL API pipeline.
273283
<br>
274284

275285
# Generate Apollo Server Artifacts

doc/cdk.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ new AppSyncNeptuneStack(app, 'your-CdkStack-name', {
105105
106106
### Run the CDK application
107107
108-
To create CloudFormantion template:
108+
To create CloudFormation template:
109109
110110
`cdk synth`
111111
112112
To deploy the CloudFormation template:
113113
114114
`cdk deploy`
115115
116-
To rollback your deployment:
116+
To roll back your deployment:
117117
118118
`cdk destroy`

doc/images/AppSyncQuery.jpg

-161 KB
Binary file not shown.

doc/images/AppSyncQuery.png

333 KB
Loading

doc/images/todoCreate.jpg

-104 KB
Binary file not shown.

doc/images/todoCreate.png

323 KB
Loading

doc/images/todoGetTodos.jpg

-107 KB
Binary file not shown.

doc/images/todoGetTodos.png

305 KB
Loading

doc/images/todoNestedQuery.JPG

-88.2 KB
Binary file not shown.

0 commit comments

Comments
 (0)