Edit Knowledge Graph Data

Note: Sign in to access the data in this sample. username: editor01 password: S7#i2LWmYH75

Getting Started

A knowledge graph allows you work with a graph network. This network connects people, places, and things (represented by entities) with each other through relationships that define how they are associated. Both entities and relationships can have associated properties.
An entity with a spatial location can be connected with other entities that do not have a spatial location.

There are three different types of edits that can be applied to a knowledge graph:

This example shows each edit to the knowledge graph independently, however, multiple edits can be executed in a single executeApplyEdits() call.

The sample dataset contains observations of bumble bees made at locations around the United States. Each observation was made and verified by users and is of a specific species of bumble bee.

sample-data-model

For additional information on working with knowledge graph services see:

Jump to the code

How to use this sample

1. Sign in

The data in this example is secured, as most knowledge graph data will be since the ArcGIS Knowledge Graph Server license is required. Therefore, the first step is to sign in to load the data.

2. Edit Data

There is a separate section for each edit type and they can be applied in any order.

  1. Add Entity:

    Start by adding a new Observation to the graph by providing the name (e.g. "Yellow faced bumble bee").

  2. Add Relationship:

    Add a new Observed relationship between a user and the observation.

  3. Update Entity

    Update the name property of an existing Observation.

  4. Delete Entity

    Delete an Observation from the graph. This also deletes any associated relationships if cascadeDelete is true.

How it works

Add

To specify new records to add to the graph, first define any new entities and relationships and their properties. These properties must match the properties of the entity type or relationship type that the record is being added to. This example adds to the Observation entity type, which has the name property.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
      const newEntity = new Entity({
        typeName: "Observation",
        properties: {
          species_guess: speciesGuess,
        },
      });

      knowledgeGraphService.executeApplyEdits(knowledgeGraph, {
        entityAdds: [newEntity],
      }).then((results) => {

When adding a relationship, the origin and destination entities must already exist in the graph. This example adds an Observed relationship between a User and an Observation. This relationship type has no additional properties.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
      //create the relationship
      const newRelationship = new Relationship({
        typeName: "Observed",
        originId: originId,
        destinationId: destinationId,
        properties: {},
      });
      //apply the edit to the graph
      knowledgeGraphService.executeApplyEdits(knowledgeGraph, {
        relationshipAdds: [newRelationship],
      }).then((results) => {

The properties you specify for new entities and relationships must already exist on the entity type or relationship type. To add or delete properties from a named type see editing a knowledge graph data model.

Update

The values of properties on existing entities and relationships can also be updated using executeApplyEdits. In this sample you can update the value for the 'species_guess' property on existing "Observation" entities. The property must already exist on the entity type or relationship type. To add or delete properties from a named type see editing a knowledge graph data model.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
      const entityUpdate = new Entity({
        typeName: "Observation",
        id: id,
        properties: {
          species_guess: updatedSpecies
        },
      });

      knowledgeGraphService.executeApplyEdits(knowledgeGraph, {
        entityUpdates: [entityUpdate],
      }).then((editResult) => {

Delete

Specify records to delete by providing the entity type or relationship type and a list of unique identifiers for records of that type to be deleted. Note that by default, when deleting an entity you must also specify all connected relationships for deletion as well. If you want these relationships to be deleted automatically, set cascadeDelete to true. If cascadeDelete is false and the entity has connected relationships that are not in the edit, executeApplyEdits will fail.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
      knowledgeGraphService.executeApplyEdits(knowledgeGraph, {
        entityDeletes: [
          {
            typeName: "Observation",
            ids: [id],
          },
        ],
        options: {
          cascadeDelete: true,
        },
      }).then((editResult) => {

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.

close