Skip to content

Commit e70ae2c

Browse files
authored
Merge pull request #102449 from v-thepet/quickstarts4
Three Cosmos DB graph quickstarts & include
2 parents 7397800 + ad4d023 commit e70ae2c

15 files changed

+78
-88
lines changed

articles/cosmos-db/create-graph-java.md

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ms.author: lbosq
1111
ms.custom: seo-java-july2019, seo-java-august2019, seo-java-september2019
1212

1313
---
14-
# Quickstart: Build a graph database with the Java SDK and the Azure Cosmos DB Table API
14+
# Quickstart: Build a graph database with the Java SDK and the Azure Cosmos DB Gremlin API
1515

1616
> [!div class="op_single_selector"]
1717
> * [Gremlin console](create-graph-gremlin-console.md)
@@ -22,21 +22,13 @@ ms.custom: seo-java-july2019, seo-java-august2019, seo-java-september2019
2222
> * [PHP](create-graph-php.md)
2323
>
2424
25-
Azure Cosmos DB is Microsoft’s globally distributed multi-model database service. Using Azure Cosmos DB, you can quickly create and query managed document, table, and graph databases.
26-
27-
This quickstart creates a simple graph database using the Azure portal tools for Azure Cosmos DB. This quickstart also shows you how to quickly create a Java console app using a [Gremlin API](graph-introduction.md) database using the OSS [Apache TinkerPop](https://tinkerpop.apache.org/) driver. The instructions in this quickstart can be followed on any operating system that is capable of running Java. This quickstart familiarizes you with creating and modifying graphs in either the UI or programmatically, whichever is your preference.
25+
In this quickstart, you create and manage an Azure Cosmos DB Gremlin (graph) API account from the Azure portal, and add data by using a Java app cloned from GitHub. Azure Cosmos DB is a multi-model database service that lets you quickly create and query document, table, key-value, and graph databases with global distribution and horizontal scale capabilities.
2826

2927
## Prerequisites
30-
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
31-
32-
In addition:
33-
34-
* [Java Development Kit (JDK) version 8](https://aka.ms/azure-jdks)
35-
* Be sure to set the JAVA_HOME environment variable to point to the folder where the JDK is installed.
36-
* [Download](https://maven.apache.org/download.cgi) and [install](https://maven.apache.org/install.html) a [Maven](https://maven.apache.org/) binary archive
37-
* On Ubuntu, you can run `apt-get install maven` to install Maven.
38-
* [Git](https://www.git-scm.com/)
39-
* On Ubuntu, you can run `sudo apt-get install git` to install Git.
28+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
29+
- [Java Development Kit (JDK) 8](https://www.azul.com/downloads/azure-only/zulu/?&version=java-8-lts&architecture=x86-64-bit&package=jdk). Point your `JAVA_HOME` environment variable to the folder where the JDK is installed.
30+
- A [Maven binary archive](https://maven.apache.org/download.cgi).
31+
- [Git](https://www.git-scm.com/downloads).
4032

4133
## Create a database account
4234

@@ -74,17 +66,19 @@ Now let's switch to working with code. Let's clone a Gremlin API app from GitHub
7466

7567
This step is optional. If you're interested in learning how the database resources are created in the code, you can review the following snippets. Otherwise, you can skip ahead to [Update your connection string](#update-your-connection-information).
7668
77-
The following snippets are all taken from the C:\git-samples\azure-cosmos-db-graph-java-getting-started\src\GetStarted\Program.java file.
69+
The following snippets are all taken from the *C:\git-samples\azure-cosmos-db-graph-java-getting-started\src\GetStarted\Program.java* file.
70+
71+
This Java console app uses a [Gremlin API](graph-introduction.md) database with the OSS [Apache TinkerPop](https://tinkerpop.apache.org/) driver.
7872
79-
* The Gremlin `Client` is initialized from the configuration in the C:\git-samples\azure-cosmos-db-graph-java-getting-started\src\remote.yaml file.
73+
- The Gremlin `Client` is initialized from the configuration in the *C:\git-samples\azure-cosmos-db-graph-java-getting-started\src\remote.yaml* file.
8074
8175
```java
8276
cluster = Cluster.build(new File("src/remote.yaml")).create();
8377
...
8478
client = cluster.connect();
8579
```
8680
87-
* Series of Gremlin steps are executed using the `client.submit` method.
81+
- Series of Gremlin steps are executed using the `client.submit` method.
8882
8983
```java
9084
ResultSet results = client.submit(gremlin);
@@ -101,14 +95,14 @@ The following snippets are all taken from the C:\git-samples\azure-cosmos-db-gra
10195
10296
Now go back to the Azure portal to get your connection information and copy it into the app. These settings enable your app to communicate with your hosted database.
10397
104-
1. In the [Azure portal](https://portal.azure.com/), select **Keys**.
98+
1. In your Azure Cosmos DB account in the [Azure portal](https://portal.azure.com/), select **Keys**.
10599
106100
Copy the first portion of the URI value.
107101
108102
![View and copy an access key in the Azure portal, Keys page](./media/create-graph-java/copy-access-key-azure-portal.png)
109-
2. Open the src/remote.yaml file and paste the unique ID value over `$name$` in `hosts: [$name$.graphs.azure.com]`.
103+
2. Open the *src/remote.yaml* file and paste the unique ID value over `$name$` in `hosts: [$name$.graphs.azure.com]`.
110104
111-
Line 1 of remote.yaml should now look similar to
105+
Line 1 of *remote.yaml* should now look similar to
112106
113107
`hosts: [test-graph.graphs.azure.com]`
114108
@@ -120,11 +114,11 @@ Now go back to the Azure portal to get your connection information and copy it i
120114
121115
4. In the Azure portal, use the copy button to copy the PRIMARY KEY and paste it over `$masterKey$` in `password: $masterKey$`.
122116
123-
Line 4 of remote.yaml should now look similar to
117+
Line 4 of *remote.yaml* should now look similar to
124118
125119
`password: 2Ggkr662ifxz2Mg==`
126120
127-
5. Change line 3 of remote.yaml from
121+
5. Change line 3 of *remote.yaml* from
128122
129123
`username: /dbs/$database$/colls/$collection$`
130124
@@ -134,7 +128,7 @@ Now go back to the Azure portal to get your connection information and copy it i
134128
135129
If you used a unique name for your sample database or graph, update the values as appropriate.
136130
137-
6. Save the remote.yaml file.
131+
6. Save the *remote.yaml* file.
138132
139133
## Run the console app
140134
@@ -167,7 +161,7 @@ Now go back to the Azure portal to get your connection information and copy it i
167161
168162
You can now go back to Data Explorer and see the vertices added to the graph, and add additional data points.
169163
170-
1. Select **Data Explorer**, expand **sample-graph**, select **Graph**, and then select **Apply Filter**.
164+
1. In your Azure Cosmos DB account in the Azure portal, select **Data Explorer**, expand **sample-graph**, select **Graph**, and then select **Apply Filter**.
171165
172166
![Create new documents in Data Explorer in the Azure portal](./media/create-graph-java/azure-cosmosdb-data-explorer-expanded.png)
173167
@@ -208,7 +202,7 @@ You can now go back to Data Explorer and see the vertices added to the graph, an
208202

209203
10. Select **OK**.
210204

211-
11. ClSelectck the **Apply Filter** button with the default `g.V()` filter to display all the values in the graph. All of the users now show in the **Results** list.
205+
11. Select the **Apply Filter** button with the default `g.V()` filter to display all the values in the graph. All of the users now show in the **Results** list.
212206
213207
As you add more data, you can use filters to limit your results. By default, Data Explorer uses `g.V()` to retrieve all vertices in a graph. You can change it to a different [graph query](tutorial-query-graph.md), such as `g.V().count()`, to return a count of all the vertices in the graph in JSON format. If you changed the filter, change the filter back to `g.V()` and select **Apply Filter** to display all the results again.
214208
@@ -224,7 +218,7 @@ You can now go back to Data Explorer and see the vertices added to the graph, an
224218
225219
![Two vertices connected in Data Explorer - Azure CosmosDB](./media/create-graph-java/azure-cosmosdb-graph-explorer.png)
226220
227-
That completes the resource creation part of this tutorial. You can continue to add vertexes to your graph, modify the existing vertexes, or change the queries. Now let's review the metrics Azure Cosmos DB provides, and then clean up the resources.
221+
That completes the resource creation part of this tutorial. You can continue to add vertexes to your graph, modify the existing vertexes, or change the queries. Now let's review the metrics Azure Cosmos DB provides, and then clean up the resources.
228222
229223
## Review SLAs in the Azure portal
230224
@@ -236,7 +230,7 @@ You can now go back to Data Explorer and see the vertices added to the graph, an
236230
237231
## Next steps
238232
239-
In this quickstart, you've learned how to create an Azure Cosmos DB account, create a graph using the Data Explorer, and run an app. You can now build more complex queries and implement powerful graph traversal logic using Gremlin.
233+
In this quickstart, you learned how to create an Azure Cosmos DB account, create a graph using the Data Explorer, and run a Java app that adds data to the graph. You can now build more complex queries and implement powerful graph traversal logic using Gremlin.
240234
241235
> [!div class="nextstepaction"]
242236
> [Query using Gremlin](tutorial-query-graph.md)

articles/cosmos-db/create-graph-nodejs.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ ms.author: lbosq
2121
> * [PHP](create-graph-php.md)
2222
>
2323
24-
Azure Cosmos DB is the globally distributed multimodel database service from Microsoft. You can quickly create and query document, key/value, and graph databases, all of which benefit from the global distribution and horizontal scale capabilities at the core of Azure Cosmos DB.
25-
26-
This quickstart demonstrates how to create an Azure Cosmos DB [Gremlin API](graph-introduction.md) account, database, and graph using the Azure portal. You then build and run a console app by using the open-source [Gremlin Node.js](https://www.npmjs.com/package/gremlin) driver.
24+
In this quickstart, you create and manage an Azure Cosmos DB Gremlin (graph) API account from the Azure portal, and add data by using a Node.js app cloned from GitHub. Azure Cosmos DB is a multi-model database service that lets you quickly create and query document, table, key-value, and graph databases with global distribution and horizontal scale capabilities.
2725

2826
## Prerequisites
29-
30-
Before you can run this sample, you must have the following prerequisites:
31-
* [Node.js](https://nodejs.org/en/) version v0.10.29 or later
32-
* [Git](https://git-scm.com/)
33-
34-
[!INCLUDE [quickstarts-free-trial-note](../../includes/quickstarts-free-trial-note.md)]
27+
- An Azure account with an active subscription. [Create one for free](https://azure.microsoft.com/free/?ref=microsoft.com&utm_source=microsoft.com&utm_medium=docs&utm_campaign=visualstudio).
28+
- [Node.js 0.10.29+](https://nodejs.org/).
29+
- [Git](https://git-scm.com/downloads).
3530

3631
## Create a database account
3732

@@ -69,7 +64,9 @@ Now let's clone a Gremlin API app from GitHub, set the connection string, and ru
6964

7065
This step is optional. If you're interested in learning how the database resources are created in the code, you can review the following snippets. Otherwise, you can skip ahead to [Update your connection string](#update-your-connection-string).
7166
72-
The following snippets are all taken from the app.js file.
67+
The following snippets are all taken from the *app.js* file.
68+
69+
This console app uses the open-source [Gremlin Node.js](https://www.npmjs.com/package/gremlin) driver.
7370
7471
* The Gremlin client is created.
7572
@@ -92,7 +89,7 @@ The following snippets are all taken from the app.js file.
9289
9390
```
9491
95-
The configurations are all in `config.js`, which we edit in the [following section](#update-your-connection-string).
92+
The configurations are all in *config.js*, which we edit in the [following section](#update-your-connection-string).
9693
9794
* A series of functions are defined to execute different Gremlin operations. This is one of them:
9895
@@ -146,23 +143,23 @@ The following snippets are all taken from the app.js file.
146143
147144
## Update your connection string
148145
149-
1. Open the config.js file.
146+
1. Open the *config.js* file.
150147
151-
2. In config.js, fill in the `config.endpoint` key with the **Gremlin URI** value from the **Overview** page of the Azure portal.
148+
2. In *config.js*, fill in the `config.endpoint` key with the **Gremlin Endpoint** value from the **Overview** page of your Cosmos DB account in the Azure portal.
152149
153150
`config.endpoint = "https://<your_Gremlin_account_name>.gremlin.cosmosdb.azure.com:443/";`
154151
155-
![View and copy an access key in the Azure portal, Keys blade](./media/create-graph-nodejs/gremlin-uri.png)
152+
![View and copy an access key in the Azure portal, Overview page](./media/create-graph-nodejs/gremlin-uri.png)
156153
157-
3. In config.js, fill in the config.primaryKey value with the **Primary Key** value from the **Keys** page of the Azure portal.
154+
3. In *config.js*, fill in the config.primaryKey value with the **Primary Key** value from the **Keys** page of your Cosmos DB account in the Azure portal.
158155
159156
`config.primaryKey = "PRIMARYKEY";`
160157
161158
![Azure portal "Keys" blade](./media/create-graph-nodejs/keys.png)
162159
163160
4. Enter the database name, and graph (container) name for the value of config.database and config.collection.
164161
165-
Here's an example of what your completed config.js file should look like:
162+
Here's an example of what your completed *config.js* file should look like:
166163

167164
```javascript
168165
var config = {}
@@ -178,7 +175,7 @@ module.exports = config;
178175

179176
## Run the console app
180177

181-
1. Open a terminal window and change (via `cd` command) to the installation directory for the package.json file that's included in the project.
178+
1. Open a terminal window and change (via `cd` command) to the installation directory for the *package.json* file that's included in the project.
182179

183180
2. Run `npm install` to install the required npm modules, including `gremlin`.
184181

@@ -204,7 +201,7 @@ Try completing `g.V()` with `.has('firstName', 'Thomas')` to test the filter. No
204201
205202
## Next steps
206203
207-
In this article, you learned how to create an Azure Cosmos DB account, create a graph by using Data Explorer, and run an app. You can now build more complex queries and implement powerful graph traversal logic by using Gremlin.
204+
In this article, you learned how to create an Azure Cosmos DB account, create a graph by using Data Explorer, and run a Node.js app to add data to the graph. You can now build more complex queries and implement powerful graph traversal logic by using Gremlin.
208205
209206
> [!div class="nextstepaction"]
210207
> [Query by using Gremlin](tutorial-query-graph.md)

0 commit comments

Comments
 (0)