Class InMemoryGraphProvider

java.lang.Object
org.episteme.core.util.persistence.InMemoryGraphProvider
All Implemented Interfaces:
GraphProvider

@AutoService(GraphProvider.class) public class InMemoryGraphProvider extends Object implements GraphProvider
In-memory implementation of GraphProvider.

This implementation is thread-safe and intended for testing and small-scale persistence needs.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • InMemoryGraphProvider

      public InMemoryGraphProvider()
  • Method Details

    • getName

      public String getName()
      Description copied from interface: GraphProvider
      Returns the unique name of this provider.
      Specified by:
      getName in interface GraphProvider
      Returns:
      the provider name.
    • save

      public <T> void save(T entity)
      Description copied from interface: GraphProvider
      Saves an entity to the persistent store.
      Specified by:
      save in interface GraphProvider
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to save
    • load

      public <T> T load(Class<T> type, Object id)
      Description copied from interface: GraphProvider
      Loads an entity from the persistent store.
      Specified by:
      load in interface GraphProvider
      Type Parameters:
      T - the type of the entity
      Parameters:
      type - the class of the entity
      id - the unique identifier of the entity
      Returns:
      the loaded entity, or null if not found
    • delete

      public <T> void delete(T entity)
      Description copied from interface: GraphProvider
      Deletes an entity from the persistent store.
      Specified by:
      delete in interface GraphProvider
      Type Parameters:
      T - the type of the entity
      Parameters:
      entity - the entity to delete
    • query

      public <T> List<T> query(Class<T> type, String query)
      Description copied from interface: GraphProvider
      Queries the persistent store for entities matching the given criteria.
      Specified by:
      query in interface GraphProvider
      Type Parameters:
      T - the type of the entities
      Parameters:
      type - the class of the entities to search for
      query - symbols or criteria for the search (implementation-specific)
      Returns:
      a list of matching entities