require(["esri/rest/knowledgeGraph/GraphApplyEditsResult"], (GraphApplyEditsResult) => { /* code goes here */ });
import GraphApplyEditsResult from "@arcgis/core/rest/knowledgeGraph/GraphApplyEditsResult.js";
esri/rest/knowledgeGraph/GraphApplyEditsResult
The result of an executeApplyEdits() performed on a knowledge graph service's graph resource. Summarizes the edits to the graph and provides any errors encountered in performing the edits.
- See also
// sample executeApplyEdits() to add a new entity
const newEntity = new Entity({
typeName: "Supplier",
properties: {
Name: "Supplier 5",
EmployeeCount: 681
}
})
KnowledgeGraphModule.executeApplyEdits(graph, {
entityAdds: [newEntity],
})
.then((editResult) => {
console.log("Graph Add Result", editResult);
});
// Results of adding one entity to the `Supplier` entity type
{
editResults:[{
adds:[
{
id: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
error: {errorCode: 0, errorMessage: ""}
}],
deletes:[],
typeName: "Supplier",
updates:[]
}],
hasError: false,
error: undefined
}
// example results of a complex executeApplyEdits that involved
// adding, updating and deleting multiple types.
{
editResults:[{
adds:[
{
id: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
error: {errorCode: 0, errorMessage: ""}
}],
deletes:[],
typeName: "Supplier",
updates:[]
},{
adds:[{
id: "{ANWIFHSAS-AW6F-G9W4-8412-A1A8W4F1A5S6F}",
error: {errorCode: 0, errorMessage: ""}
}],
deletes:[{
id: "{AN4E4G85-Q15F4-49A4-8412-A1W8F4S6A5S4}",
error: {errorCode: 0, errorMessage: ""}
},{
id: "{AF15W4F8S-A1W5-A1W8F-G1E8-AF1W5F4S8F4W}",
error: {errorCode: 0, errorMessage: ""}
}],
typeName: "Part",
updates:[{
id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}",
error: {errorCode: 0, errorMessage: ""}
}]
}],
hasError: false,
error: undefined
}
// example of an error message due to misspelled entity type
{
editResults:[],
hasError: true,
error: {
errorCode: 112020,
errorMessage: "The Entity/Relationship type definition, Suppplier, was not found."
}
}
Constructors
-
- Property
-
properties Object
See the properties for a full list of the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The name of the class. | Accessor | ||
Returns a list of objects for each entity type or relationship type that added, updated or deleted records by executeApplyEdits(). | GraphApplyEditsResult | ||
The error message explaining information about why executeApplyEdits() failed. | GraphApplyEditsResult | ||
If | GraphApplyEditsResult |
Property Details
-
editResults
editResults editResultsObject[]
-
Returns a list of objects for each entity type or relationship type that added, updated or deleted records by executeApplyEdits().
If hasError is
true
,editResults
will be empty.ExampleeditResults:[{ adds:[ { id: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}", error: {errorCode: 0, errorMessage: ""} }], deletes:[], typeName: "Supplier", updates:[] },{ adds:[{ id: "{ANWIFHSAS-AW6F-G9W4-8412-A1A8W4F1A5S6F}", error: {errorCode: 0, errorMessage: ""} }], deletes:[{ id: "{AN4E4G85-Q15F4-49A4-8412-A1W8F4S6A5S4}", error: {errorCode: 0, errorMessage: ""} },{ id: "{AF15W4F8S-A1W5-A1W8F-G1E8-AF1W5F4S8F4W}", error: {errorCode: 0, errorMessage: ""} }], typeName: "Part", updates:[{ id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}", error: {errorCode: 0, errorMessage: ""} }] }],
-
error
error Object
-
The error message explaining information about why executeApplyEdits() failed. Will only be defined if hasError is
true
.- Properties
-
errorCode int
Error code returned from the server.
errorMessage StringDescription of the error.
Example// example of an error message due to misspelled entity type { editResults:[], hasError: false, error: { errorCode: 112020, errorMessage: "The Entity/Relationship type definition, Suppplier, was not found." } }
-
hasError
hasError Object
-
If
true
there was an error processing executeApplyEdits(). The error message is captured in the error property.- Default Value:false
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
Inherited from Accessor
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
Type Definitions
-
NamedObjectEditResults
NamedObjectEditResults Object
-
NamedObjectEditResults contains the
id
of the GraphNamedObject (Entity or Relationship) that was added, updated or deleted from the KnowledgeGraph as well as any errors that occurred during the operation.- Properties
-
id String
The id of the Entity or Relationship that was added, updated or deleted from the knowledge graph.
optional Indicates any errors caused during the operation applied to this object.
- Specification
-
errorCode int
Error code returned from the server.
errorMessage StringDescription of the error.
Example// typical structure { id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}", //id of entity or relationship added, updated or deleted error: {errorCode: 0, errorMessage: ""} }
-
editResultsObject
editResultsObject Object
-
editResultsObject returns a list of all entities and relationships of each type that was added, updated or deleted from the KnowledgeGraph as well as any errors that occurred during the operation.
- Properties
-
typeName String
The name of the EntityType or RelationshipType that had changed items.
A list of objects containing the id and error information for every added entity or relationship.
updates NamedObjectEditResults[]A list of objects containing the id and error information for every updated entity or relationship.
deletes NamedObjectEditResults[]A list of objects containing the id and error information for every deleted entity or relationship.
Example{ adds:[{ id: "{ANWIFHSAS-AW6F-G9W4-8412-A1A8W4F1A5S6F}", error: {errorCode: 0, errorMessage: ""} }], deletes:[{ id: "{AN4E4G85-Q15F4-49A4-8412-A1W8F4S6A5S4}", error: {errorCode: 0, errorMessage: ""} },{ id: "{AF15W4F8S-A1W5-A1W8F-G1E8-AF1W5F4S8F4W}", error: {errorCode: 0, errorMessage: ""} }], typeName: "Part", updates:[{ id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}", error: {errorCode: 0, errorMessage: ""} }] }