Behaviour and dispatch module for graph storage backends.
Arcana supports swappable graph storage:
:ecto(default) - PostgreSQL via Ecto:memory- In-memory storage for testing- Custom module implementing this behaviour
Configuration
# config/config.exs
# Use Ecto/PostgreSQL (default)
config :arcana, :graph_store, :ecto
# With options
config :arcana, :graph_store, {:ecto, repo: MyApp.Repo}
# Custom module
config :arcana, :graph_store, MyApp.CustomGraphStore
Summary
Callbacks
Deletes all graph data for the given chunk IDs.
Deletes all graph data for a collection.
Finds all entities in a collection.
Finds entities related to the given entity within the specified depth.
Retrieves a single community by ID.
Retrieves community summaries for a collection.
Retrieves a single entity by ID.
Retrieves mentions for an entity with chunk context.
Retrieves a single relationship by ID.
Retrieves all relationships for an entity.
Lists communities with optional filtering and pagination.
Lists entities with optional filtering and pagination.
Lists relationships with optional filtering and pagination.
Persists community data for a collection.
Persists entities to the graph store.
Persists entity mentions (links between entities and chunks).
Persists relationships between entities.
Searches for chunks related to the given entity names.
Searches for entities by embedding similarity.
Functions
Returns the configured graph store backend.
Deletes graph data for the given chunk IDs using the configured backend.
Deletes all graph data for a collection using the configured backend.
Finds entities using the configured backend.
Finds related entities using the configured backend.
Gets a single community by ID using the configured backend.
Gets community summaries using the configured backend.
Gets a single entity by ID using the configured backend.
Gets mentions for an entity using the configured backend.
Gets a single relationship by ID using the configured backend.
Gets relationships for an entity using the configured backend.
Lists communities using the configured backend.
Lists entities using the configured backend.
Lists relationships using the configured backend.
Persists communities using the configured backend.
Persists entities using the configured backend.
Persists entity mentions using the configured backend.
Persists relationships using the configured backend.
Searches for chunks using the configured backend.
Searches for entities by embedding similarity using the configured backend.
Callbacks
Deletes all graph data for the given chunk IDs.
Removes mentions referencing these chunks, and cleans up orphaned entities (entities with no remaining mentions).
Deletes all graph data for a collection.
Removes all entities, relationships, mentions, and communities associated with the collection.
Finds all entities in a collection.
@callback get_community(community_id :: binary(), opts :: keyword()) :: {:ok, map()} | {:error, :not_found}
Retrieves a single community by ID.
Retrieves community summaries for a collection.
Retrieves a single entity by ID.
Retrieves mentions for an entity with chunk context.
Returns mentions with associated chunk text for display.
@callback get_relationship(relationship_id :: binary(), opts :: keyword()) :: {:ok, map()} | {:error, :not_found}
Retrieves a single relationship by ID.
Retrieves all relationships for an entity.
Returns relationships where the entity is either source or target.
Lists communities with optional filtering and pagination.
Options
:collection_id- Filter by collection (nil for all):level- Filter by hierarchy level:search- Search in summary:limit- Maximum results (default: 50):offset- Pagination offset (default: 0)
Returns communities with entity counts.
Lists entities with optional filtering and pagination.
Options
:collection_id- Filter by collection (nil for all):type- Filter by entity type:search- Search in entity name:limit- Maximum results (default: 50):offset- Pagination offset (default: 0)
Returns entities with aggregated counts (mention_count, relationship_count).
Lists relationships with optional filtering and pagination.
Options
:collection_id- Filter by collection (nil for all):type- Filter by relationship type:search- Search in entity names or type:strength- Filter by strength (:strong, :medium, :weak):limit- Maximum results (default: 50):offset- Pagination offset (default: 0)
Returns relationships with source/target entity names.
Persists community data for a collection.
Persists entities to the graph store.
Returns a map of entity names to their assigned IDs.
Persists entity mentions (links between entities and chunks).
Persists relationships between entities.
Searches for chunks related to the given entity names.
Returns scored chunk results.
Searches for entities by embedding similarity.
Returns entities whose description embeddings are most similar to the query embedding, sorted by similarity descending.
Functions
Returns the configured graph store backend.
Deletes graph data for the given chunk IDs using the configured backend.
Deletes all graph data for a collection using the configured backend.
Finds entities using the configured backend.
Gets a single community by ID using the configured backend.
Gets community summaries using the configured backend.
Gets a single entity by ID using the configured backend.
Gets mentions for an entity using the configured backend.
Gets a single relationship by ID using the configured backend.
Gets relationships for an entity using the configured backend.
Lists communities using the configured backend.
Lists entities using the configured backend.
Lists relationships using the configured backend.
Persists communities using the configured backend.
Persists entities using the configured backend.
Persists entity mentions using the configured backend.
Persists relationships using the configured backend.
Searches for chunks using the configured backend.
Searches for entities by embedding similarity using the configured backend.