Expand description
Vector indexes over embeddings stored as RDF literals (backends with vector functions: Turso).
An index is described in the system graph <oxilite:vectors> by the resource
<oxilite:vector/NAME> (see VectorIndex::to_quads) — the definition is data, queryable
and versioned like any other. It is realised as a table vec_name of (s, o, g, e) rows,
one per embedding literal of the indexed property, kept current by triggers on quads in
the same transaction as every write, and back-filled when it is created. A fingerprint in
oxilite_meta (vector:name) records how the table was built, so sync_statements can
tell a missing, stale or orphaned table from a current one.
knn_sql is the one nearest-neighbour statement: the SPARQL compiler
(SERVICE <oxilite:vector/NAME>), the Datalog built-in nearest and the store API all use it.
Modules§
- vocab
- IRIs of the vector vocabulary (in the
oxl:namespace).
Structs§
- Vector
Index - A vector index definition.
Enums§
- Element
Type - How vector elements are stored.
- Metric
- How distance is measured.
- Query
Vector - What a search is near.
Constants§
- DEFAULT_
GRAPH - The id of the default graph, for callers building their own statements.
- DEFAULT_
K - Default number of results.
- INDEX_
PREFIX - The IRI prefix of an index:
<oxilite:vector/NAME>names it, and is theSERVICEIRI that searches it. - MAX_K
- Most results a search may ask for.
- VECTORS_
GRAPH - The system graph holding vector index definitions.
Functions§
- built_
from_ meta - Built fingerprints by lower-case index name, from
oxilite_metarows(key, value). - definitions_
from_ quads - Definitions read from quads of
<oxilite:vectors>(other quads are ignored). - definitions_
from_ rows - Definitions read from the rows of
definitions_statement: the valid ones, and a message for each description that is not one. - definitions_
statement - The statement reading the definitions: every quad of
<oxilite:vectors>with the text of its terms (seedefinitions_from_rows). - drop_
statements - Statements dropping an index’s table, triggers and fingerprint (by lower-case name).
- find
- Finds a definition by exact name, else ignoring case.
- index_
iri <oxilite:vector/NAME>.- is_
built - Is
name’s table built from this exact definition? - knn_
ranked_ sql knn_sqlwith a 1-based rank columnr(ties broken by id), for relational frontends that carry term ids rather than computed values.- knn_sql
- The nearest-neighbour statement: rows
(s, d)— at mostkdistinct nodes (term ids), each at its smallest distance, by increasing distance then id. - parse_
vector - Parses a JSON array of numbers, the lexical form of an embedding.
- service_
index - The index a
SERVICEIRI names. - sync_
statements - Statements making the built tables match the definitions: orphans and stale tables are dropped, missing and stale ones created. Empty when everything is current.
- update_
touches_ vectors - Can this update change a vector index definition? Any triple written to
<oxilite:vectors>counts; with a variable graph, a triple counts when it could be a definition triple (a variable predicate, anoxl:predicate, orrdf:typewith a variable oroxl:class).LOAD,CLEARandDROPalways count: re-checking is one read when nothing changed.