Files
zeekayandHanzo Dev 6c28746c8b semantic: the pipeline, the stores, and the decision layer
A native Go port of semantica. This first commit is the shape rather than the
implementation: the values that move between stages, one interface per stage,
and the three stores as three interfaces because they answer three different
questions.

The decision layer is the reason the graph exists, so it is a package of its
own rather than a corner of the graph code, and provenance keeps the PROV-O
vocabulary verbatim so the record joins other PROV data untranslated.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-05 23:14:11 -07:00

33 lines
1018 B
Go

// Package store holds the three ways a graph is kept: by similarity, by
// edge, and by assertion. They are separate interfaces because they answer
// separate questions, and a deployment may back them with one engine or three.
package store
import "context"
// Match is a neighbour and how near it is.
type Match struct {
ID string
Score float64
Meta map[string]any
}
// Vector answers "what is like this".
type Vector interface {
Put(ctx context.Context, id string, v []float32, meta map[string]any) error
Near(ctx context.Context, v []float32, k int) ([]Match, error)
}
// Graph answers "what is connected to this".
type Graph interface {
Node(ctx context.Context, id string, props map[string]any) error
Edge(ctx context.Context, from, to, label string) error
Out(ctx context.Context, id string) ([]string, error)
}
// Triple answers "what was asserted".
type Triple interface {
Assert(ctx context.Context, s, p, o string) error
Match(ctx context.Context, s, p, o string) ([][3]string, error)
}