# IKnowledgeGraphService

- File ID: file:1x9xhbs:iknowledgegraphservice-cs
- Path: NexusReader.UI.Shared/Services/IKnowledgeGraphService.cs
- Role: service
- Layer: frontend

## Purpose

Defines the UI-shared contract for a knowledge-graph state service: read-only state properties, events for change notifications, and async commands to update/clear state.

## Key Details

Interface is a UI-shared async service contract used to centralize knowledge-graph state and notify UI consumers via events; GraphDataDto is referenced from Application.Queries.Graph.

## Symbols

- IKnowledgeGraphService: Defines the UI-shared contract for a knowledge-graph state service: read-only state properties, events for change notifications, and async commands to update/clear state.
- CurrentGraphData(): Read-only property exposing the current graph data held by the service.
- ActiveNodeId(): Read-only property exposing the currently active/selected node id.
- IsLoading(): Read-only flag indicating whether the graph is currently loading.
- OnGraphUpdated(): Event raised when the graph data has been updated.
- OnActiveNodeChanged(): Event raised when the active node changes, providing the new node id.
- OnLoadingChanged(): Event raised when the loading state changes, providing the new boolean state.
- UpdateGraph(): Asynchronously replace or update the current graph data with newData and notify listeners.
- SetActiveNode(): Asynchronously set the active node by id and notify subscribers of the change.
- SetLoading(): Asynchronously set the loading flag and notify listeners.
- Clear(): Asynchronously clear the current graph state (reset data, active node, loading) and notify subscribers.

## Dependencies

- No resolved dependencies.

## Calls

- No resolved calls.

## Unresolved References

- dependency-target: NexusReader.Application.Queries.Graph (GraphDataDto referenced)
- interaction-target: Implementation should trigger OnGraphUpdated after updating state.
- interaction-target: Implementation should trigger OnActiveNodeChanged with nodeId after change.
- interaction-target: Implementation should trigger OnLoadingChanged with the new boolean value.
- interaction-target: Implementation should raise OnGraphUpdated/OnActiveNodeChanged/OnLoadingChanged as appropriate after clearing.

## Coverage

- Symbols: 11
- Executable symbols: 10
- Executable symbols with control flow: 10
- Grounded edges: 11
- Unresolved references: 5
- Control-flow fragments: 10
- Unresolved jumps: 0
- Unsupported constructs: 0
- Control-flow coverage: 100%
- Required diagrams: 2
- Generated diagrams: 2

## Control Flow Fragments

- CurrentGraphData: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- ActiveNodeId: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- IsLoading: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- OnGraphUpdated: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- OnActiveNodeChanged: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- OnLoadingChanged: 3 nodes, 2 edges, 0 jumps, 0 unsupported constructs
- UpdateGraph: 4 nodes, 3 edges, 0 jumps, 0 unsupported constructs
- SetActiveNode: 4 nodes, 3 edges, 0 jumps, 0 unsupported constructs
- SetLoading: 4 nodes, 3 edges, 0 jumps, 0 unsupported constructs
- Clear: 4 nodes, 3 edges, 0 jumps, 0 unsupported constructs

## Diagrams

### IKnowledgeGraphService Neighborhood

```mermaid
flowchart LR
    class_1y1hevk_iknowledgegraphservice("IKnowledgeGraphService")
    file_1x9xhbs_iknowledgegraphservice_cs("IKnowledgeGraphService")
    method_10q1pr_isloading[["IsLoading()"]]
    method_1d2tbk0_onactivenodechanged[["OnActiveNodeChanged()"]]
    method_1gtjcaz_updategraph[["UpdateGraph()"]]
    method_1qc1jbv_onloadingchanged[["OnLoadingChanged()"]]
    method_1uy10ke_clear[["Clear()"]]
    method_88y0cc_ongraphupdated[["OnGraphUpdated()"]]
    method_cho50r_activenodeid[["ActiveNodeId()"]]
    method_n5kc06_currentgraphdata[["CurrentGraphData()"]]
    method_p6r8md_setactivenode[["SetActiveNode()"]]
    method_x4s1g_setloading[["SetLoading()"]]
```

### IKnowledgeGraphService Execution Overview

```mermaid
flowchart TD
    class_1y1hevk_iknowledgegraphservice("IKnowledgeGraphService")
    method_10q1pr_isloading[["IsLoading()"]]
    method_1d2tbk0_onactivenodechanged[["OnActiveNodeChanged()"]]
    method_1gtjcaz_updategraph[["UpdateGraph()"]]
    method_1qc1jbv_onloadingchanged[["OnLoadingChanged()"]]
    method_1uy10ke_clear[["Clear()"]]
    method_88y0cc_ongraphupdated[["OnGraphUpdated()"]]
    method_cho50r_activenodeid[["ActiveNodeId()"]]
    method_n5kc06_currentgraphdata[["CurrentGraphData()"]]
    method_p6r8md_setactivenode[["SetActiveNode()"]]
    method_x4s1g_setloading[["SetLoading()"]]
    unresolved_unresolved_1un8r5w_interaction_target{"Unresolved: Implementation should trigger OnLoadingChanged with the new boolean value."}
    unresolved_unresolved_769k9d_interaction_target{"Unresolved: Implementation should raise OnGraphUpdated/OnActiveNodeChanged/OnLoadingChanged as appropriate after clearing."}
    unresolved_unresolved_awm461_interaction_target{"Unresolved: Implementation should trigger OnActiveNodeChanged with nodeId after change."}
    unresolved_unresolved_dl3x0o_interaction_target{"Unresolved: Implementation should trigger OnGraphUpdated after updating state."}
    class_1y1hevk_iknowledgegraphservice -->|contains| method_10q1pr_isloading
    class_1y1hevk_iknowledgegraphservice -->|contains| method_1d2tbk0_onactivenodechanged
    class_1y1hevk_iknowledgegraphservice -->|contains| method_1gtjcaz_updategraph
    class_1y1hevk_iknowledgegraphservice -->|contains| method_1qc1jbv_onloadingchanged
    class_1y1hevk_iknowledgegraphservice -->|contains| method_1uy10ke_clear
    class_1y1hevk_iknowledgegraphservice -->|contains| method_88y0cc_ongraphupdated
    class_1y1hevk_iknowledgegraphservice -->|contains| method_cho50r_activenodeid
    class_1y1hevk_iknowledgegraphservice -->|contains| method_n5kc06_currentgraphdata
    class_1y1hevk_iknowledgegraphservice -->|contains| method_p6r8md_setactivenode
    class_1y1hevk_iknowledgegraphservice -->|contains| method_x4s1g_setloading
    class_1y1hevk_iknowledgegraphservice -->|unresolved interaction| unresolved_unresolved_1un8r5w_interaction_target
    class_1y1hevk_iknowledgegraphservice -->|unresolved interaction| unresolved_unresolved_769k9d_interaction_target
    class_1y1hevk_iknowledgegraphservice -->|unresolved interaction| unresolved_unresolved_awm461_interaction_target
    class_1y1hevk_iknowledgegraphservice -->|unresolved interaction| unresolved_unresolved_dl3x0o_interaction_target
```

## Diagram Validation

- Status: pass
