Class FileGraphCorpus

java.lang.Object
com.tnsai.intelligence.rag.graph.FileGraphCorpus

public final class FileGraphCorpus extends Object
Binding-time FILE chunks available to the in-memory graph provider.

RoleRagBinding registers the documents it already loaded so GRAPH construction does not walk the filesystem a second time. Tests and standalone providers may register a corpus directly.

Since:
0.14.0
  • Method Details

    • register

      public static void register(Class<?> roleClass, List<FileGraphCorpus.Document> documents)
      Registers the FILE corpus associated with a Role class.

      This compatibility overload replaces an earlier corpus for the same key. Standalone callers that need exact-owner lifecycle cleanup should use registerOwned(Key, List).

      Parameters:
      roleClass - Role runtime class
      documents - ingested FILE chunks
    • register

      public static void register(FileGraphCorpus.Key key, List<FileGraphCorpus.Document> documents)
      Registers the FILE corpus for one binding identity.

      This compatibility overload replaces an earlier corpus for the same key. The replaced corpus is retired before this method returns.

      Parameters:
      key - Role class plus complete binding identity
      documents - ingested FILE chunks
    • registerOwned

      public static FileGraphCorpus.Registration registerOwned(FileGraphCorpus.Key key, List<FileGraphCorpus.Document> documents)
      Registers a corpus and returns its exact-owner lifecycle handle.

      The handle removes only the corpus instance created by this call. A delayed or repeated close therefore cannot delete a later registration that happens to reuse the same logical key.

      Parameters:
      key - complete binding identity
      documents - immutable binding-time FILE chunks
      Returns:
      exact-owner registration handle
      Since:
      0.15.0
    • registerOwnedSuperseding

      public static FileGraphCorpus.Registration registerOwnedSuperseding(FileGraphCorpus.Key key, List<FileGraphCorpus.Document> documents)
      Registers a corpus in place of the one registered for the same key, and returns its exact-owner lifecycle handle.

      The replaced corpus is not retired here. Its own registration still retires it when closed, and that close leaves this corpus registered. A reloaded binding uses this while the binding it replaces still serves calls that started before the reload.

      Parameters:
      key - complete binding identity
      documents - immutable binding-time FILE chunks
      Returns:
      exact-owner registration handle
      Since:
      0.18.0
    • forget

      public static void forget(Class<?> roleClass)
      Drops every corpus for a Role class.
      Parameters:
      roleClass - Role runtime class
    • forget

      public static void forget(FileGraphCorpus.Key key)
      Drops one exact corpus registration without retiring another binding on the same Role class.
      Parameters:
      key - complete corpus identity
      Since:
      0.17.4
    • documents

      public static List<FileGraphCorpus.Document> documents(Class<?> roleClass)
      Returns the registered corpus, or an empty list when none was stored.

      When a binding scope is active for roleClass, that binding's documents are returned. Otherwise the empty-fingerprint registration is used.

      Parameters:
      roleClass - Role runtime class
      Returns:
      immutable chunk list
    • enter

      public static void enter(FileGraphCorpus.Key key)
      Pins the binding identity for provider open on this thread.
      Parameters:
      key - binding identity
    • leave

      public static void leave()
      Clears the thread-local binding identity.