org.llm4s.knowledgegraph.neo4j

Members list

Type members

Classlikes

Neo4j implementation of GraphStore.

Neo4j implementation of GraphStore.

Maps GraphStore operations to Cypher queries via the official Neo4j Java driver. All nodes carry the :LLM4S label for namespace isolation alongside any user-defined label stored as the llm4s_label property.

Properties round-trip as the in-memory store keeps them: strings, booleans and numbers are stored natively (a whole number as an integer, so a property filter on 42 matches as it does in memory), an array of one primitive type as a Neo4j list, and any other value (null, an object, a nested or mixed array) as JSON in the reserved llm4s_json property. Property keys starting with llm4s_ are reserved for the store: an upsertNode or upsertEdge that uses one is a Left (#2969).

Relationship types may be any string that is not empty or whitespace-only, and property keys any non-empty string, as in the other stores, except that a relationship type with a backslash is refused: a relationship type is written backtick-quoted, and a property key is passed as a parameter (#2970). The factories create the schema, and return a Left when they cannot (a user without schema rights needs an administrator to run these once):

CREATE CONSTRAINT llm4s_id_unique IF NOT EXISTS FOR (n:LLM4S) REQUIRE n.llm4s_id IS UNIQUE
CREATE INDEX llm4s_label_index IF NOT EXISTS FOR (n:LLM4S) ON (n.llm4s_label)

Connection management: each GraphStore call acquires a single session, executes the query, then closes the session — mirroring the PgVectorStore pattern. The driver (and its internal connection pool) is managed externally; pass ownsDriver = true only when this store should close the driver on close().

Thread-safety: the Neo4j Java driver is thread-safe; this class inherits that.

Value parameters

database

Target database name (default "neo4j")

driver

Neo4j Java driver instance

ownsDriver

Whether to close the driver on close() (default true)

Attributes

Companion
object
Source
Neo4jGraphStore.scala
Supertypes
trait GraphStore
class Object
trait Matchable
class Any

Attributes

Companion
class
Source
Neo4jGraphStore.scala
Supertypes
class Object
trait Matchable
class Any
Self type