Skip to content
import GraphApplyEditsResult from "@arcgis/core/rest/knowledgeGraph/GraphApplyEditsResult.js";
Inheritance:
GraphApplyEditsResultAccessor
Since
ArcGIS Maps SDK for JavaScript 4.25

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
Examples
// 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

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

cascadeProvenanceDeleteResults

Property
Type
Array<CascadeProvenanceDeleteResults>

Returns a list of the Provenance entities that were deleted as a result of the executeApplyEdits() call with the cascadeProvenanceDeletes option enabled.

If hasError is true, cascadeProvenanceDeletes will be empty.

Example
cascadeProvenanceDeleteResults:[{
id: "{FB74F4DD-CBD7-4C94-BA89-0C044ECCC273}",
error: {errorCode: 0, errorMessage: ""}
}]

cascadeRelationshipDeleteResults

Property
Type
Array<CascadeRelationshipDeleteResults>

Returns a list of objects for each relationship type that was deleted by as a result of deleting its origin or destination entity during an executeApplyEdits() call with the cascadeDeletes option enabled.

If hasError is true, cascadeRelationshipDeletes will be empty.

Example
cascadeRelationshipDeleteResults:[{
typeName: "supplies",
cascadeRelationshipDeletes: [
{
id: "{FB74F4DD-CBD7-4C94-BA89-0C044ECCC273}",
error: {errorCode: 0, errorMessage: ""}
originId: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
destinationId: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}"
}
]
}]

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

The name of the class. The declared class name is formatted as esri.folder.className.

editResults

Property
Type
Array<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.

Example
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: ""}
}]
}],

error

Property
Type
EsriError | null | undefined

The error message explaining information about why executeApplyEdits() failed. Will only be defined if hasError is true.

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

Property
Type
boolean

If true there was an error processing executeApplyEdits(). The error message is captured in the error property.

Default value
false

Type definitions

EditResultsObject

Type definition

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.

typeName

Property
Type
string

The name of the EntityType or RelationshipType that had changed items.

adds

Property
Type
Array<NamedObjectEditResults>

A list of objects containing the id and error information for every added entity or relationship.

updates

Property
Type
Array<NamedObjectEditResults>

A list of objects containing the id and error information for every updated entity or relationship.

deletes

Property
Type
Array<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: ""}
}]
}

NamedObjectEditResults

Type definition

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.

id

Property
Type
string

The id of the Entity or Relationship that was added, updated or deleted from the knowledge graph.

error

Property
Type
EsriError | undefined

Indicates any errors caused during the operation applied to this object.

Example
// typical structure
{
id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}", //id of entity or relationship added, updated or deleted
error: {errorCode: 0, errorMessage: ""}
}

CascadeRelationshipDeleteResults

Type definition

cascadeRelationshipDeletesResults returns a list of all relationships of each type that were deleted from the KnowledgeGraph due to one of their endpoints being deleted, as well as any errors that occurred during the operation.

typeName

Property
Type
string

The name of the RelationshipType that had deleted relationships.

cascadeRelationshipDeletes

Property
Type
Array<NamedObjectCascadeRelationshipDeleteResults>

A list of objects containing the id, origin id, destination id and error information for every deleted relationship.

Example
{
typeName: "supplies",
cascadeRelationshipDeletes: [
{
id: "{FB74F4DD-CBD7-4C94-BA89-0C044ECCC273}",
error: {errorCode: 0, errorMessage: ""}
originId: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
destinationId: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}"
}
]
}

NamedObjectCascadeRelationshipDeleteResults

Type definition

NamedObjectCascadeRelationshipDeleteResults contains the id of the Relationship that was deleted from the KnowledgeGraph along with its origin id, destination id and error information.

originId

Property
Type
string

The id of the origin entity of the deleted relationship.

destinationId

Property
Type
string

The id of the destination entity of the deleted relationship.

Example
// typical structure
{
id: "{FB74F4DD-CBD7-4C94-BA89-0C044ECCC273}",
error: {errorCode: 0, errorMessage: ""}
originId: "{AN4E4G85-41F1-49A4-8412-CACCC9906E88}",
destinationId: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}"
}

CascadeProvenanceDeleteResults

Type definition

CascadeProvenanceDeleteResults contains the id of the Provenance GraphNamedObject that was deleted from the KnowledgeGraph as well as any errors that occurred during the operation, when edits were applied with cascadeProvenanceDelete set to true.

id

Property
Type
string

The id of the Provenance Entity deleted from the knowledge graph.

error

Property
Type
EsriError | undefined

Indicates any errors caused during the operation applied to this object.

Example
// typical structure
{
id: "{2WS8F4SA-41F1-S1E8-8412-F2G5S4D8GE1S}", //id of Provenance entity deleted
error: {errorCode: 0, errorMessage: ""}
}