|
90 | 90 | "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 | 91 | ]
|
92 | 92 | },
|
| 93 | + { |
| 94 | + "cell_type": "markdown", |
| 95 | + "metadata": {}, |
| 96 | + "source": [ |
| 97 | + "## Create\n", |
| 98 | + "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)." |
| 99 | + ] |
| 100 | + }, |
| 101 | + { |
| 102 | + "cell_type": "code", |
| 103 | + "execution_count": null, |
| 104 | + "metadata": {}, |
| 105 | + "outputs": [], |
| 106 | + "source": [ |
| 107 | + "gis = GIS(\"home\")\n", |
| 108 | + "result = gis.content.create_service(\n", |
| 109 | + " name=\"myKnowledgeGraph\",\n", |
| 110 | + " capabilities=\"Query,Editing,Create,Update,Delete\",\n", |
| 111 | + " service_type=\"KnowledgeGraph\",\n", |
| 112 | + ")" |
| 113 | + ] |
| 114 | + }, |
| 115 | + { |
| 116 | + "cell_type": "markdown", |
| 117 | + "metadata": {}, |
| 118 | + "source": [ |
| 119 | + "Services can also be created using create parameters to choose more service options." |
| 120 | + ] |
| 121 | + }, |
| 122 | + { |
| 123 | + "cell_type": "code", |
| 124 | + "execution_count": null, |
| 125 | + "metadata": {}, |
| 126 | + "outputs": [], |
| 127 | + "source": [ |
| 128 | + "result = gis.content.create_service(\n", |
| 129 | + " name=\"\", \n", |
| 130 | + " service_type=\"KnowledgeGraph\",\n", |
| 131 | + " create_params={\n", |
| 132 | + " \"name\": \"myKnowledgeGraph\",\n", |
| 133 | + " \"capabilities\": \"Query\", \n", |
| 134 | + " \"jsonProperties\": {\n", |
| 135 | + " \"supportsProvenance\": False,\n", |
| 136 | + " \"arcgisManagedData\": False,\n", |
| 137 | + " \"dataSourceItemID\": \"f63a6725058c4c05a63480521acffe01\"\n", |
| 138 | + " }\n", |
| 139 | + " }\n", |
| 140 | + ")" |
| 141 | + ] |
| 142 | + }, |
| 143 | + { |
| 144 | + "cell_type": "markdown", |
| 145 | + "metadata": {}, |
| 146 | + "source": [ |
| 147 | + "Finally, the result from create_service can be used to initialize the KnowledgeGraph." |
| 148 | + ] |
| 149 | + }, |
| 150 | + { |
| 151 | + "cell_type": "code", |
| 152 | + "execution_count": null, |
| 153 | + "metadata": {}, |
| 154 | + "outputs": [], |
| 155 | + "source": [ |
| 156 | + "knowledge_graph = KnowledgeGraph(url=result.url, gis=gis)" |
| 157 | + ] |
| 158 | + }, |
93 | 159 | {
|
94 | 160 | "attachments": {},
|
95 | 161 | "cell_type": "markdown",
|
|
0 commit comments