graflo.architecture.graph_types.index_config¶
Index and weight configuration models.
Classes¶
ABCFields
¶
Bases: ConfigBaseModel
Base model for entities that have fields.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Optional name of the entity |
fields |
list[str]
|
List of field names |
Source code in graflo/architecture/graph_types/index_config.py
Attributes¶
fields = Field(default_factory=list, description='List of field names for this entity.')
class-attribute
instance-attribute
¶
keep_vertex_name = Field(default=True, description='If True, composite field names use entity@field format; otherwise use field only.')
class-attribute
instance-attribute
¶
name = Field(default=None, description='Optional name of the entity (e.g. vertex name for composite field prefix).')
class-attribute
instance-attribute
¶
Methods:¶
cfield(x)
¶
Creates a composite field name by combining the entity name with a field name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
str
|
Field name to combine with entity name |
required |
Returns:
| Type | Description |
|---|---|
str
|
Composite field name in format "entity@field" |
Source code in graflo/architecture/graph_types/index_config.py
Index
¶
Bases: ConfigBaseModel
Configuration for database indexes.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str | None
|
Optional name of the index |
fields |
list[str]
|
List of fields to index |
unique |
bool
|
Whether the index enforces uniqueness |
type |
IndexType
|
Type of index to create |
deduplicate |
bool
|
Whether to deduplicate index entries |
sparse |
bool
|
Whether to create a sparse index |
exclude_edge_endpoints |
bool
|
Whether to exclude edge endpoints from index |
Source code in graflo/architecture/graph_types/index_config.py
Attributes¶
deduplicate = Field(default=True, description='Whether to deduplicate index entries (e.g. ArangoDB).')
class-attribute
instance-attribute
¶
exclude_edge_endpoints = Field(default=False, description='If True, do not add _from/_to to edge index (e.g. ArangoDB).')
class-attribute
instance-attribute
¶
fields = Field(default_factory=list, description='List of field names included in this index.')
class-attribute
instance-attribute
¶
name = Field(default=None, description='Optional index name. For edges, can reference a vertex name for composite fields.')
class-attribute
instance-attribute
¶
sparse = Field(default=False, description='If True, create a sparse index (exclude null/missing values).')
class-attribute
instance-attribute
¶
type = Field(default=IndexType.PERSISTENT, description='Index type (PERSISTENT, HASH, SKIPLIST, FULLTEXT).')
class-attribute
instance-attribute
¶
unique = Field(default=True, description='If True, index enforces uniqueness on the field combination.')
class-attribute
instance-attribute
¶
Methods:¶
__iter__()
¶
db_form(db_type)
¶
Convert index configuration to database-specific format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_type
|
DBType
|
Type of database (ARANGO or NEO4J) |
required |
Returns:
| Type | Description |
|---|---|
dict
|
Dictionary of index configuration in database-specific format |
Raises:
| Type | Description |
|---|---|
ValueError
|
If db_type is not supported |
Source code in graflo/architecture/graph_types/index_config.py
Weight
¶
Bases: ABCFields
Defines weight configuration for edges.
Attributes:
| Name | Type | Description |
|---|---|---|
map |
dict
|
Dictionary mapping field values to weights |
filter |
dict
|
Dictionary of filter conditions for weights |