|
1 | 1 | { |
2 | 2 | "cells": [ |
3 | 3 | { |
4 | | - "attachments": {}, |
5 | 4 | "cell_type": "markdown", |
6 | 5 | "metadata": {}, |
7 | 6 | "source": [ |
8 | 7 | "# Introduction to Knowledge Graphs" |
9 | 8 | ] |
10 | 9 | }, |
11 | 10 | { |
12 | | - "attachments": {}, |
13 | 11 | "cell_type": "markdown", |
14 | 12 | "metadata": {}, |
15 | 13 | "source": [ |
|
23 | 21 | " </ul>\n", |
24 | 22 | " </li>\n", |
25 | 23 | " <li><span><a href=\"#Connect\" data-toc-modified-id=\"Connect-2\">Connect</a></span></li>\n", |
26 | | - " <li><span><a href=\"#Data-Model\" data-toc-modified-id=\"Data-Model-3\">Data Model</a></span></li>\n", |
27 | | - " <li><span><a href=\"#Path-Forward\" data-toc-modified-id=\"Path-Forward-4\">Path Forward</a></span></li>\n", |
| 24 | + " <li><span><a href=\"#Create\" data-toc-modified-id=\"Create-3\">Create</a></span></li>\n", |
| 25 | + " <li><span><a href=\"#Data-Model\" data-toc-modified-id=\"Data-Model-4\">Data Model</a></span></li>\n", |
| 26 | + " <li><span><a href=\"#Path-Forward\" data-toc-modified-id=\"Path-Forward-5\">Path Forward</a></span></li>\n", |
28 | 27 | " </ul>\n", |
29 | 28 | "</div>" |
30 | 29 | ] |
31 | 30 | }, |
32 | 31 | { |
33 | | - "attachments": {}, |
34 | 32 | "cell_type": "markdown", |
35 | 33 | "metadata": {}, |
36 | 34 | "source": [ |
|
42 | 40 | ] |
43 | 41 | }, |
44 | 42 | { |
45 | | - "attachments": {}, |
46 | 43 | "cell_type": "markdown", |
47 | 44 | "metadata": {}, |
48 | 45 | "source": [ |
|
59 | 56 | ] |
60 | 57 | }, |
61 | 58 | { |
62 | | - "attachments": {}, |
63 | 59 | "cell_type": "markdown", |
64 | 60 | "metadata": {}, |
65 | 61 | "source": [ |
|
83 | 79 | ] |
84 | 80 | }, |
85 | 81 | { |
86 | | - "attachments": {}, |
87 | 82 | "cell_type": "markdown", |
88 | 83 | "metadata": {}, |
89 | 84 | "source": [ |
90 | 85 | "A knowledge graph service is composed of two primary resources, the data and data model. The data contains entities and relationships with their associated properties. " |
91 | 86 | ] |
92 | 87 | }, |
93 | 88 | { |
94 | | - "attachments": {}, |
| 89 | + "cell_type": "markdown", |
| 90 | + "metadata": {}, |
| 91 | + "source": [ |
| 92 | + "## Create\n", |
| 93 | + "Using the ArcGIS API for Python, you can create a new Knowledge Graph using [create_service()](https://developers.arcgis.com/python/api-reference/arcgis.gis.toc.html#arcgis.gis.ContentManager.create_service)." |
| 94 | + ] |
| 95 | + }, |
| 96 | + { |
| 97 | + "cell_type": "code", |
| 98 | + "execution_count": null, |
| 99 | + "metadata": {}, |
| 100 | + "outputs": [], |
| 101 | + "source": [ |
| 102 | + "gis = GIS(\"home\")\n", |
| 103 | + "result = gis.content.create_service(\n", |
| 104 | + " name=\"myKnowledgeGraph\",\n", |
| 105 | + " capabilities=\"Query,Editing,Create,Update,Delete\",\n", |
| 106 | + " service_type=\"KnowledgeGraph\",\n", |
| 107 | + ")" |
| 108 | + ] |
| 109 | + }, |
| 110 | + { |
| 111 | + "cell_type": "markdown", |
| 112 | + "metadata": {}, |
| 113 | + "source": [ |
| 114 | + "Services can also be created using create parameters to choose more service options." |
| 115 | + ] |
| 116 | + }, |
| 117 | + { |
| 118 | + "cell_type": "code", |
| 119 | + "execution_count": null, |
| 120 | + "metadata": {}, |
| 121 | + "outputs": [], |
| 122 | + "source": [ |
| 123 | + "result = gis.content.create_service(\n", |
| 124 | + " name=\"\",\n", |
| 125 | + " service_type=\"KnowledgeGraph\",\n", |
| 126 | + " create_params={\n", |
| 127 | + " \"name\": \"myKnowledgeGraph\",\n", |
| 128 | + " \"capabilities\": \"Query\",\n", |
| 129 | + " \"jsonProperties\": {\n", |
| 130 | + " \"supportsProvenance\": False,\n", |
| 131 | + " \"arcgisManagedData\": False,\n", |
| 132 | + " \"dataSourceItemID\": \"f63a6725058c4c05a63480521acffe01\",\n", |
| 133 | + " },\n", |
| 134 | + " },\n", |
| 135 | + ")" |
| 136 | + ] |
| 137 | + }, |
| 138 | + { |
| 139 | + "cell_type": "markdown", |
| 140 | + "metadata": {}, |
| 141 | + "source": [ |
| 142 | + "Finally, the result from create_service can be used to initialize the KnowledgeGraph." |
| 143 | + ] |
| 144 | + }, |
| 145 | + { |
| 146 | + "cell_type": "code", |
| 147 | + "execution_count": null, |
| 148 | + "metadata": {}, |
| 149 | + "outputs": [], |
| 150 | + "source": [ |
| 151 | + "knowledge_graph = KnowledgeGraph(url=result.url, gis=gis)" |
| 152 | + ] |
| 153 | + }, |
| 154 | + { |
95 | 155 | "cell_type": "markdown", |
96 | 156 | "metadata": {}, |
97 | 157 | "source": [ |
|
110 | 170 | ] |
111 | 171 | }, |
112 | 172 | { |
113 | | - "attachments": {}, |
114 | 173 | "cell_type": "markdown", |
115 | 174 | "metadata": {}, |
116 | 175 | "source": [ |
|
248 | 307 | ] |
249 | 308 | }, |
250 | 309 | { |
251 | | - "attachments": {}, |
252 | 310 | "cell_type": "markdown", |
253 | 311 | "metadata": {}, |
254 | 312 | "source": [ |
|
260 | 318 | ], |
261 | 319 | "metadata": { |
262 | 320 | "kernelspec": { |
263 | | - "display_name": "Python 3", |
| 321 | + "display_name": "Python 3 (ipykernel)", |
264 | 322 | "language": "python", |
265 | 323 | "name": "python3" |
266 | 324 | }, |
267 | 325 | "language_info": { |
| 326 | + "codemirror_mode": { |
| 327 | + "name": "ipython", |
| 328 | + "version": 3 |
| 329 | + }, |
| 330 | + "file_extension": ".py", |
| 331 | + "mimetype": "text/x-python", |
268 | 332 | "name": "python", |
269 | | - "version": "3.9.13" |
| 333 | + "nbconvert_exporter": "python", |
| 334 | + "pygments_lexer": "ipython3", |
| 335 | + "version": "3.9.16" |
270 | 336 | }, |
271 | | - "orig_nbformat": 4, |
272 | 337 | "vscode": { |
273 | 338 | "interpreter": { |
274 | 339 | "hash": "d622b5871f1605057390dea3c8b45e995d0d19bef8604acd7f5b2e1066a85139" |
|
0 commit comments