Neo4j Rag Proposition Repository
Reference proposition store that backs persistence through Embabel's NamedEntityDataRepository SPI — which is Neo4j-backed at runtime in a typical deployment, hence the descriptive name — without ever importing a graph driver or emitting Cypher from production code. The store stays hexagonal: it talks to the SPI port, and the consuming application supplies whatever concrete (Neo4j or otherwise) implementation it likes.
Composition
Propositions are not native graph nodes — the entity SPI stores NamedEntityData, not Proposition. This adapter therefore composes two collaborators:
crud: a supplementary durable PropositionStore that actually holds the Proposition objects (CRUD, identity, the composable query). All base-port members delegate here.
entityRepository: the entity/vector/relationship backend the consumer supplies. It backs the separate entity-axis projection/reconciliation path; it is held here as a real collaborator but is deliberately never exposed in this store's public signatures, so no SPI-only type leaks into the proposition contract.
Declared capabilities (honest fragments only)
The store declares exactly PropositionStore and VectorSearchCapable. Every VectorSearchCapable member — both findSimilarWithScores overloads and findClusters — is forwarded to the supplementary store when that store is itself vector-capable, so any backend-pushed-down filtering or clustering override on the supplementary store is honoured rather than bypassed. When the supplementary store is not vector-capable, every vector member degrades to an empty result. None of these paths is ever wired to the SPI's entity vectorSearch, which operates on a different axis (entities, not propositions) and would be semantically wrong.
Why graph and temporal capabilities are omitted
The proposition capability fragments (GraphTraversalCapable for the abstraction hierarchy, TemporalQueryCapable for time-window/effective-confidence queries) are proposition-scoped, whereas the NamedEntityDataRepository SPI is entity-scoped — the proposition-vs-entity axis mismatch. The SPI exposes only 1-hop entity navigation (findRelated) and no temporal surface, so neither proposition fragment can be served honestly here. Declaring a fragment this store cannot back would make a caller's supportsGraph report true while results came back empty — dishonest. Omission is the honest signal: a caller using PropositionStoreTemplate sees supportsGraph == false and gets empty, typed results from the graph/temporal paths, never an exception. Full multi-hop / path-between traversal is deferred to a future native graph-query adapter.
Parameters
the supplementary durable proposition store backing all CRUD and query operations
the entity/relationship/vector backend supplied by the consumer; held for the entity-axis projection path and never surfaced in this store's public signatures
Properties
Whether this particular instance can actually run vector search. Implementing the interface is a type-level promise; this is the runtime truth. A store that can be wired without an embedder (so it satisfies the type but has nothing to embed with) should override this to report whether it was given one. Lets a caller — e.g. PropositionStoreTemplate.supportsVector — distinguish "configured for vectors" from "vector search will quietly return empty".
Functions
Append provenance to a proposition (deduplicated); never removes existing entries.
Remove all provenance from a proposition.
Get the total count of propositions.
Count the propositions matching query. The default materialises query's results and counts them; a backend that can count server-side (e.g. the graph store) overrides to avoid loading the rows just to size them.
Get all propositions.
Find propositions in the given context.
Java-friendly variant of findByContextId that accepts a plain string.
Find all propositions that mention a specific entity.
Find all propositions grounded by a specific chunk.
Find a proposition by its ID.
Find propositions at or above the specified abstraction level. Level 0 = raw observations, 1+ = abstractions.
Find all propositions with the given status.
Proposition clustering. Forwards to the supplementary store so any backend-native clustering override is honoured. Degrades to empty when the supplementary store is not vector-capable.
All pinned propositions in contextId.
Find propositions similar to the given text using vector similarity.
Proposition vector similarity search. Forwards to the supplementary store when it is vector-capable; degrades gracefully to an empty list otherwise. Never touches the entity-axis SPI vector search, which operates on a different axis.
Filtered similarity search. Forwards to the supplementary store so any backend that pushes the query filter down to its own index gets credit for it, rather than falling back to the interface default that re-filters generic results. Degrades to empty when the supplementary store is not vector-capable.
Find propositions in base's scope whose text contains at least one of tokens (case-insensitive), ranked by how many distinct tokens each contains (descending), ties broken by base's ordering. At most limit results; empty tokens or non-positive limit returns nothing.
Pin a proposition so it resists reclamation: pinned propositions are skipped by the decay collector and the sweep policy, are decay-exempt in the default status policy, and are not auto-retired by contradiction resolution.
The provenance entries of a proposition, or an empty list if it has none or does not exist.
Disambiguates the diamond between VectorSearchCapable.query and PropositionStore.query by forwarding to the supplementary store, giving the composed type a single unambiguous query.
Save a proposition. If a proposition with the same ID exists, it will be replaced.
Save multiple propositions.
Save multiple propositions and report which stored proposition each one landed on.
Authoritatively set a proposition's provenance to exactly entries, removing any not listed.
Refresh Proposition.lastAccessed to now for ids — the read-side reinforcement that lets a DECAYING proposition's decay anchor (see Proposition.effectiveConfidenceAt) track actual use rather than only content edits. Best-effort and silent about unknown ids (a stale eager id that has since been deleted is not an error).
Clear a proposition's pin, returning it to normal reclamation.