You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-dotnet.md
+207-5Lines changed: 207 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
---
2
-
title: 'Quickstart: Library for .NET'
2
+
title: 'Quickstart: Gremlin library for .NET'
3
3
titleSuffix: Azure Cosmos DB for Apache Gremlin
4
4
description: In this quickstart, connect to Azure Cosmos DB for Apache Gremlin using .NET. Then, create and traverse vertices and edges.
5
5
author: manishmsfte
6
6
ms.author: mansha
7
7
ms.reviewer: sidandrews
8
8
ms.service: cosmos-db
9
9
ms.subservice: apache-gremlin
10
-
ms.topic: quickstart
10
+
ms.topic: quickstart-sdk
11
11
ms.date: 09/27/2023
12
12
# CustomerIntent: As a .NET developer, I want to use a library for my programming language so that I can create and traverse vertices and edges in code.
13
13
---
14
14
15
-
# Quickstart: Azure Cosmos DB for Apache Gremlin library for Python
15
+
# Quickstart: Azure Cosmos DB for Apache Gremlin library for .NET
To use the *NAME* and *URI* values obtained earlier in this quickstart, persist them to new environment variables on the local machine running the application.
91
+
92
+
1. To set the environment variable, use your terminal to persist the values as `COSMOS_ENDPOINT` and `COSMOS_KEY` respectively.
93
+
94
+
```bash
95
+
export COSMOS_GREMLIN_ENDPOINT="<account-name>"
96
+
export COSMOS_GREMLIN_KEY="<account-key>"
97
+
```
98
+
99
+
1. Validate that the environment variables were set correctly.
100
+
101
+
```bash
102
+
printenv COSMOS_GREMLIN_ENDPOINT
103
+
printenv COSMOS_GREMLIN_KEY
104
+
```
105
+
106
+
## Code examples
107
+
108
+
- [Authenticate the client](#authenticate-the-client)
109
+
- [Create vertices](#create-vertices)
110
+
- [Create edges](#create-edges)
111
+
- [Query vertices & edges](#query-vertices--edges)
112
+
113
+
The code in this article connects to a database named `cosmicworks` and a graph named `products`. The code then adds vertices and edges to the graph before traversing the added items.
114
+
115
+
### Authenticate the client
116
+
117
+
Application requests to most Azure services must be authorized. For the API forGremlin, use the *NAME* and *URI* values obtained earlierin this quickstart.
118
+
119
+
1. Open the **Program.cs** file.
120
+
121
+
1. Delete any existing content within the file.
122
+
123
+
1. Add a using block for the `Gremlin.Net.Driver` namespace.
1. Create `accountName` and `accountKey` string variables. Store the `COSMOS_GREMLIN_ENDPOINT` and `COSMOS_GREMLIN_KEY` environment variables as the values for each respective variable.
1. Iterate over each matching vertex using a `foreach` loop and write to the console a message that starts with `[REPLACES PRODUCT]` and includes the matching product `id` field as a suffix.
Validate that your application works as expected by running the application. The application should execute with no errors or warnings. The output of the application includes data about the created and queried items.
213
+
214
+
1. Open the terminal in the .NET project folder.
215
+
216
+
1. Use `dotnet run` to run the application.
217
+
218
+
```bash
219
+
dotnet run
220
+
```
221
+
222
+
1. Observe the output from the application.
223
+
224
+
```output
225
+
[CREATED PRODUCT] 68719518403
226
+
[REPLACES PRODUCT] 68719518371
227
+
[REPLACES PRODUCT] 68719518409
228
+
```
229
+
230
+
## Clean up resources
231
+
232
+
When you no longer need the API for Gremlin account, delete the corresponding resource group.
233
+
234
+
1. Open your terminal in any folder.
235
+
236
+
1. Use `az group delete` to delete the resource group.
237
+
238
+
```azurecli-interactive
239
+
az group delete \
240
+
--name $resourceGroupName
241
+
```
242
+
243
+
## Next step
244
+
245
+
> [!div class="nextstepaction"]
246
+
> [Create and query data using Azure Cosmos DB for Apache Gremlin](tutorial-query.md)
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-nodejs.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.author: mansha
7
7
ms.reviewer: sidandrews
8
8
ms.service: cosmos-db
9
9
ms.subservice: apache-gremlin
10
-
ms.topic: quickstart
10
+
ms.topic: quickstart-sdk
11
11
ms.date: 09/27/2023
12
12
# CustomerIntent: As a Node.js developer, I want to use a library for my programming language so that I can create and traverse vertices and edges in code.
13
13
---
@@ -37,7 +37,7 @@ In this quickstart, you use the `gremlin` library to connect to a newly created
37
37
38
38
## Setting up
39
39
40
-
This section walks you through creating an API for Gremlin account an setting up a .NET project to use the library to connect to the account.
40
+
This section walks you through creating an API for Gremlin account and setting up a .NET project to use the library to connect to the account.
Copy file name to clipboardExpand all lines: articles/cosmos-db/gremlin/quickstart-python.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ms.author: mansha
7
7
ms.reviewer: sidandrews
8
8
ms.service: cosmos-db
9
9
ms.subservice: apache-gremlin
10
-
ms.topic: quickstart
10
+
ms.topic: quickstart-sdk
11
11
ms.date: 09/27/2023
12
12
# CustomerIntent: As a Python developer, I want to use a library for my programming language so that I can create and traverse vertices and edges in code.
13
13
---
@@ -37,7 +37,7 @@ In this quickstart, you use the `gremlinpython` library to connect to a newly cr
37
37
38
38
## Setting up
39
39
40
-
This section walks you through creating an API for Gremlin account an setting up a .NET project to use the library to connect to the account.
40
+
This section walks you through creating an API for Gremlin account and setting up a .NET project to use the library to connect to the account.
0 commit comments