The arcgis.graph module contains classes and functions for working with ArcGIS Knowledge graphs. The available functions allow for searching and querying the graph data, and viewing the data model of the graph database.

Knowledge graphs consist of entities and the relationships between them, each of which can contain properties which describe their attributes. The data model of the knowledge graph can show you which entities, relationships, and properties are in your database, along with other information about the graph. Performing a search or openCypher query on the graph will return results from the database based on the search or query terms provided.

Note

Applications based on ArcGIS API for Python version 2.0.1 can only communicate with knowledge graphs in an ArcGIS Enterprise 10.9.1 or 11.0 deployment. ArcGIS Enterprise 11.1 includes breaking changes for knowledge graphs. Only applications based on ArcGIS API for Python version 2.1.0 or later will be able to communicate with knowledge graphs in an Enterprise 11.1 deployment. See the ArcGIS Enterprise Knowledge Server documentation for more details.

KnowledgeGraph

class arcgis.graph.KnowledgeGraph(url: str, *, gis=None)

Provides access to the Knowledge Graph service data model and properties, as well as methods to search and query the graph.

Parameter

Description

url

Knowledge Graph service URL

gis

an authenticated GIS object.

# Connect to a Knowledge Graph service:

gis = GIS(url="url",username="username",password="password")

knowledge_graph = KnowledgeGraph(url, gis=gis)
add_domain(domain: CodedValueDomain | RangeDomain) AddDomainResponse

Adds a domain to the knowledge graph data model.

Parameter

Description

domain

Required GraphDomain. The domain to be added to the data model.

from arcgis.graph import GraphDomain

graph.add_domain(
    CodedValueDomain(
        name="example_domain",
        coded_values=[CodedValue(name="Active", code="yes"), CodedValue(name="Inactive", code="no")],
        field_type="esriFieldTypeString",
        merge_policy_type="esriMergePolicyTypeDefaultValue",
        split_policy_type="esriSplitPolicyTypeDefaultValue",
    )
)
apply_edits(adds: Sequence[dict[str, Any] | Entity | Relationship] = [], updates: Sequence[dict[str, Any] | Entity | Relationship] = [], deletes: Sequence[dict[str, Any] | EntityDelete | RelationshipDelete] = [], input_transform: dict[str, Any] | Transform | None = None, cascade_delete: bool = False, cascade_delete_provenance: bool = False, as_dict: bool = True) dict | ApplyEditsResponse

Allows users to add, update, and delete Entity and Relationship.

Note

objectid values are not supported in dictionaries for apply_edits

Parameter

Description

adds

Optional list of Entity or Relationship. The list of objects to add to the graph, represented in dictionary format.

updates

Optional list of Entity or Relationship. The list of existent graph objects that are to be updated, represented in dictionary format.

deletes

Optional list of EntityDelete or RelationshipDelete. The list of existent objects to remove from the graph, represented in dictionary format.

input_transform

Optional Transform. Allows a user to specify custom quantization parameters for input geometry, which dictate how geometries are compressed and transferred to the server. Defaults to lossless WGS84 quantization.

cascade_delete

Optional boolean. When True, relationships connected to entities that are being deleted will automatically be deleted as well. When False, these relationships must be deleted manually first. Defaults to False.

cascade_delete_provenance

Optional boolean. When True, deleting entities/relationships or setting their property values to null will result in automatic deletion of associated provenance records. When False, apply_edits() will fail if there are provenance records connected to entities/relationships intended for deletion or having their properties set to null.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import Entity, Relationship

add_entity = Entity(type_name="Company", properties={"name": "Esri"})
delete_relationship = DeleteRelationship(type_name="WorksAt", ids=[UUID("783bd422-3hfp-45c7-87aa-8adbbdac0a3d")])

graph.apply_edits(adds=[add_entity], deletes=[delete_relationship], as_dict=False)
Returns:

ApplyEditsResponse

constraint_rule_adds(rules: Sequence[dict[str, Any] | ConstraintRule], as_dict: bool = True) dict | ConstraintRuleAddsResponse

Adds constraint rules for entities & relationships to the data model. RelationshipExclusionRule is a constraint rule.

Parameter

Description

rules

Required Sequence of RelationshipExclusionRule. Defines the constraint rules to be added.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import RelationshipExclusionRule

graph.constraint_rule_adds(
    rules=[
        RelationshipExclusionRule(
            name="OnlyPersonCanWorkAtCompany",
            origin_entity_types=SetOfNamedTypes(set_complement=["Person"]),
            relationship_types=SetOfNamedTypes(set=["WorksAt"]),
            destination_entity_types=SetOfNamedTypes(set=["Company"])
        )
    ],
    as_dict=False
)
Returns:

ConstraintRuleAddsResponse

constraint_rule_deletes(rule_names: Sequence[str], as_dict: bool = True) dict | ConstraintRuleDeletesResponse

Deletes existing constraint rules for entities & relationships from the data model. RelationshipExclusionRule is a constraint rule.

Parameter

Description

rule_names

Required Sequence of strings. The names of the constraint rules to be deleted, as defined in a rule’s ‘name’ attribute.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Delete a constraint rule from the Knowledge Graph's data model.
graph.constraint_rule_deletes(["constraint_rule_1"], as_dict=False)
Returns:

ConstraintRuleDeletesResponse

constraint_rule_updates(rules: Sequence[dict[str, Any] | ConstraintRuleUpdate], as_dict: bool = True) dict | ConstraintRuleUpdatesResponse

Update ConstraintRule for entities & relationships in the data model. RelationshipExclusionRule is a type of constraint rule.

Parameter

Description

rules

Required Sequence of RelationshipExclusionRuleUpdate. Defines the constraint rules to be updated.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import RelationshipExclusionRuleUpdate, ConstraintRule, ConstraintRuleMask, UpdateSetOfNamedTypes

graph.constraint_rule_updates(
    rules=[
        RelationshipExclusionRuleUpdate(
            rule_name="OnlyPersonCanWorkForCompany",
            mask=ConstraintRuleMask(update_name=True, update_alias=True),
            constraint_rule=ConstraintRule(
                name="PersonCanWorkForCompanyOrPark",
                alias="Person Can Work For Company or Park"
            )
        )
    ],
    as_dict=False
)
Returns:

ConstraintRuleUpdatesResponse

create_replica(replica_params: ReplicaRequest) CreateReplicaResponse

Creates a replica of the knowledge graph service.

Parameter

Description

replica_params

Required ReplicaRequest. The parameters for creating the replica.

from arcgis.graph import ReplicaRequest, ReplicaFilters, StaticDefinition, EntityTypeReplicaDefinition, RelationshipTypeReplicaDefinition

replica_request = ReplicaRequest(
    replica_name="my_replica",
    replica_definition=ReplicaFilters(
        static_definition=StaticDefinition(
            entity_type_replica_definitions=[
                EntityTypeReplicaDefinition(
                    type_name="Person",
                    open_cypher_where_clause="WHERE age > 18"
                )
            ],
            relationship_type_replica_definitions=[
                RelationshipTypeReplicaDefinition(
                    type_name="WorksAt",
                    open_cypher_where_clause="WHERE startDate > '2020-01-01'"
                )
            ]
        )
    ),
    asynchronous=False,
)

replica_response = kg.create_replica(replica_request)
replica_data = replica_response.replica_data
Returns:

CreateReplicaResponse

property datamodel: dict

Returns the datamodel for the Knowledge Graph service

Returns:

dict

delete_domain(domain_name: str) DeleteDomainResponse

Deletes an existing domain from the knowledge graph data model.

Parameter

Description

domain_name

Required string. The name of the domain to be deleted.

# Delete a domain from the Knowledge Graph's data model.
graph.delete_domain("StatusDomain")
export(timeout: int = 600) ExportResponse

Exports the knowledge graph service definition in GeoParquet format.

Parameter

Description

timeout

Optional integer. The maximum time, in seconds, to wait for the export operation to complete. The default is 600 seconds.

Returns:

ExportResponse

# Export the knowledge graph service definition
export_response = graph.export(timeout=300)
classmethod fromitem(item)

Returns the Knowledge Graph service from an Item

get_replica_definition(replica_id: UUID | str) ReplicaDefinitionResponse

Retrieves the definition of a replica.

Parameter

Description

replica_id

Required UUID or string. The ID of the replica to retrieve.

Returns:

ReplicaDefinitionResponse

graph_property_adds(type_name: str, graph_properties: Sequence[dict[str, Any] | GraphProperty], as_dict: bool = True) dict | PropertyAddsResponse

Adds set of GraphProperty to a named type in the data model

Learn more about adding properties in a knowledge graph

Parameter

Description

type_name

Required string. The entity or relationship type to which the properties will be added.

graph_properties

Required Sequence of GraphProperty. The Sequence of properties to add to the named type.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import GraphProperty

graph.graph_property_adds(type_name="Vehicle", graph_properties=[GraphProperty(name="year")])
Returns:

PropertyAddsResponse

graph_property_delete(type_name: str, property_name: str, as_dict: bool = True) dict | PropertyDeleteResponse

Delete a GraphProperty for a named type in the data model

Learn more about deleting properties in a knowledge graph

Parameter

Description

type_name

Required string. The entity or relationship type containing the property to be deleted.

property_name

Required string. The property to be deleted.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Delete a named type's property in the data model
delete_result = knowledge_graph.graph_property_delete("Person", "Address", as_dict=False)
Returns:

PropertyDeleteResponse

graph_property_index_adds(type_name: str, field_indexes: Sequence[dict[str, Any] | FieldIndex], as_dict: bool = True) dict | IndexAddsResponse

Adds one or more FieldIndex to a field or multiple fields associated with a named type in the data model.

Learn more about adding graph property indexes in a knowledge graph

Parameter

Description

type_name

Required string. The entity or relationship type to add the indexes to.

field_indexes

Required list of dicts. The indexes to add for the type. See below for an example of the structure.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import FieldIndex

graph.graph_property_index_adds(
    type_name="Person",
    field_indexes=[FieldIndex(name="name_index", is_ascending=True, is_unique=False, fields=["name"])],
    as_dict=False
)
Returns:

IndexAddsResponse

graph_property_index_deletes(type_name: str, field_indexes: Sequence[str], as_dict: bool = True) dict | IndexDeletesResponse

Deletes one or more FieldIndex from fields associated with a named type in the data model.

Learn more about deleting graph property indexes from a knowledge graph

Parameter

Description

type_name

Required string. The entity or relationship type to delete the field indexes from.

field_indexes

Required Sequence of strings. The field indexes to delete from the type.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Delete field indexes from a Knowledge Graph type
delete_result = graph.graph_property_index_deletes("Project", ["title"], as_dict=False)
Returns:

IndexDeletesResponse

graph_property_update(type_name: str, property_name: str, graph_property: dict[str, Any] | GraphProperty, mask: dict[str, Any] | GraphPropertyMask, as_dict: bool = True) dict | PropertyUpdateResponse

Updates a GraphProperty for a named type in the data model

Learn more about updating properties in a knowledge graph

Parameter

Description

type_name

Required string. The entity or relationship type containing the property to be updated.

property_name

Required string. The property to be updated.

graph_property

Required GraphProperty. The graph property to be updated.

mask

Required GraphPropertyMask. The properties of the field to be updated.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import GraphProperty, GraphPropertyMask

graph.graph_property_update(
    type_name="Vehicle",
    property_name="year",
    graph_property=GraphProperty(name="year", alias="year_made"),
    mask=GraphPropertyMask(update_alias=True),
    as_dict=False
)
Returns:

PropertyUpdateResponse

named_object_type_adds(entity_types: Sequence[dict[str, Any] | EntityType] = [], relationship_types: Sequence[dict[str, Any] | RelationshipType] = [], as_dict: bool = True) dict | NamedObjectTypeAddsResponse

Adds EntityType and RelationshipType to the data model

Learn more about adding named types to a knowledge graph

Parameter

Description

entity_types

Optional list of EntityTypes. The list of entity types to add to the data model, represented in dictionary format.

relationship_types

Optional list of RelationshipTypes. The list of relationship types to add to the data model, represented in dictionary format.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import EntityType, RelationshipType, GraphProperty

entity_type_add = EntityType(name="Vehicle", properties={"make": GraphProperty(name="make")})
relationship_type_add = RelationshipType(name="Drives")

graph.named_object_type_adds(entity_types=[entity_type_add], relationship_types=[relationship_type_add], as_dict=False)
Returns:

NamedObjectTypeAddsResponse

named_object_type_delete(type_name: str, as_dict: bool = True) dict | NamedObjectTypeDeleteResponse

Deletes an EntityType or RelationshipType in the data model

Learn more about deleting named types in a knowledge graph

Parameter

Description

type_name

Required string. The named type to be deleted.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Delete a named type in the data model
delete_result = graph.named_object_type_delete("Person")
Returns:

NamedObjectTypeDeleteResponse

named_object_type_update(type_name: str, named_type_update: dict[str, Any] | EntityType | RelationshipType, mask: dict[str, Any] | NamedObjectTypeMask, as_dict: bool = True) dict | NamedObjectTypeUpdateResponse

Updates an EntityType or RelationshipType in the data model

Learn more about updating named types in a knowledge graph

Parameter

Description

type_name

Required string. The named type to be updated.

named_type_update

Required Union[EntityType, RelationshipType]. The entity or relationship type to be updated.

mask

Required NamedObjectTypeMask. The properties of the named type to be updated.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import EntityType, NamedObjectTypeMask

type_update = EntityType(name="Vehicle", alias="Car")

graph.named_object_type_update(
    type_name="Vehicle",
    named_type_update=type_update,
    mask=NamedObjectTypeMask(update_alias=True),
    as_dict=False
)
Returns:

NamedObjectTypeUpdateResponse

property properties: InsensitiveDict

Returns the properties of the Knowledge Graph service

query(query: str) List[dict]

Deprecated since version 2.4.1: Removed in: 3.0.0. Use query_streaming instead.

Deprecated since version 2.4.1: Removed in: 3.0.0. Use query_streaming instead.

Queries the Knowledge Graph using openCypher

Learn more about querying a `knowledge graph

Parameter

Description

query

Required String. Allows you to return the entities and relationships in a graph, as well as the properties of those entities and relationships, by providing an openCypher query.

Returns:

List[list]

# Perform an openCypher query on the knowledge graph
query_result = knowledge_graph.query("MATCH path = (n)-[r]-(n2) RETURN path LIMIT 5")
query_data_model(as_dict: bool = True) dict | GraphDataModel

Returns the datamodel for the Knowledge Graph service

Parameter

Description

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Query knowledge graph data model
knowledge_graph.query_data_model(as_dict=False)
Returns:

GraphDataModel

query_streaming(query: str, input_transform: dict[str, Any] | Transform | None = None, bind_param: dict[str, Any] = {}, include_provenance: bool = False, as_dict: bool = True, as_df: bool = False) Generator[Sequence[Any], None, None] | DataFrame

Query the graph using an openCypher query. Allows for more customization than the base query() function. Creates a generator of the query results, from which users can access each row or add them to a list. See below for example usage.

Parameter

Description

query

Required String. Allows you to return the entities and relationships in a graph, as well as the properties of those entities and relationships, by providing an openCypher query.

input_transform

Optional dict or Transform. Allows a user to specify custom quantization parameters for input geometry, which dictate how geometries are compressed and transferred to the server. Defaults to lossless WGS84 quantization.

bind_param

Optional dict. The bind parameters used to filter query results. Key of each pair is the string name for it, which is how the parameter can be referenced in the query. The value can be any “primitive” type value that may be found as an attribute of an entity or relationship (e.g., string, double, boolean, etc.), a list, an anonymous object (a dict), or a geometry.

Anonymous objects and geometries can be passed in as either their normal Python forms, or following the format found in Knowledge Graph entries (containing an “_objectType” key, and “_properties” for anonymous objects).

Note: Including bind parameters not used in the query will cause queries to yield nothing on ArangoDB based services, while Neo4j based services will still produce results.

include_provenance

Optional boolean. When True, provenance entities (metadata) will be included in the query results. Defaults to False.

as_df

Optional boolean. When True, returns all results in a pandas DataFrame instead of a generator. Defaults to False.

# Get a list of all query results
query_gen = knowledge_graph.query_streaming("MATCH path = (n)-[r]-(n2) RETURN path LIMIT 5")
results = list(gen)

# Grab one result at a time
query_gen = knowledge_graph.query_streaming("MATCH path = (n)-[r]-(n2) RETURN path LIMIT 5")
first_result = next(query_gen)
second_result = next(query_gen)
Returns:

A Generator[Sequence[Any], None, None] or pandas DataFrame when as_df is True.

property replicas: list[ReplicaInfoResponse]

Retrieves a list of ReplicaInfoResponse corresponding to each existent replica of the knowledge graph service.

search(search: str, category: str = 'both', as_dict: bool = True) List[Sequence[Any]]

Allows for the searching of the properties of entities, relationships, or both in the graph using a full-text index.

Learn more about searching a knowledge graph

Parameter

Description

search

Required String. The search to perform on the Knowledge Graph.

category

Optional String. The category is the location of the full text search. This can be isolated to either the entities or the relationships. The default is to look in both.

The allowed values are: both, entities, relationships, both_entity_relationship, and meta_entity_provenance. Both and both_entity_relationship are functionally the same.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

Note

Check the service definition for the Knowledge Graph service for valid values of category. Not all services support both and both_entity_relationship.

#Perform a search on the knowledge graph
for search_result in knowledge_graph.search("cat", as_dict=False):
    print(search_result)

# Perform a search on only entities in the knowledge graph
for searchentities_result in knowledge_graph.search("cat", "entities", as_dict=False):
print(searchentities_result)
Returns:

Generator[Sequence[Any], None, None]

sync_data_model(as_dict: bool = True) dict | SyncDataModelResponse

Synchronizes the Knowledge Graph Service’s data model with any changes made in the database. Will return any errors or warnings from the sync.

Parameter

Description

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

# Synchronize the data model
sync_result = knowledge_graph.sync_data_model(as_dict=False)
Returns:

SyncDataModelResponse

synchronize_replica(sync_params: SynchronizeReplicaRequest) SynchronizeReplicaResponse

Synchronizes a replica with the knowledge graph service.

Parameter

Description

sync_params

Required SynchronizeReplicaRequest. The parameters for synchronizing the replica.

from arcgis.graph.replica_sync_types import SynchronizeReplicaRequest, ReplicaSnapshot, SyncDownloadParameters

sync_request = SynchronizeReplicaRequest(
    replica_id="123e4567-e89b-12d3-a456-426614174000",
    download_parameters=SyncDownloadParameters(
        replica_snapshot=ReplicaSnapshot()
    )
)

sync_response = kg.synchronize_replica(sync_request)
sync_data = sync_response.sync_data
Returns:

SynchronizeReplicaResponse

unregister_replicas(replica_ids: Sequence[UUID | str]) list[UnregisterReplicaResponse]

Unregisters one or more replicas of the knowledge graph service.

Parameter

Description

replica_ids

Required Sequence of UUIDs or strings. The IDs of the replicas to be unregistered.

replica_id_1 = "123e4567-e89b-12d3-a456-426614174000"
replica_id_2 = "123e4567-e89b-12d3-a456-426614174001"
unreg_response = kg.unregister_replicas([replica_id_1, replica_id_2])
Returns:

List of UnregisterReplicaResponse

update_domain(domain_update: GraphDomainUpdate) UpdateDomainResponse

Updates an existing domain in the knowledge graph data model.

Parameter

Description

domain_update

Required GraphDomainUpdate. Contains the name of the domain, updated domain, and mask dictating which properties get updated.

from arcgis.graph import GraphDomain

graph.update_domain(
    name="StatusDomain",
    domain_update=GraphDomainUpdate(
        name = "StatusDomain",
        domain=GraphDomain(
            name="StatusDomain",
            domain_type="range",
            range_domain=RangeDomain(
                range=[0, 1]
            ),
            field_type="esriFieldTypeInteger",
            merge_policy_type="esriMergePolicyTypeDefaultValue",
            split_policy_type="esriSplitPolicyTypeDefaultValue",
        )
        mask = GraphDomainMask(
            update_type=True,
            update_domain=True,
            update_field_type=True
        )
    )
)
update_search_index(adds: dict[str, dict | SearchIndexProperties] = {}, deletes: dict[str, dict | SearchIndexProperties] = {}, as_dict: bool = True) dict | UpdateSearchIndexResponse

Allows users to add or delete SearchIndexProperties for different EntityType and RelationshipType from the GraphDataModel. Can only be existent properties for a given entity/relationship type.

Parameter

Description

adds

Optional dict. See below for structure. The properties to add to the search index, specified by entity/relationship.

deletes

Optional dict. See below for structure. The properties to delete from the search index, specified by entity/relationship.

as_dict

Optional Boolean. Determines whether the result is returned as a dictionary or an object. The default is True. False is recommended.

from arcgis.graph import SearchIndexProperties

graph.update_search_index(
    adds={"Person": SearchIndexProperties(property_names=["name"])},
    as_dict=False
)
Returns:

UpdateSearchIndexResponse

Data Model Types

ConstraintRule

pydantic model arcgis.graph.data_model_types.ConstraintRule

Represents an constraint rule to define how data can be created in the knowledge graph.

from arcgis.graph import ConstraintRule

# Example 1: Update a constraint rule
person_company_constraint = ConstraintRule(name="PersonCanWorkForCompanyOrPark", alias="Person Can Work For Company or Park")
graph.constraint_rule_updates(
    rules=[
        RelationshipExclusionRuleUpdate(
            rule_name="OnlyPersonCanWorkForCompany",
            mask=ConstraintRuleMask(update_name=True, update_alias=True),
            constraint_rule=person_company_constraint
        )
    ],
    as_dict=False
)

# Example 2: Access an exclusion rule from the data model
data_model = graph.query_data_model()
data_model.constraint_rules
field alias: str = ''

The constraint rule alias.

field disabled: bool = False

Whether the constraint rule is disabled.

field name: str [Required]

The constraint rule name.

field role: esriGraphConstraintRuleRole = 'esriGraphConstraintRuleRoleRegular'

The constraint rule role.

field type: Literal['esriGraphConstraintRuleTypeUNSPECIFIED'] = 'esriGraphConstraintRuleTypeUNSPECIFIED'

The constraint rule type.

ConstraintRuleMask

pydantic model arcgis.graph.data_model_types.ConstraintRuleMask

Allows users to define which settings to update for a constraint rule

from arcgis.graph import ConstraintRuleMask

ConstraintRuleMask(update_name=True, update_alias=True, update_disabled=True)
field update_alias: bool = False

Whether to update the alias in the constraint rule.

field update_disabled: bool = False

Whether to update if the constraint rule is disabled.

field update_name: bool = False

Whether to update the name in the constraint rule.

EndPoint

pydantic model arcgis.graph.data_model_types.EndPoint

Represents a set of origin and destination entity types for a relationship type

Parameter

Description

origin_enity_type

Required String. Name of origin entity type.

destination_entity_type

Required String. Name of destination entity type.

from arcgis.graph import EndPoint

EndPoint("Person", "Company")
field destination_entity_type: str [Required]

The destination entity type for the relationship type.

field origin_entity_type: str [Required]

The origin entity type for the relationship type.

ser_model() dict[str, Any]

EntityType

pydantic model arcgis.graph.data_model_types.EntityType

Represents an entity named object type for a Knowledge Graph.

Parameter

Description

name

Required String. Name for the Entity Type.

alias

Optional String. The default value is “”.

role

Optional esriGraphNamedObjectRole String. The default value is “esriGraphNamedObjectRegular”.

strict

Optional Boolean. The default value is False.

properties

Optional Dict(String, GraphProperty). The default value is {}.

field_indexes

Optional Dict(String, FieldIndex). The default value is {}.

from arcgis.graph import EntityType

# Example 1: Define an entity type
EntityType(
    name="Person",
    properties={"name": GraphProperty(name="name")},
    field_indexes={"name_index": FieldIndex(name="name_index", is_ascending=True, is_unique=False, fields=["name"])}
)

# Example 2: Access information about an entity type from the data model
data_model = graph.query_data_model()
data_model.entity_types['Person'].properties

FieldIndex

pydantic model arcgis.graph.data_model_types.FieldIndex

Represents a field index to be used in graph_property_index_adds().

Parameter

Description

name

Required String. Name for the field index.

is_ascending

Required Boolean.

is_unique

Required Boolean.

fields

Required List(String). List of field names for the index.

from arcgis.graph import FieldIndex

# Example 1: create a FieldIndex to use
FieldIndex(name="name_index", is_ascending=True, is_unique=False, fields=["name"])

# Example 2: access FieldIndex in the data model
data_model = graph.query_data_model()
data_model.entity_types["Person"].field_indexes['name_index'].fields
field fields: list[str] [Required]

The list of fields participating in the index.

field is_ascending: bool [Required]

Whether the index is ascending.

field is_unique: bool [Required]

Whether the index is unique.

field name: str [Required]

The index name.

GraphDataModel

pydantic model arcgis.graph.data_model_types.GraphDataModel

Allows users to access information about the knowledge graph’s data model.

from arcgis.gis import GIS
from arcgis.graph import KnowledgeGraph, GraphDataModel

graph = KnowledgeGraph("URL to Knowledge Graph Service", gis=GIS("home"))
data_model = graph.query_data_model()

# Access the timestamp the data model was last update. The response will be an integer timestamp.
data_model.data_model_timestamp

# Access the spatial reference. The response will be a dictionary containing the spatial reference information.
data_model.spatial_reference

# Access entity types. The response will be a dictionary of string names and EntityType objects.
data_model.entity_types

# Access relationship types. The response will be a dictionary of string names and RelationshipType objects.
data_model.relationship_types

# Access meta entity types (example: Provenance). The response will be a dictionary of string names and EntityType objects.
data_model.meta_entity_types

# Access the boolean value of whether the data model is strict
data_model.strict

# Access the object id property name. The response will be a string.
data_model.objectid_property

# Access the global id property name. The response will be a string.
data_model.globalid_property

# Access the boolean value of whether the knowledge graph is ArcGIS managed.
data_model.arcgis_managed

# Access the identifier info. The response will be a IdentifierInfo object.
data_model.identifier_info

# Access the search indexes. The response will be a list of SearchIndex objects.
data_model.search_indexes

# Access the provenance source type values
data_model.provenance_source_type_values

# Access the constraint rules
data_model.constraint_rules
field arcgis_managed: bool [Required]

Whether the Knowledge Graph is ArcGIS managed.

field constraint_rules: list[Annotated[ConstraintRule | RelationshipExclusionRule, Discriminator(discriminator='type')]] = []

The list of constraint rules.

field data_model_timestamp: int [Required]

The timestamp of the last change to the data model.

field domains: list[GraphDomain] = []

The list of domains in the data model.

field entity_types: list[EntityType] = []

The list of entity types in the data model.

field globalid_property: str [Required]

The name of the GlobalID property.

field identifier_info: IdentifierInfo [Required]

Contains information about the unique identifier.

field meta_entity_types: list[EntityType] = []

The list of meta entity types in the data model.

field objectid_property: str [Required]

The name of the ObjectID property.

field provenance_source_type_values: ProvenanceSourceTypeValues = ProvenanceSourceTypeValues(value_behavior_array=[])

The Provenance source type values.

field relationship_types: list[RelationshipType] = []

The list of relationship types in the data model.

field search_indexes: list[SearchIndex] = []

The list of search indexes.

field spatial_reference: dict[str, Any] [Required]

The spatial reference of the Knowledge Graph.

field strict: bool [Required]

If True, the data model can only be edited by admins or owners.

ser_model() dict[str, Any]

GraphProperty

pydantic model arcgis.graph.data_model_types.GraphProperty

Represents a property of an EntityType or RelationshipType in the Knowledge Graph.

Parameter

Description

name

Required String. Name for the property. The default value is “”.

alias

Optional String. Alias for the property. The default value is “”.

domain

Optional String. Name of domain for the property. The default value is “”.

field_type

Optional esriFieldType string. The default value is “esriFieldTypeString”.

geometry_type

Optional esriGeometryType string. The default is None.

has_z

Optional Boolean. The default value is False.

has_m

Optional Boolean. The default value is False.

default_value

Optional Any value. The default value is None.

nullable

Optional Boolean. The default value is True.

visible

Optional Boolean. The default value is True.

editable

Optional Boolean. The default value is True.

required

Optional Boolean. The default value is False.

role

Optional esriGraphPropertyRole string. The default value is “esriGraphPropertyRegular”.

from arcgis.graph import GraphProperty

# Example 1: simple string property
GraphProperty(name="name", alias="name", required=True)

# Example 2: geometry property
GraphProperty(name="shape", field_type="esriFieldTypeGeoemtry", geometry_type="esriGeometryPolygon")

# Example 3: get GraphProperty information from data model
data_model = graph.query_data_model()
data_model.entity_types['Person'].properties['name'].required # accesses the required property on the GraphProperty 'name'.
field alias: str = ''

The alias of the property.

field default_value: Any = None

The default property value, or None if there is no default.

field domain: str = ''

The domain of the property.

field editable: bool = True

Whether the property is editable.

field field_type: esriFieldType = 'esriFieldTypeString'

The type of the property.

field geometry_type: esriGeometryType | None = None

The geometry type, or None if not a geometry property.

field has_m: bool = False

Whether the geometry has M values.

field has_z: bool = False

Whether the geometry has Z values.

field is_system_maintained: bool = False

Whether the property is system maintained.

field name: str [Required]

The name of the property.

field nullable: bool = True

Whether the property is nullable.

field required: bool = False

Whether the property is required.

field role: esriGraphPropertyRole = 'esriGraphPropertyRegular'

The role of the property.

field visible: bool = True

Whether the property is visible.

ser_model() dict[str, Any]

GraphPropertyMask

pydantic model arcgis.graph.data_model_types.GraphPropertyMask

Allows users to define which settings should be updated for a GraphProperty during a graph_property_update().

Parameter

Description

update_name

Optional Boolean. The default value is False.

update_alias

Optional Boolean. The default value is False.

update_domain

Optional Boolean. The default value is False.

update_field_type

Optional Boolean. The default value is False.

update_geometry_type

Optional Boolean. The default value is False.

update_has_z

Optional Boolean. The default value is False.

update_has_m

Optional Boolean. The default value is False.

update_default_value

Optional Boolean. The default value is False.

update_nullable

Optional Boolean. The default value is False.

update_visible

Optional Boolean. The default value is False.

update_editable

Optional Boolean. The default value is False.

update_required

Optional Boolean. The default value is False.

from arcgis.graph import GraphPropertyMask

GraphPropertyMask(update_name=True, update_visible=True, update_editable=True)
field update_alias: bool = False

Whether to update the property alias.

field update_default_value: bool = False

Whether to update the property default value.

field update_domain: bool = False

Whether to update the property domain.

field update_editable: bool = False

Whether to update if the property is editable.

field update_field_type: bool = False

Whether to update the property field type.

field update_geometry_type: bool = False

Whether to update the property geometry type.

field update_has_m: bool = False

Whether to update if the property has M values.

field update_has_z: bool = False

Whether to update if the property has Z values.

field update_name: bool = False

Whether to update the property name.

field update_nullable: bool = False

Whether to update if the property is nullable.

field update_required: bool = False

Whether to update if the property is required.

field update_visible: bool = False

Whether to update if the property is visible.

NamedObjectTypeMask

pydantic model arcgis.graph.data_model_types.NamedObjectTypeMask

Allows user to define what should be updated when performing a named_object_type_update().

Parameter

Description

update_name

Optional Boolean. The default value is False.

update_alias

Optional Boolean. The default value is False.

update_role

Optional Boolean. The default value is False.

update_strict

Optional Boolean. The default value is False.

from arcgis.graph import NamedObjectTypeMask

NamedObjectTypeMask(update_name=True, update_alias=True, update_strict=True)
field update_alias: bool = False

Whether to update the alias in the entity or relationship type.

field update_name: bool = False

Whether to update the name in the entity or relationship type.

field update_role: bool = False

Whether to update the role in the entity or relationship type.

field update_strict: bool = False

Whether to update if the entity or relationship type is strict.

RelationshipExclusionRule

pydantic model arcgis.graph.data_model_types.RelationshipExclusionRule

Represents an exclusion rule to define how relationships can be created in the knowledge graph between defined entity types.

from arcgis.graph import RelationshipExclusionRule, SetOfNamedTypes

# Example 1: Define an exclusion rule
RelationshipExclusionRule(
    name="OnlyPersonCanWorkAtCompany",
    origin_entity_types=SetOfNamedTypes(set_complement=["Person"]),
    relationship_types=SetOfNamedTypes(set=["WorksAt"]),
    destination_entity_types=SetOfNamedTypes(set=["Company"])
)

# Example 2: Access an exclusion rule from the data model
data_model = graph.query_data_model()
data_model.constraint_rules
field destination_entity_types: SetOfNamedTypes [Required]

The destination entity types in the rule.

field origin_entity_types: SetOfNamedTypes [Required]

The origin entity types in the rule.

field relationship_types: SetOfNamedTypes [Required]

The relationship types in the rule.

field type: Literal['esriGraphRelationshipExclusionRuleType'] = 'esriGraphRelationshipExclusionRuleType'

The constraint rule type.

ser_model() dict[str, Any]

RelationshipExclusionRuleUpdate

pydantic model arcgis.graph.data_model_types.RelationshipExclusionRuleUpdate

Allows a user to provide information for updating a relationship exclusion rule

from arcgis.graph import RelationshipExclusionRuleUpdate, RelationshipExclusionRule, ConstraintRuleMask

RelationshipExclusionRuleUpdate(
    rule_name="OnlyPersonCanWorkForCompany",
    mask=ConstraintRuleMask(update_name=True, update_alias=True),
    constraint_rule=RelationshipExclusionRule(
        name="PersonCanOnlyWorkAtCompany",
        alais="Person Works At Company",
        origin_entity_types=SetOfNamedTypes(set_complement=["Person"]),
        relationship_types=SetOfNamedTypes(set=["WorksAt"]),
        destination_entity_types=SetOfNamedTypes(set=["Company"])
    ),
    update_origin_entity_types=UpdateSetOfNamedTypes(add_named_types=["Employee"],remove_named_types=[]),
    update_relationship_types=UpdateSetOfNamedTypes(add_named_types=["WorksFor"],remove_named_types=["WorksAt"]),
    update_destination_entity_types=UpdateSetOfNamedTypes(add_named_types=["Park"],remove_named_types=[])
)
field update_destination_entity_types: UpdateSetOfNamedTypes [Required]

Updates to the set of destination entity types.

field update_origin_entity_types: UpdateSetOfNamedTypes [Required]

Updates to the set of origin entity types.

field update_relationship_types: UpdateSetOfNamedTypes [Required]

Updates to the set of relationship types.

ser_model() dict[str, Any]

RelationshipType

pydantic model arcgis.graph.data_model_types.RelationshipType

Represents a relationship named object type for a Knowledge Graph.

Parameter

Description

name

Required String. Name for the Entity Type.

alias

Optional String. The default value is “”.

role

Optional esriGraphNamedObjectRole String. The default value is “esriGraphNamedObjectRegular”.

strict

Optional Boolean. The default value is False.

properties

Optional Dict(String, GraphProperty). The default value is {}.

field_indexes

Optional Dict(String, FieldIndex). The default value is {}.

end_points

Optional List[EndPoint]. The default value is [].

from arcgis.graph import RelationshipType

# Example 1: Define a relationship type
RelationshipType(
    name="WorksAt",
    properties={"name": GraphProperty(name="name")},
    field_indexes={"name_index": FieldIndex(name="name_index", is_ascending=True, is_unique=False, fields=["name"])}
)

# Example 2: Access a relationship type from the data model
data_model = graph.query_data_model()
data_model.relationship_types['WorksAt'].properties
field observed_end_points: list[EndPoint] = []

The observed origin and destination entity type pairs in the database for the relationship type.

ser_model() dict[str, Any]

SetOfNamedTypes

pydantic model arcgis.graph.data_model_types.SetOfNamedTypes

Allows users to define the set of named types for a RelationshipExclusionRule.

Defining a set will exclude the set of named type names from being created in the graph once the exclusion rule is applied. Defining a set_complement will exclude anything other than the set of named type names from being created in the graph once the exclusion rule is applied.

from arcgis.graph import SetOfNamedTypes

# Example 1: set
SetOfNamedTypes(set=["Person","Animal"])

# Example 2: set_complement
SetOfNamedTypes(set_complement=["Company"])
field set: list[str] = []

The set of types.

field set_complement: list[str] = []

The complement of the set of types.

ser_model() dict[str, Any]
type_of_set() TypeOfSet

UpdateSetOfNamedTypes

pydantic model arcgis.graph.data_model_types.UpdateSetOfNamedTypes

Allows a user to define named types to add or remove from a RelationshipExclusionRule.

from arcgis.graph import UpdateSetOfNamedTypes

UpdateSetOfNamedTypes(add_named_types=["Individual"], remove_named_types=["Person"])
field add_named_types: list[str] [Required]

The named types to add to the set.

field remove_named_types: list[str] [Required]

The named types to remove from the set.

esriMergePolicyType

arcgis.graph.data_model_types.esriMergePolicyType

alias of Literal[‘esriMergePolicyType_UNSPECIFIED’, ‘esriMergePolicyTypeSumValues’, ‘esriMergePolicyTypeAreaWeighted’, ‘esriMergePolicyTypeDefaultValue’]

esriSplitPolicyType

arcgis.graph.data_model_types.esriSplitPolicyType

alias of Literal[‘esriSplitPolicyType_UNSPECIFIED’, ‘esriSplitPolicyTypeGeometryRatio’, ‘esriSplitPolicyTypeDuplicate’, ‘esriSplitPolicyTypeDefaultValue’]

GraphDomain

pydantic model arcgis.graph.data_model_types.GraphDomain
field field_type: esriFieldType | None = None

The field type associated with the domain.

field merge_policy_type: esriMergePolicyType | None = 'esriMergePolicyType_UNSPECIFIED'

The merge policy type for the domain.

field name: str [Required]

The given name of the domain.

field split_policy_type: esriSplitPolicyType | None = 'esriSplitPolicyType_UNSPECIFIED'

The split policy type for the domain.

CodedValue

pydantic model arcgis.graph.data_model_types.CodedValue
field code: Any [Required]

The code of the coded value.

field name: str [Required]

The name of the coded value.

CodedValueDomain

pydantic model arcgis.graph.data_model_types.CodedValueDomain

Represents a Coded Value Domain in the knowledge graph data model.

from arcgis.graph import CodedValueDomain
CodedValueDomain(
    name="example_domain",
    coded_values=[CodedValue(name="value1", code="happy"), CodedValue(name="value2", code="sad")],
    field_type="esriFieldTypeString",
    merge_policy_type="esriMergePolicyTypeDefaultValue",
    split_policy_type="esriSplitPolicyTypeDefaultValue",
)
field coded_values: list[CodedValue] = []

The list of CodedValues in the domain.

GraphDomainMask

pydantic model arcgis.graph.data_model_types.GraphDomainMask

Allows users to define what should be updated when performing a domain_update().

from arcgis.graph import GraphDomainMask

GraphDomainMask(
    update_name=True,
    update_domain=True,
    update_field_type=True,
    update_merge_policy=True,
    update_split_policy=True
)
field update_domain: bool = False

Boolean signifying whether to update the domain.

field update_field_type: bool = False

Boolean signifying whether to update the field type associated with the domain.

field update_merge_policy: bool = False

Boolean signifying whether to update the merge policy type for the domain.

field update_name: bool = False

Boolean signifying whether to update the name in the domain.

field update_split_policy: bool = False

Boolean signifying whether to update the split policy type for the domain.

GraphDomainUpdate

pydantic model arcgis.graph.data_model_types.GraphDomainUpdate

Allows users to provide information for updating a graph domain.

from arcgis.graph import GraphDomainUpdate, GraphDomainMask, CodedValueDoman

GraphDomainUpdate(
    name="example_domain",
    mask=GraphDomainMask(
        update_name=True,
        update_domain=True,
        update_field_type=True,
        update_merge_policy=True,
        update_split_policy=True
    ),
    domain=CodedValueDomain(
        name="example_domain_updated",
        coded_value_domain=...,
        field_type="esriFieldTypeString",
        merge_policy_type="esriMergePolicyTypeDefaultValue",
        split_policy_type="esriSplitPolicyTypeDefaultValue",
    )
)
field domain: CodedValueDomain | RangeDomain [Required]

The domain properties to update, as determined by the mask.

field mask: GraphDomainMask [Required]

The mask indicating the properties in the domain to update.

field name: str [Required]

The name of the domain to update.

RangeDomain

pydantic model arcgis.graph.data_model_types.RangeDomain

Represents a Range Domain in the knowledge graph data model.

from arcgis.graph import RangeDomain
RangeDomain(
    name="example_domain",
    range=[1, 100],
    field_type="esriFieldTypeInteger",
    merge_policy_type="esriMergePolicyTypeDefaultValue",
    split_policy_type="esriSplitPolicyTypeDefaultValue",
)
field range: list[Any] = []

The range of values in the domain.

Graph Types

Entity

pydantic model arcgis.graph.graph_types.Entity

Represents an entity instance in the knowledge graph

Parameter

Description

type_name

Required String. Name of the EntityType

id

Optional UUID. The default value is None. If not provided, an id will be assigned to the entity when it is created.

properties

Required Dictionary of Strings and Any values. String is the property name and Any value is the value for that property.

from arcgis.graph import Entity

# Example 1: Define an entity
Entity(
    type_name="Company",
    properties={"name":"Esri"}
)

# Example 2: Access an entity in a query response
query_result = graph.query("MATCH (n) RETURN n")
next(query_result)[0].properties
ser_model() dict[str, Any]

EntityDelete

pydantic model arcgis.graph.graph_types.EntityDelete

Allows a user to define which entities to delete from a EntityType.

Parameter

Description

type_name

Required String. Name of the EntityType

ids

Required List of UUID or Strings. Ids of the entities to delete.

from arcgis.graph import EntityDelete

# Example 1: Provide entity id values manually
EntityDelete(type_name="Person", ids=[UUID("783bd422-3hfp-45c7-87aa-8adbbdac0a3d")])

# Example 2: Delete from results of a query
results = graph.query("MATCH (n:Person) WHERE n.name CONTAINS "delete" RETURN n.globalid")
EntityDelete(type_name="Person", ids=list(results)[0])
ser_model() dict[str, Any]

Path

pydantic model arcgis.graph.graph_types.Path

A list of Entity and Relationship objects required to traverse a graph from one entity to another.

graph.query("MATCH path=()-[]-() RETURN path LIMIT 1")
path = list(result)[0][0]

path.path[0] # first entity in path
path.path[1] # first relationship in path
path.path[-1] # last entity in path
field path: list[Entity | Relationship] [Required]

The list of entities and relationships in the path.

ser_model() dict[str, Any]

Relationship

pydantic model arcgis.graph.graph_types.Relationship

Represents a relationship instance in the knowledge graph

Parameter

Description

type_name

Required String. Name of the EntityType

id

Optional UUID or String. The default value is None. If not provided, an id will be assigned to the entity when it is created.

origin_entity_id

Required UUID or String. The id of the origin Entity in the graph.

destiation_entity_id

Required UUID or String. The id of the destination Entity in the graph.

properties

Optional Dictionary of Strings and Any values. String is the property name and Any value is the value for that property.

from arcgis.graph import Relationship
from datetime import datetime
from uuid import UUID

# Example 1: Define a relationship
Relationship(
    type_name="WorksAt",
    origin_entity_id=UUID("488bd414-3afd-4547-89aa-4adbbdac0a8d"),
    destination_entity_id=UUID("783bd422-3hfp-45c7-87aa-8adbbdac0a3d"),
    properties={"start_date":datetime.fromtimestamp(1578247200000)}
)

# Example 2: Access an relationship in a query response
query_result = graph.query("MATCH ()-[n]-() RETURN n")
next(query_result)[0].properties
field destination_entity_id: Any [Required]

The unique identifier of the relationship’s destination entity.

field origin_entity_id: Any [Required]

The unique identifier of the relationship’s origin entity.

ser_model() dict[str, Any]

RelationshipDelete

pydantic model arcgis.graph.graph_types.RelationshipDelete

Allows a user to define which relationships to delete from a RelationshipType.

Parameter

Description

type_name

Required String. Name of the RelationshipType

ids

Required List of UUID or Strings. Ids of the relationships to delete.

from arcgis.graph import RelationshipDelete

# Example 1: Provide relationship id values manually
RelationshipDelete(type_name="WorksAt", ids=[UUID("783bd422-3hfp-45c7-87aa-8adbbdac0a3d")])

# Example 2: Delete from results of a query
results = graph.query("MATCH ()-[n:WorksAt]-() WHERE n.name CONTAINS "delete" RETURN n.globalid")
RelationshipDelete(type_name="WorksAt", ids=list(results)[0])
ser_model() dict[str, Any]

Transform

pydantic model arcgis.graph.graph_types.Transform

Allows a user to specify custom quantization parameters for input geometry, which dictate how geometries are compressed and transferred to the server.

Parameter

Description

xy_resolution

Required float.

x_false_origin

Required float.

y_false_origin

Required float.

z_resolution

Required float.

z_false_origin

Required float.

m_resolution

Required float.

m_false_origin

Required float.

field m_false_origin: float [Required]

The M false origin.

field m_resolution: float [Required]

The M resolution.

field x_false_origin: float [Required]

The X false origin.

field xy_resolution: float [Required]

The XY resolution.

field y_false_origin: float [Required]

The Y false origin.

field z_false_origin: float [Required]

The Z false origin.

field z_resolution: float [Required]

The Z resolution.

Search Types

SearchIndex

pydantic model arcgis.graph.search_types.SearchIndex

Allows full-text search capability on the graph for a set of properties for each entity or relationship type. Search indexes can be accessed in the GraphDataModel.

data_model = graph.query_data_model()
data_model.search_indexes
field analyzers: list[SearchAnalyzer] [Required]

The list of search analyzers.

field name: str [Required]

The name of the search index.

field search_properties: dict[str, SearchIndexProperties] [Required]

The search properties, grouped by type name.

field supported_category: esriNamedTypeCategory [Required]

The supported category of the search index.

ser_model() dict[str, Any]

SearchIndexProperties

pydantic model arcgis.graph.search_types.SearchIndexProperties

List of properties for search index

Parameter

Description

property_names

Required List of Strings. Names of properties.

from arcgis.graph import SearchIndexProperties

SearchIndexProperties(property_names=["name","comment"])
field property_names: list[str] [Required]

The properties in the search index.

Response Types

ApplyEditsResponse

pydantic model arcgis.graph.response_types.ApplyEditsResponse

Response for applying edits to Entity or Relationship in the graph.

# Example of a response without errors
ApplyEditsResponse(
    error=None,
    edits_result={
        'Person': EditResults(
            add_results=[EditResult(id=UUID('ab913bcb-1781-4137-9513-b3c942c23bc2'), error=None)],
            update_results=[],
            delete_results=[]
        ),
        'Company': EditResults(
            add_results=[EditResult(id=UUID('26419c98-5521-4611-b2c2-196c35acc06d'), error=None)],
            update_results=[],
            delete_results=[]
        ),
        'WorksAt': EditResults(
            add_results=[EditResult(id=UUID('1da2f6fc-e407-4561-97db-bba4745bd803'), error=None)],
            update_results=[],
            delete_results=[]
        )
    },
    cascaded_deletes={},
    relationship_schema_changes={},
    cascaded_provenance_deletes=[]
)

# Example of a response with errors
ApplyEditsResponse(
    error=Error(
        error_code=111188,
        error_message="The destination identifier '{6F445050-0037-4308-8EE4-4B52C83763DC}' was not found."
    ),
    edits_result={},
    cascaded_deletes={},
    relationship_schema_changes={},
    cascaded_provenance_deletes=[]
)
field cascaded_deletes: dict[str, list[CascadingRelationshipDelete]] [Required]

The cascade deleted relationships, grouped by type name.

field cascaded_provenance_deletes: list[CascadingProvenanceDelete] = []

The cascade deleted Provenance entities.

field edits_result: dict[str, EditResults] [Required]

The edit results, grouped by type name.

field error: Error | None = None

The error, or None if the operation was successful.

field relationship_schema_changes: dict[str, RelationshipTypeSchemaChanges] [Required]

The relationship type schema changes, grouped by type name.

field schema_results: SchemaResults = SchemaResults(unknown_types=[], unknown_properties={})

The schema results containing unknown types and properties encountered during the operation.

ser_model() dict[str, Any]

CascadingProvenanceDelete

pydantic model arcgis.graph.response_types.CascadingProvenanceDelete
field id: Any [Required]

The ID of the Provenance entity that was cascade deleted.

CascadingRelationshipDelete

pydantic model arcgis.graph.response_types.CascadingRelationshipDelete
field destination_id: Any [Required]

The destination entity ID for the relationship that was cascade deleted.

field id: Any [Required]

The ID of the relationship that was cascade deleted.

field origin_id: Any [Required]

The origin entity ID for the relationship that was cascade deleted.

ser_model() dict[str, Any]

ConstraintRuleAddResult

pydantic model arcgis.graph.response_types.ConstraintRuleAddResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the added constraint rule.

field warnings: list[Error] [Required]

The list of warnings from adding the constraint rule.

ser_model() dict[str, Any]

ConstraintRuleAddsResponse

pydantic model arcgis.graph.response_types.ConstraintRuleAddsResponse

Response for adding a RelationshipExclusionRule constraint rule.

# Example of successful add result
ConstraintRuleAddsResponse(
    error=None,
    constraint_rule_add_results=[
        ConstraintRuleAddResult(
            name='PersonCanOnlyWorkAtCompany',
            error=None,
            warnings=[]
        )
    ]
)

# Example of a response with errors
ConstraintRuleAddsResponse(
    error=None,
    constraint_rule_add_results=[
        ConstraintRuleAddResult(
            name='PersonCanOnlyWorkAtCompany',
            error=Error(
                error_code=112237,
                error_message="Error adding the constraint rule, 'PersonCanOnlyWorkAtCompany', to the data model."
            ),
            warnings=[]
        )
    ]
)
field constraint_rule_add_results: list[ConstraintRuleAddResult] [Required]

The list of results for the added constraint rules.

field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

ConstraintRuleDeleteResult

pydantic model arcgis.graph.response_types.ConstraintRuleDeleteResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the deleted constraint rule.

ser_model() dict[str, Any]

ConstraintRuleDeletesResponse

pydantic model arcgis.graph.response_types.ConstraintRuleDeletesResponse

Response for deleting a RelationshipExclusionRule.

# Example of a response without errors
ConstraintRuleDeletesResponse(
    error=None,
    constraint_rule_delete_results=[
        ConstraintRuleDeleteResult(name='PersonCanOnlyWorkAtCompany', error=None)
    ]
)

# Example of a response with errors
ConstraintRuleDeletesResponse(
    error=None,
    constraint_rule_delete_results=[
        ConstraintRuleDeleteResult(
            name='PersonCanOnlyWorkAtCompany2',
            error=Error(
                error_code=112242,
                error_message="The constraint rule 'PersonCanOnlyWorkAtCompany2' with role 'REGULAR' does not exist in the data model."
            )
        )
    ]
)
field constraint_rule_delete_results: list[ConstraintRuleDeleteResult] [Required]

The list of results from deleting the constraint rules.

field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

ConstraintRuleUpdateResult

pydantic model arcgis.graph.response_types.ConstraintRuleUpdateResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the updated constraint rule.

field warnings: list[Error] [Required]

The list of warnings for the updated constraint rules.

ser_model() dict[str, Any]

ConstraintRuleUpdatesResponse

pydantic model arcgis.graph.response_types.ConstraintRuleUpdatesResponse

Response for updating a RelationshipExclusionRule.

# Example of a response without errors
ConstraintRuleUpdatesResponse(
    error=None,
    constraint_rule_update_results=[
        ConstraintRuleUpdateResult(
            name='PersonCanOnlyWorkAtCompany',
            error=None,
            warnings=[]
        )
    ]
)

# Example of a response with errors
ConstraintRuleUpdatesResponse(
    error=None,
    constraint_rule_update_results=[
        ConstraintRuleUpdateResult(
            name='PersonCanOnlyWorkAtCompany',
            error=None,
            warnings=[
                Error(
                    error_code=112225,
                    error_message="A relationship with origin entity type 'Employee', relationship type 'WorksFor', and destination entity type 'Park' is explicitly allowed by relationship exclusion rule 'PersonCanOnlyWorkAtCompany', but not allowed by relationship exclusion rule 'PersonCanOnlyWorkAtCompany3'."
                ),
                Error(
                    error_code=112244,
                    error_message='The following entity types do not exist in the data model: [Employee, Park].'
                ),
                Error(
                    error_code=112245,
                    error_message='The following relationship types do not exist in the data model: [WorksFor].'
                )
            ]
        )
    ]
)
field constraint_rule_update_results: list[ConstraintRuleUpdateResult] [Required]

The list of results from updating the constraint rule.

field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

CreateReplicaResponse

pydantic model arcgis.graph.response_types.CreateReplicaResponse
field errors: list[Error] | None = None

The errors, or None if the operation was successful.

field replica_data: Any [Required]

The arcgis.graph._service.ReplicaData object containing the data from the operation.

field replica_data_format: str [Required]

The format of the data in the replica.

field replica_id: str [Required]

The ID of the replica created.

field replica_name: str [Required]

The name of the replica created.

field requested_name: str [Required]

The name originally requested for the replica.

field sync_date: datetime [Required]

The date and time when the replica was created.

field warnings: list[Error] | None = None

The warnings, or None if the operation was successful.

DataTransferStats

pydantic model arcgis.graph.response_types.DataTransferStats
field source_count: int [Required]

The number of this type in the graph.

field transferred_count: int [Required]

The number of this type transferred.

field type_name: str [Required]

The name of the entity or relationship type.

EditResult

pydantic model arcgis.graph.response_types.EditResult
field error: Error | None = None

The error, or None if the operation was successful.

field id: Any [Required]

The ID of the edited entity or relationship.

ser_model() dict[str, Any]

EditResults

pydantic model arcgis.graph.response_types.EditResults
field add_results: list[EditResult] = []

The results from adding entities and relationships.

field delete_results: list[EditResult] = []

The results from deleting entities and relationships.

field update_results: list[EditResult] = []

The results from updating entities and relationships.

Error

pydantic model arcgis.graph.response_types.Error
field error_code: int [Required]

The error code.

field error_message: str [Required]

The error message.

ExportResponse

pydantic model arcgis.graph.response_types.ExportResponse
field completion_time: int [Required]

The time the export job was completed.

field download_url: str [Required]

The URL to download the exported data.

field error: Error | None = None

The error, or None if the operation was successful.

field export_data_format: str [Required]

The format of the exported data.

field service_definition_name: str [Required]

The name of the service definition created by the export job.

field statistics: list[DataTransferStats] [Required]

The statistics generated during the export job.

field submission_time: int [Required]

The time the export job was submitted.

field warnings: list[Error] | None = None

The warnings generated during the export job.

IndexAddResult

pydantic model arcgis.graph.response_types.IndexAddResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the added index.

ser_model() dict[str, Any]

IndexAddsResponse

pydantic model arcgis.graph.response_types.IndexAddsResponse

Response for adding a FieldIndex to a GraphProperty.

# Example of a successful response
IndexAddsResponse(
    error=None,
    index_add_results=[
        IndexAddResult(
            name='name_index',
            error=None
        )
    ]
)

# Example of a response with errors
IndexAddsResponse(
    error=None,
    index_add_results=[
        IndexAddResult(
            name='name_index',
            error=Error(
                error_code=112047,
                error_message="Graph Index, 'name_index', already exists."
            )
        )
    ]
)
field error: Error | None = None

The error, or None if the operation was successful.

field index_add_results: list[IndexAddResult] [Required]

The list of results for the added indexes.

ser_model() dict[str, Any]

IndexDeleteResult

pydantic model arcgis.graph.response_types.IndexDeleteResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the deleted index.

ser_model() dict[str, Any]

IndexDeletesResponse

pydantic model arcgis.graph.response_types.IndexDeletesResponse

Response for deleting a FieldIndex from a GraphProperty.

# Example of a successful response
IndexDeletesResponse(
    error=None,
    index_delete_results=[
        IndexDeleteResult(
            name='name_index',
            error=None
        )
    ]
)

# Example of a response with errors
IndexDeletesResponse(
    error=None,
    index_delete_results=[
        IndexDeleteResult(
            name='name_index',
            error=Error(
                error_code=112051,
                error_message="Graph Index, 'name_index', does not exist in the data model."
            )
        )
    ]
)
field error: Error | None = None

The error, or None if the operation was successful.

field index_delete_results: list[IndexDeleteResult] [Required]

The list of results for the deleted indexes.

ser_model() dict[str, Any]

NamedObjectTypeAddsResponse

pydantic model arcgis.graph.response_types.NamedObjectTypeAddsResponse

Response for adding a named object type to the graph.

# Example of a successful response
NamedObjectTypeAddsResponse(
    error=None,
    entity_add_results=[
        NamedObjectTypeAddResult(
            name='Vehicle',
            error=None
        )
    ],
    relationship_add_results=[
        NamedObjectTypeAddResult(
            name='Drives',
            error=None
        )
    ]
)

# Example of a response with errors
NamedObjectTypeAddsResponse(
    error=None,
    entity_add_results=[
        NamedObjectTypeAddResult(
            name='Vehicle',
            error=Error(
                error_code=112092,
                error_message="The entity or relationship type, 'Vehicle', already exists, please provide a new type name."
            )
        )
    ],
    relationship_add_results=[
        NamedObjectTypeAddResult(
            name='Drives',
            error=Error(
                error_code=112092,
                error_message="The entity or relationship type, 'Drives', already exists, please provide a new type name."
            )
        )
    ]
)
field entity_add_results: list[NamedObjectTypeAddResult] [Required]

The list of results for added entity types.

field error: Error | None = None

The error, or None if the operation was successful.

field relationship_add_results: list[NamedObjectTypeAddResult] [Required]

The list of results for added relationship types.

ser_model() dict[str, Any]

NamedObjectTypeAddResult

pydantic model arcgis.graph.response_types.NamedObjectTypeAddResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The type name that was added.

ser_model() dict[str, Any]

NamedObjectTypeUpdateResponse

pydantic model arcgis.graph.response_types.NamedObjectTypeUpdateResponse

Response for updating a named object type in the graph.

# Example of a successful response
NamedObjectTypeUpdateResponse(error=None)

# Example of a response with errors
NamedObjectTypeUpdateResponse(
    error=Error(
        error_code=112075,
        error_message='Updating the name of an entity or relationship type is not allowed.'
    )
)
field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

NamedObjectTypeDeleteResponse

pydantic model arcgis.graph.response_types.NamedObjectTypeDeleteResponse

Response for deleting a named object type in the graph.

# Example of a successful response
NamedObjectTypeDeleteResponse(error=None)

# Example of a response with errors
NamedObjectTypeDeleteResponse(
    error=Error(
        error_code=112020,
        error_message="The entity or relationship type definition, 'Vehicle', was not found."
    )
)
field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

PropertyAddsResponse

pydantic model arcgis.graph.response_types.PropertyAddsResponse

Response for adding a GraphProperty to an EntityType or RelationshipType in the graph.

# Example of a successful response
PropertyAddsResponse(
    error=None,
    property_add_results=[
        PropertyAddResult(
            name='age',
            error=None
        )
    ]
)

# Example of a response with errors
PropertyAddsResponse(
    error=None,
    property_add_results=[
        PropertyAddResult(
            name='age',
            error=Error(
                error_code=112043,
                error_message="Graph property, 'age', already exists in data model."
            )
        )
    ]
)
field error: Error | None = None

The error, or None if the operation was successful.

field property_add_results: list[PropertyAddResult] [Required]

The list of results for the added properties.

ser_model() dict[str, Any]

PropertyAddResult

pydantic model arcgis.graph.response_types.PropertyAddResult
field error: Error | None = None

The error, or None if the operation was successful.

field name: str [Required]

The name of the property that was added.

ser_model() dict[str, Any]

PropertyUpdateResponse

pydantic model arcgis.graph.response_types.PropertyUpdateResponse

Response for updating a GraphProperty in the graph.

# Example of a successful response
PropertyUpdateResponse(error=None)

# Example of a response with errors
PropertyUpdateResponse(error=Error(error_code=112068, error_message="Graph property, 'current_age', does not exist in data model."))
field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

PropertyDeleteResponse

pydantic model arcgis.graph.response_types.PropertyDeleteResponse

Response for deleting a GraphProperty in the graph.

# Example of a successful response
PropertyDeleteResponse(error=None)

# Example of a response with errors
PropertyDeleteResponse(error=Error(error_code=112068, error_message="Graph property, 'age', does not exist in data model."))
field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

RelationshipTypeSchemaChanges

pydantic model arcgis.graph.response_types.RelationshipTypeSchemaChanges
field new_end_points: list[EndPoint] [Required]

The new end points in the database as a result of the edits.

ReplicaDefinitionResponse

pydantic model arcgis.graph.response_types.ReplicaDefinitionResponse
field creation_date: datetime [Required]

The creation date of the replica.

field last_sync_date: datetime [Required]

The last synchronization date for the replica.

field replica_filters: ReplicaFilters = None

The filters applied to the replica.

field replica_id: str [Required]

The unique identifier for the replica.

field replica_name: str [Required]

The name of the replica.

field replica_owner: str [Required]

The owner of the replica.

field sync_direction: str [Required]

The synchronization direction for the replica.

ReplicaHeaderResponse

pydantic model arcgis.graph.response_types.ReplicaHeaderResponse

Defines header information for replica data.

field spatial_reference: SpatialReference [Optional]

The replica spatial reference.

field sync_date: datetime = None

The replica sync date.

field transform: FilterTransform [Optional]

The replica transform.

ReplicaInfoResponse

pydantic model arcgis.graph.response_types.ReplicaInfoResponse
field replica_id: str [Required]

The unique identifier for the replica.

field replica_name: str [Required]

The name of the replica.

field sync_date: datetime [Required]

The last synchronization date for the replica.

SchemaResults

pydantic model arcgis.graph.response_types.SchemaResults
field unknown_properties: dict[str, list[str]] = {}

The list of unknown properties encountered during the operation, grouped by type name.

field unknown_types: list[str] = []

The list of unknown types encountered during the operation.

SyncDataModelResponse

pydantic model arcgis.graph.response_types.SyncDataModelResponse

Response for syncing the GraphDataModel using sync_data_model().

# Example of a successful response
SyncDataModelResponse(error=None)

# Example of a response with errors
SyncDataModelResponse(
    error=Error(
        error_code=113005,
        error_message="The service's graph data source does not support the operation."
    )
)
field error: Error | None = None

The error, or None if the operation was successful.

field named_type_sync_results: list[SyncDataModelResult] = []

The list of results for each named type.

field warnings: list[Error] = []

The list of warnings returned for the operation.

ser_model() dict[str, Any]

SyncDataModelResult

pydantic model arcgis.graph.response_types.SyncDataModelResult
field error: Error | None = None

The error, or None if the operation was successful.

field type_name: str [Required]

The type name that was synced.

field warnings: list[Error] = []

The list of warnings returned for the named type.

ser_model() dict[str, Any]

SynchronizeReplicaResponse

pydantic model arcgis.graph.response_types.SynchronizeReplicaResponse
field errors: list[Error] | None = None

The errors, or None if the operation was successful.

field replica_id: str [Required]

The ID of the replica created.

field sync_data: Any [Required]

The arcgis.graph._service.ReplicaData object containing the data from the operation.

field sync_data_format: str [Required]

The format of the data in the replica.

field sync_date: datetime [Required]

The date and time when the replica was created.

field upload_results: UploadResults = None

The results of the upload operation.

field warnings: list[Error] | None = None

The warnings, or None if the operation was successful.

UnregisterReplicaResponse

pydantic model arcgis.graph.response_types.UnregisterReplicaResponse
field error: Error | None = None

The error from the operation, or None if the operation was successful.

field replica_id: str [Required]

The ID of the replica that was unregistered.

UpdateSearchIndexResponse

pydantic model arcgis.graph.response_types.UpdateSearchIndexResponse

Response for updating a SearchIndex using update_search_index().

# Example of a successful response
UpdateSearchIndexResponse(error=None)

# Example of a response with errors
UpdateSearchIndexResponse(
    error=Error(
        error_code=112093,
        error_message="The entity or relationship type, 'NotAType', does not exist."
    )
)
field error: Error | None = None

The error, or None if the operation was successful.

ser_model() dict[str, Any]

UploadResults

pydantic model arcgis.graph.response_types.UploadResults
field sync_apply_edits_result: ApplyEditsResponse = None

The results of the apply edits operation.

Replica-Synchronization Types

ReplicaData

class arcgis.graph.ReplicaData(data_path: str, gis=None)

Bases: object

Represents the data of a knowledge graph replica, allowing for processing of the entities and relationships contained within the replica. Leverages libarchive-c to work with 7z archives, the standard format for replica files. Can be instantiated with a path to a local replica file or a URL to a replica file (such as the ones returned by server endpoints within the create_replica() or synchronize_replica() operations). If a URL is provided, the file will be downloaded to a temporary directory that is cleaned up afterwards.

This class provides metadata on the replica, including the service data model, sync date, and the types of entities and relationships contained in the replica. Additionally, it provides a generator method stream_data_frames() that allows for streaming of the binary entity and relationship data contained within the replica archive.

Parameter

Description

data_path

Required string. The path to the replica file, either a local file path or a URL.

gis

Optional GIS object. Only required if the data_path is a URL, in which case the GIS object is used to authenticate the download request. If none is provided and data_path is a URL, the environment’s active GIS is used.

Example usage (using a local replica file):

from arcgis.graph import ReplicaData

file_path = "path/to/replica.7z"
replica_data = ReplicaData(file_path)

# metadata
dm = replica_data.service_data_model
header = replica_data.header
sync_date = replica_data.sync_date
for type in replica_data.entity_types:
    print(f"Entity type: {type}")
for type in replica_data.relationship_types:
    print(f"Relationship type: {type}")

# processing data frames (all by default)
df_generator = replica_data.stream_data_frames()
for replica_df in df_generator:
    # for each ReplicaDataFrame, you can access the type name, category, and edit type
    print("Category: ", replica_df.type_category)
    print("Type name: ", replica_df.type_name)
    print("Edit type: ", replica_df.edit_type)

    # and then access the data contained in the frame using the decoder
    data_generator = replica_df.iterate_data()
close()
property entity_types: dict[str, list[str]]

Returns a dictionary mapping entity type names to their corresponding list of edit types (add, update, delete) contained in the replica. The keys of the dictionary are the entity type names, and the values are lists of edit types.

property header: ReplicaHeaderResponse

Returns a ReplicaHeaderResponse object containing metadata about the replica, including the sync date, spatial reference, and transform information.

property relationship_types: dict[str, list[str]]

Returns a dictionary mapping relationship type names to their corresponding list of edit types (add, update, delete) contained in the replica. The keys of the dictionary are the relationship type names, and the values are lists of edit types.

property service_data_model: GraphDataModel

Returns a GraphDataModel object representing the service data model of the knowledge graph replica.

stream_data_frames(type_names: list[str] | None = None, type_categories: list[Literal['Entity', 'Relationship']] | None = None, edit_types: list[Literal['Add', 'Update', 'Delete']] | None = None) Generator[ReplicaDataFrame, None, None]

Streams the entity and relationship data contained in the replica archive. Creates a generator that yields ReplicaDataFrame objects, each one corresponding to a single type and edit type (add, update, delete) contained in the replica. The data return can be filtered by type name, type category, and edit type.

Parameter

Description

type_names

Optional list of strings. If provided, only data frames corresponding to the specified type names will be streamed. If None, all type names are included.

type_categories

Optional list of TypeCategory. If provided, only data frames corresponding to the specified categories (Entity, Relationship) will be streamed. If None, all type categories are included.

edit_types

Optional list of EditType. If provided, only data frames corresponding to the specified edit types (Add, Update, Delete) will be streamed. If None, all edit types are included.

from arcgis.graph import ReplicaData
rd = ReplicaData("path/to/replica.7z")
df_generator = rd.stream_data_frames(
    type_names=["Person", "Animal"],
    type_categories=["Entity"],
    edit_types=["Add", "Update"],
)

for replica_df in df_generator:
    print("Category: ", replica_df.type_category)
    print("Type name: ", replica_df.type_name)
    print("Edit type: ", replica_df.edit_type)

    data_generator = replica_df.iterate_data()
Returns:

Generator of ReplicaDataFrame objects.

property sync_date: datetime

Returns the sync date of the replica as a UTC datetime object.

DocumentOptions

pydantic model arcgis.graph.replica_sync_types.DocumentOptions

Defines document options for an entity replica definition.

field include_connected_documents: IncludeConnectedDocuments = None

The connected document inclusion options.

EntityTypeReplicaDefinition

pydantic model arcgis.graph.replica_sync_types.EntityTypeReplicaDefinition

Defines an entity type and optional filter criteria for replica creation.

field document_options: DocumentOptions | None = None

The document options for the entity type.

FilterTransform

pydantic model arcgis.graph.replica_sync_types.FilterTransform

Defines scale and translate values used by geometry filters.

field scale: Scale [Optional]

The scale values for the filter transform.

field translate: Translate [Optional]

The translate values for the filter transform.

IncludeConnectedDocuments

pydantic model arcgis.graph.replica_sync_types.IncludeConnectedDocuments

Defines whether connected documents are included with an entity replica definition.

field provenance_options: ProvenanceOptions [Optional]

The provenance options for connected documents.

IncludeProvenance

pydantic model arcgis.graph.replica_sync_types.IncludeProvenance

Defines whether source documents are included with provenance information.

field include_source_documents: bool = False

Specifies whether source documents are included.

NamedTypeReplicaDefinition

pydantic model arcgis.graph.replica_sync_types.NamedTypeReplicaDefinition

Defines a named type and optional filter criteria for replica creation.

field open_cypher_where_clause: str = ''

The openCypher WHERE clause used to filter rows for the type.

field parameters: dict[str, Any] [Optional]

The openCypher parameters for the named type replica definition.

field provenance_options: ProvenanceOptions | None = None

The provenance options for the named type.

field type_name: str = ''

The entity or relationship type name.

ProvenanceOptions

pydantic model arcgis.graph.replica_sync_types.ProvenanceOptions

Defines provenance options for a replica definition.

field include_provenance: IncludeProvenance = None

The provenance inclusion options.

ReferenceReplica

pydantic model arcgis.graph.replica_sync_types.ReferenceReplica

Defines a reference to an existing replica.

field replica_id: UUID [Required]

The replica ID.

RelationshipTypeReplicaDefinition

pydantic model arcgis.graph.replica_sync_types.RelationshipTypeReplicaDefinition

Defines a relationship type and optional filter criteria for replica creation.

ReplicaDataFrame

pydantic model arcgis.graph.replica_sync_types.ReplicaDataFrame

Contains the data pertaining to a specific file in a replica. This file will contain data pertaining to an edit type (add, update, delete) for specific entity or relationship type. Contains the metadata for the file, and a generator to iterate over the entities or relationships in the file.

field edit_type: str [Required]

The type of operation done for the data frame.

field type_category: str [Required]

Whether the data frame represents an entity or a relationship.

field type_name: str [Required]

The name of the entity or relationship.

iterate_data(as_dict: bool = False) Generator[Entity | Relationship | dict, None, None]

Iterates over the data in the replica data frame, yielding either Entity or Relationship objects.

Parameter

Description

as_dict

Optional bool. If True, yields a dictionary representation of the data frame. If False, yields arcgis.graph.graph_types.Entity or arcgis.graph.graph_types.Relationship objects. Default is False.

Returns:

Generator of arcgis.graph.graph_types.Entity, arcgis.graph.graph_types.Relationship, or dict objects.

ReplicaDataHeader

pydantic model arcgis.graph.replica_sync_types.ReplicaDataHeader

Defines header information for a replica data delta.

field delta_type: ReplicaDataDeltaType [Required]

The replica data delta type.

field type_category: esriNamedTypeCategory = 'unspecified'

The named type category.

field type_name: str = ''

The entity or relationship type name.

ReplicaDeltas

pydantic model arcgis.graph.replica_sync_types.ReplicaDeltas

Defines the deltas of the replica data since the last synchronization.

field last_sync_date: int = 0

The last sync date for the replica deltas, in milliseconds since epoch.

ReplicaFilters

pydantic model arcgis.graph.replica_sync_types.ReplicaFilters

Defines filters and spatial information used to create a replica.

field input_spatial_reference: SpatialReference | None = None

The input spatial reference for replica filters.

field static_definition: StaticDefinition [Optional]

The static replica definition.

field transform: FilterTransform | Transform | None = None

The filter transform.

ReplicaHeader

pydantic model arcgis.graph.replica_sync_types.ReplicaHeader

Defines header information for replica data.

field spatial_reference: SpatialReference [Optional]

The replica spatial reference.

field sync_date: datetime = None

The replica sync date.

field transform: FilterTransform [Optional]

The replica transform.

ReplicaRequest

pydantic model arcgis.graph.replica_sync_types.ReplicaRequest

Defines the parameters for a replica creation request.

field asynchronous: bool = False

Specifies whether the replica creation should be performed asynchronously.

field direction: SyncDirection = 'BIDIRECTIONAL'

The direction of the sync operation. Options are UPLOAD, DOWNLOAD, and BIDIRECTIONAL.

field replica_definition: ReferenceReplica | ReplicaFilters [Required]

The replica definition, either a reference replica or filters for replica creation.

field replica_name: str | None = 'newReplica'

The name of the replica to be created. If not provided, a default name will be assigned.

field timeout: int | None = 600

The timeout for the async replica creation request in seconds.

ReplicaSnapshot

pydantic model arcgis.graph.replica_sync_types.ReplicaSnapshot

Defines a snapshot of the replica data at a specific point in time.

Scale

pydantic model arcgis.graph.replica_sync_types.Scale

Defines scale values used by geometry filter transforms.

field m_scale: float = 0.0

The M scale value.

field x_scale: float = 0.0

The X scale value.

field y_scale: float = 0.0

The Y scale value.

field z_scale: float = 0.0

The Z scale value.

StaticDefinition

pydantic model arcgis.graph.replica_sync_types.StaticDefinition

Defines the entity and relationship types included in a replica.

field entity_type_replica_definitions: list[EntityTypeReplicaDefinition] [Optional]

The entity type replica definitions.

field relationship_type_replica_definitions: list[RelationshipTypeReplicaDefinition] [Optional]

The relationship type replica definitions.

SyncApplyEdits

pydantic model arcgis.graph.replica_sync_types.SyncApplyEdits

Defines the edits to be applied to the service during synchronization.

field adds: Sequence[Entity | Relationship] | None = []

The entities or relationships to be added.

field cascade_delete: bool = False

Specifies whether to perform cascade delete for the sync apply edits.

field cascade_delete_provenance: bool = False

Specifies whether to track the provenance of cascade deletes for the sync apply edits.

field deletes: Sequence[EntityDelete | RelationshipDelete] | None = []

The entities or relationships to be deleted.

field input_transform: Transform | None = None

The input transform for the sync apply edits operation.

field updates: Sequence[Entity | Relationship] | None = []

The entities or relationships to be updated.

SyncDownloadParameters

pydantic model arcgis.graph.replica_sync_types.SyncDownloadParameters

Defines the parameters for downloading replica data during synchronization.

field data_format: SyncDataFormat = 'PBF'

The data format for the sync download.

field replica_deltas: ReplicaDeltas | None = None

The replica deltas to be downloaded.

field replica_snapshot: ReplicaSnapshot | None = None

The replica snapshot to be downloaded.

SynchronizeReplicaRequest

pydantic model arcgis.graph.replica_sync_types.SynchronizeReplicaRequest

Defines the parameters for the synchronize operation.

field asynchronous: bool = False

Specifies whether the replica synchronization should be performed asynchronously.

field download_parameters: SyncDownloadParameters | None = None

The parameters for downloading replica data during synchronization.

field replica_id: UUID | str [Required]

The replica ID for the synchronization request.

field timeout: int | None = 600

The timeout for the async synchronize replica request in seconds.

field upload_edits: SyncUploadEdits | None = None

The edits to be uploaded during synchronization.

SyncUploadEdits

pydantic model arcgis.graph.replica_sync_types.SyncUploadEdits

Defines the upload mechanism for updating a service during synchronization. Currently limited to apply edits.

field sync_apply_edits: SyncApplyEdits [Required]

The sync apply edits containing the replica updates.

Translate

pydantic model arcgis.graph.replica_sync_types.Translate

Defines translate values used by geometry filter transforms.

field m_translate: float = 0.0

The M translate value.

field x_translate: float = 0.0

The X translate value.

field y_translate: float = 0.0

The Y translate value.

field z_translate: float = 0.0

The Z translate value.

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