Documentation
¶
Index ¶
- Constants
- type BatchEdgeOperation
- type BatchGraphOperation
- type BatchNodeOperation
- type BatchResult
- type Community
- type EdgePrediction
- type ExportFormat
- type GEXFAttValue
- type GEXFAttr
- type GEXFAttrs
- type GEXFDocument
- type GEXFEdge
- type GEXFEdges
- type GEXFGraph
- type GEXFMeta
- type GEXFNode
- type GEXFNodes
- type GraphEdge
- type GraphFilter
- type GraphMLData
- type GraphMLDocument
- type GraphMLEdge
- type GraphMLGraph
- type GraphMLKey
- type GraphMLNode
- type GraphNode
- type GraphResult
- type GraphStatistics
- type GraphStore
- func (g *GraphStore) CommunityDetection(ctx context.Context) ([]Community, error)
- func (g *GraphStore) CompactIRI(ctx context.Context, value string) (string, error)
- func (g *GraphStore) Connected(ctx context.Context, nodeID1, nodeID2 string, maxDepth int) (bool, error)
- func (g *GraphStore) DeleteEdge(ctx context.Context, edgeID string) error
- func (g *GraphStore) DeleteEdgesBatch(ctx context.Context, edgeIDs []string) (*BatchResult, error)
- func (g *GraphStore) DeleteNamespace(ctx context.Context, prefix string) error
- func (g *GraphStore) DeleteNode(ctx context.Context, nodeID string) error
- func (g *GraphStore) DeleteNodesBatch(ctx context.Context, nodeIDs []string) (*BatchResult, error)
- func (g *GraphStore) DeleteTriple(ctx context.Context, triple RDFTriple) error
- func (g *GraphStore) DeleteTriples(ctx context.Context, pattern TriplePattern) (int, error)
- func (g *GraphStore) EnableHNSWIndex(dimensions int) error
- func (g *GraphStore) ExecuteBatch(ctx context.Context, ops *BatchGraphOperation) (*BatchResult, error)
- func (g *GraphStore) ExecuteBatchTx(ctx context.Context, tx *sql.Tx, ops *BatchGraphOperation) (*BatchResult, error)
- func (g *GraphStore) ExecuteSPARQL(ctx context.Context, query string) (*SPARQLResult, error)
- func (g *GraphStore) ExpandIRI(ctx context.Context, value string) (string, error)
- func (g *GraphStore) ExplainTriple(ctx context.Context, tripleID string) (*RDFSInferenceExplanation, error)
- func (g *GraphStore) ExplainTripleTrace(ctx context.Context, tripleID string, depth int) ([]RDFSInferenceTraceEntry, error)
- func (g *GraphStore) Export(ctx context.Context, writer io.Writer, format ExportFormat) error
- func (g *GraphStore) ExportGEXF(ctx context.Context, writer io.Writer) error
- func (g *GraphStore) ExportGraphML(ctx context.Context, writer io.Writer) error
- func (g *GraphStore) ExportJSON(ctx context.Context, writer io.Writer) error
- func (g *GraphStore) ExportRDF(ctx context.Context, writer io.Writer, format RDFFormat) error
- func (g *GraphStore) FindTriples(ctx context.Context, pattern TriplePattern) ([]RDFTriple, error)
- func (g *GraphStore) GetAllNodes(ctx context.Context, filter *GraphFilter) ([]*GraphNode, error)
- func (g *GraphStore) GetEdges(ctx context.Context, nodeID string, direction string) ([]*GraphEdge, error)
- func (g *GraphStore) GetEdgesBatch(ctx context.Context, edgeIDs []string) ([]*GraphEdge, error)
- func (g *GraphStore) GetGraphStatistics(ctx context.Context) (*GraphStatistics, error)
- func (g *GraphStore) GetNode(ctx context.Context, nodeID string) (*GraphNode, error)
- func (g *GraphStore) GetNodesBatch(ctx context.Context, nodeIDs []string) ([]*GraphNode, error)
- func (g *GraphStore) GetTriple(ctx context.Context, id string) (*RDFTriple, error)
- func (g *GraphStore) GraphVectorSearch(ctx context.Context, startNodeID string, vector []float32, ...) ([]*HybridResult, error)
- func (g *GraphStore) HNSWHybridSearch(ctx context.Context, query *HybridQuery) ([]*HybridResult, error)
- func (g *GraphStore) HNSWSearch(ctx context.Context, query []float32, k int, threshold float64) ([]*HybridResult, error)
- func (g *GraphStore) HybridSearch(ctx context.Context, query *HybridQuery) ([]*HybridResult, error)
- func (g *GraphStore) Import(ctx context.Context, reader io.Reader, format ExportFormat) error
- func (g *GraphStore) ImportGEXF(ctx context.Context, reader io.Reader) error
- func (g *GraphStore) ImportGraphML(ctx context.Context, reader io.Reader) error
- func (g *GraphStore) ImportJSON(ctx context.Context, reader io.Reader) error
- func (g *GraphStore) ImportRDF(ctx context.Context, reader io.Reader, format RDFFormat) (int, error)
- func (g *GraphStore) InitGraphSchema(ctx context.Context) error
- func (g *GraphStore) ListNamespaces(ctx context.Context) ([]Namespace, error)
- func (g *GraphStore) Neighbors(ctx context.Context, nodeID string, opts TraversalOptions) ([]*GraphNode, error)
- func (g *GraphStore) PageRank(ctx context.Context, iterations int, dampingFactor float64) ([]PageRankResult, error)
- func (g *GraphStore) PredictEdges(ctx context.Context, nodeID string, topK int) ([]EdgePrediction, error)
- func (g *GraphStore) RefreshRDFSInferences(ctx context.Context) (*RDFSInferenceRefreshResult, error)
- func (g *GraphStore) ShortestPath(ctx context.Context, fromID, toID string) (*PathResult, error)
- func (g *GraphStore) SimilarityInGraph(ctx context.Context, nodeID string, opts core.SearchOptions) ([]*HybridResult, error)
- func (g *GraphStore) Subgraph(ctx context.Context, nodeIDs []string) (*GraphResult, error)
- func (g *GraphStore) SyncDeletedNodeIDs(_ context.Context, nodeIDs []string)
- func (g *GraphStore) SyncUpsertedNodes(_ context.Context, nodes []*GraphNode)
- func (g *GraphStore) UpsertEdge(ctx context.Context, edge *GraphEdge) error
- func (g *GraphStore) UpsertEdgesBatch(ctx context.Context, edges []*GraphEdge) (*BatchResult, error)
- func (g *GraphStore) UpsertNamespace(ctx context.Context, ns Namespace) error
- func (g *GraphStore) UpsertNode(ctx context.Context, node *GraphNode) error
- func (g *GraphStore) UpsertNodesBatch(ctx context.Context, nodes []*GraphNode) (*BatchResult, error)
- func (g *GraphStore) UpsertTriple(ctx context.Context, triple *RDFTriple) error
- func (g *GraphStore) UpsertTriplesBatch(ctx context.Context, triples []*RDFTriple) (*BatchResult, error)
- type HNSWGraphIndex
- type HybridQuery
- type HybridResult
- type HybridWeights
- type Namespace
- type PageRankResult
- type PathResult
- type RDFFormat
- type RDFSInferenceExplanation
- type RDFSInferenceRefreshResult
- type RDFSInferenceTraceEntry
- type RDFTerm
- type RDFTriple
- type SPARQLResult
- type SimpleHNSW
- type TraversalOptions
- type TriplePattern
Constants ¶
const ( // RDFTermIRI represents an IRI/resource term. RDFTermIRI = "iri" // RDFTermBlankNode represents a blank node term. RDFTermBlankNode = "blank_node" // RDFTermLiteral represents a literal term. RDFTermLiteral = "literal" )
const ( // SPARQLQuerySelect executes a tabular SELECT query. SPARQLQuerySelect = "select" // SPARQLQueryAsk executes a boolean ASK query. SPARQLQueryAsk = "ask" // SPARQLQueryConstruct executes a graph-producing CONSTRUCT query. SPARQLQueryConstruct = "construct" // SPARQLQueryDescribe executes a graph-producing DESCRIBE query. SPARQLQueryDescribe = "describe" // SPARQLQueryInsertData executes an INSERT DATA update. SPARQLQueryInsertData = "insert_data" // SPARQLQueryDeleteData executes a DELETE DATA update. SPARQLQueryDeleteData = "delete_data" // SPARQLQueryDeleteWhere executes a DELETE WHERE update. SPARQLQueryDeleteWhere = "delete_where" // SPARQLQueryModify executes INSERT ... WHERE / DELETE ... INSERT ... WHERE style updates. SPARQLQueryModify = "modify" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchEdgeOperation ¶
type BatchEdgeOperation struct {
Edges []*GraphEdge
}
BatchEdgeOperation represents a batch operation for edges
type BatchGraphOperation ¶
type BatchGraphOperation struct {
NodeUpserts []*GraphNode
NodeDeletes []string
EdgeUpserts []*GraphEdge
EdgeDeletes []string
}
BatchGraphOperation allows multiple graph operations in a single transaction
type BatchNodeOperation ¶
type BatchNodeOperation struct {
Nodes []*GraphNode
}
BatchNodeOperation represents a batch operation for nodes
type BatchResult ¶
BatchResult contains the results of a batch operation
type Community ¶
type Community struct {
ID int `json:"id"`
Nodes []string `json:"nodes"`
Score float64 `json:"score"` // Modularity score
}
Community represents a detected community of nodes
type EdgePrediction ¶
type EdgePrediction struct {
FromNodeID string `json:"from_node_id"`
ToNodeID string `json:"to_node_id"`
Score float64 `json:"score"`
Method string `json:"method"`
}
EdgePrediction represents a predicted edge with confidence score
type ExportFormat ¶
type ExportFormat string
ExportFormat represents supported export formats
const ( FormatGraphML ExportFormat = "graphml" FormatGEXF ExportFormat = "gexf" FormatJSON ExportFormat = "json" )
func DetectFormat ¶
func DetectFormat(reader io.Reader) (ExportFormat, error)
DetectFormat attempts to detect the format of the input
type GEXFAttValue ¶
GEXFAttValue represents a GEXF attribute value
type GEXFAttr ¶
type GEXFAttr struct {
ID string `xml:"id,attr"`
Title string `xml:"title,attr"`
Type string `xml:"type,attr"`
}
GEXFAttr represents a GEXF attribute
type GEXFDocument ¶
type GEXFDocument struct {
XMLName xml.Name `xml:"gexf"`
XMLNS string `xml:"xmlns,attr"`
Version string `xml:"version,attr"`
Meta GEXFMeta `xml:"meta"`
Graph GEXFGraph `xml:"graph"`
}
GEXFDocument represents a GEXF document
type GEXFEdge ¶
type GEXFEdge struct {
ID string `xml:"id,attr"`
Source string `xml:"source,attr"`
Target string `xml:"target,attr"`
Weight float64 `xml:"weight,attr,omitempty"`
Type string `xml:"type,attr,omitempty"`
}
GEXFEdge represents a GEXF edge
type GEXFEdges ¶
type GEXFEdges struct {
Edges []GEXFEdge `xml:"edge"`
}
GEXFEdges represents GEXF edges container
type GEXFGraph ¶
type GEXFGraph struct {
Mode string `xml:"mode,attr"`
DefaultEdgeType string `xml:"defaultedgetype,attr"`
Attributes GEXFAttrs `xml:"attributes"`
Nodes GEXFNodes `xml:"nodes"`
Edges GEXFEdges `xml:"edges"`
}
GEXFGraph represents a GEXF graph
type GEXFNode ¶
type GEXFNode struct {
ID string `xml:"id,attr"`
Label string `xml:"label,attr"`
AttValues []GEXFAttValue `xml:"attvalues>attvalue"`
}
GEXFNode represents a GEXF node
type GEXFNodes ¶
type GEXFNodes struct {
Nodes []GEXFNode `xml:"node"`
}
GEXFNodes represents GEXF nodes container
type GraphEdge ¶
type GraphEdge struct {
ID string `json:"id"`
FromNodeID string `json:"from_node_id"`
ToNodeID string `json:"to_node_id"`
EdgeType string `json:"edge_type,omitempty"`
Weight float64 `json:"weight"`
Properties map[string]interface{} `json:"properties,omitempty"`
Vector []float32 `json:"vector,omitempty"` // Optional edge embedding
CreatedAt time.Time `json:"created_at"`
}
GraphEdge represents a directed edge between two nodes
type GraphFilter ¶
type GraphFilter struct {
NodeTypes []string `json:"node_types,omitempty"`
EdgeTypes []string `json:"edge_types,omitempty"`
MaxDepth int `json:"max_depth,omitempty"`
}
GraphFilter defines filtering options for graph queries
type GraphMLData ¶
GraphMLData represents GraphML data
type GraphMLDocument ¶
type GraphMLDocument struct {
XMLName xml.Name `xml:"graphml"`
XMLNS string `xml:"xmlns,attr"`
Keys []GraphMLKey `xml:"key"`
Graph GraphMLGraph `xml:"graph"`
}
GraphMLDocument represents a GraphML document
type GraphMLEdge ¶
type GraphMLEdge struct {
ID string `xml:"id,attr"`
Source string `xml:"source,attr"`
Target string `xml:"target,attr"`
Data []GraphMLData `xml:"data"`
}
GraphMLEdge represents a GraphML edge
type GraphMLGraph ¶
type GraphMLGraph struct {
ID string `xml:"id,attr"`
EdgeDefault string `xml:"edgedefault,attr"`
Nodes []GraphMLNode `xml:"node"`
Edges []GraphMLEdge `xml:"edge"`
}
GraphMLGraph represents a GraphML graph
type GraphMLKey ¶
type GraphMLKey struct {
ID string `xml:"id,attr"`
For string `xml:"for,attr"`
AttrName string `xml:"attr.name,attr"`
AttrType string `xml:"attr.type,attr"`
}
GraphMLKey represents a GraphML key definition
type GraphMLNode ¶
type GraphMLNode struct {
ID string `xml:"id,attr"`
Data []GraphMLData `xml:"data"`
}
GraphMLNode represents a GraphML node
type GraphNode ¶
type GraphNode struct {
ID string `json:"id"`
Vector []float32 `json:"vector"`
Content string `json:"content,omitempty"`
NodeType string `json:"node_type,omitempty"`
Properties map[string]interface{} `json:"properties,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
GraphNode represents a node in the graph with vector embedding
type GraphResult ¶
GraphResult represents a subgraph or query result
type GraphStatistics ¶
type GraphStatistics struct {
NodeCount int `json:"node_count"`
EdgeCount int `json:"edge_count"`
AverageDegree float64 `json:"average_degree"`
Density float64 `json:"density"`
ConnectedComponents int `json:"connected_components"`
}
GraphStatistics represents overall graph statistics
type GraphStore ¶
type GraphStore struct {
// contains filtered or unexported fields
}
GraphStore provides graph operations on top of the vector store
func NewGraphStore ¶
func NewGraphStore(s *core.SQLiteStore) *GraphStore
NewGraphStore creates a new graph store from a SQLite store
func (*GraphStore) CommunityDetection ¶
func (g *GraphStore) CommunityDetection(ctx context.Context) ([]Community, error)
CommunityDetection performs community detection using the Louvain method Optimized to reduce DB queries.
func (*GraphStore) CompactIRI ¶ added in v2.16.0
CompactIRI compacts an IRI using the longest matching namespace prefix when available.
func (*GraphStore) Connected ¶
func (g *GraphStore) Connected(ctx context.Context, nodeID1, nodeID2 string, maxDepth int) (bool, error)
Connected checks if two nodes are connected within a given depth
func (*GraphStore) DeleteEdge ¶
func (g *GraphStore) DeleteEdge(ctx context.Context, edgeID string) error
DeleteEdge removes an edge from the graph
func (*GraphStore) DeleteEdgesBatch ¶
func (g *GraphStore) DeleteEdgesBatch(ctx context.Context, edgeIDs []string) (*BatchResult, error)
DeleteEdgesBatch deletes multiple edges in a single transaction
func (*GraphStore) DeleteNamespace ¶ added in v2.16.0
func (g *GraphStore) DeleteNamespace(ctx context.Context, prefix string) error
DeleteNamespace removes one user-defined namespace mapping.
func (*GraphStore) DeleteNode ¶
func (g *GraphStore) DeleteNode(ctx context.Context, nodeID string) error
DeleteNode removes a node and all its edges
func (*GraphStore) DeleteNodesBatch ¶
func (g *GraphStore) DeleteNodesBatch(ctx context.Context, nodeIDs []string) (*BatchResult, error)
DeleteNodesBatch deletes multiple nodes in a single transaction
func (*GraphStore) DeleteTriple ¶ added in v2.16.0
func (g *GraphStore) DeleteTriple(ctx context.Context, triple RDFTriple) error
DeleteTriple removes one RDF triple/quad by its normalized content.
func (*GraphStore) DeleteTriples ¶ added in v2.16.0
func (g *GraphStore) DeleteTriples(ctx context.Context, pattern TriplePattern) (int, error)
DeleteTriples removes all triples matched by the given pattern.
func (*GraphStore) EnableHNSWIndex ¶
func (g *GraphStore) EnableHNSWIndex(dimensions int) error
EnableHNSWIndex enables HNSW indexing for the graph store
func (*GraphStore) ExecuteBatch ¶
func (g *GraphStore) ExecuteBatch(ctx context.Context, ops *BatchGraphOperation) (*BatchResult, error)
ExecuteBatch executes multiple graph operations in a single transaction
func (*GraphStore) ExecuteBatchTx ¶ added in v2.14.1
func (g *GraphStore) ExecuteBatchTx(ctx context.Context, tx *sql.Tx, ops *BatchGraphOperation) (*BatchResult, error)
ExecuteBatchTx applies a batch of graph operations inside an existing transaction.
func (*GraphStore) ExecuteSPARQL ¶ added in v2.16.0
func (g *GraphStore) ExecuteSPARQL(ctx context.Context, query string) (*SPARQLResult, error)
ExecuteSPARQL runs a practical SPARQL SELECT/ASK subset against the embedded RDF layer.
func (*GraphStore) ExpandIRI ¶ added in v2.16.0
ExpandIRI expands a compact IRI using registered namespaces when possible.
func (*GraphStore) ExplainTriple ¶ added in v2.16.0
func (g *GraphStore) ExplainTriple(ctx context.Context, tripleID string) (*RDFSInferenceExplanation, error)
ExplainTriple returns whether a triple is explicit or inferred and its immediate provenance.
func (*GraphStore) ExplainTripleTrace ¶ added in v2.16.0
func (g *GraphStore) ExplainTripleTrace(ctx context.Context, tripleID string, depth int) ([]RDFSInferenceTraceEntry, error)
ExplainTripleTrace recursively expands provenance for a triple into a flattened trace list.
func (*GraphStore) Export ¶
func (g *GraphStore) Export(ctx context.Context, writer io.Writer, format ExportFormat) error
Export exports the graph in the specified format
func (*GraphStore) ExportGEXF ¶
ExportGEXF exports the graph to GEXF format
func (*GraphStore) ExportGraphML ¶
ExportGraphML exports the graph to GraphML format
func (*GraphStore) ExportJSON ¶
ExportJSON exports the graph to JSON format
func (*GraphStore) ExportRDF ¶ added in v2.16.0
ExportRDF writes triples in the requested RDF format.
func (*GraphStore) FindTriples ¶ added in v2.16.0
func (g *GraphStore) FindTriples(ctx context.Context, pattern TriplePattern) ([]RDFTriple, error)
FindTriples queries triples by pattern.
func (*GraphStore) GetAllNodes ¶
func (g *GraphStore) GetAllNodes(ctx context.Context, filter *GraphFilter) ([]*GraphNode, error)
GetAllNodes retrieves all nodes with optional filtering
func (*GraphStore) GetEdges ¶
func (g *GraphStore) GetEdges(ctx context.Context, nodeID string, direction string) ([]*GraphEdge, error)
GetEdges retrieves edges for a node
func (*GraphStore) GetEdgesBatch ¶
GetEdgesBatch retrieves multiple edges by their IDs
func (*GraphStore) GetGraphStatistics ¶
func (g *GraphStore) GetGraphStatistics(ctx context.Context) (*GraphStatistics, error)
GetGraphStatistics computes statistics about the graph
func (*GraphStore) GetNodesBatch ¶
GetNodesBatch retrieves multiple nodes by their IDs
func (*GraphStore) GraphVectorSearch ¶
func (g *GraphStore) GraphVectorSearch(ctx context.Context, startNodeID string, vector []float32, opts TraversalOptions) ([]*HybridResult, error)
GraphVectorSearch performs vector search within a graph neighborhood
func (*GraphStore) HNSWHybridSearch ¶
func (g *GraphStore) HNSWHybridSearch(ctx context.Context, query *HybridQuery) ([]*HybridResult, error)
HNSWHybridSearch combines HNSW search with graph proximity
func (*GraphStore) HNSWSearch ¶
func (g *GraphStore) HNSWSearch(ctx context.Context, query []float32, k int, threshold float64) ([]*HybridResult, error)
HNSWSearch performs HNSW-accelerated vector search
func (*GraphStore) HybridSearch ¶
func (g *GraphStore) HybridSearch(ctx context.Context, query *HybridQuery) ([]*HybridResult, error)
HybridSearch performs a combined vector and graph search
func (*GraphStore) Import ¶
func (g *GraphStore) Import(ctx context.Context, reader io.Reader, format ExportFormat) error
Import imports a graph in the specified format
func (*GraphStore) ImportGEXF ¶
ImportGEXF imports a graph from GEXF format
func (*GraphStore) ImportGraphML ¶
ImportGraphML imports a graph from GraphML format
func (*GraphStore) ImportJSON ¶
ImportJSON imports a graph from JSON format
func (*GraphStore) ImportRDF ¶ added in v2.16.0
func (g *GraphStore) ImportRDF(ctx context.Context, reader io.Reader, format RDFFormat) (int, error)
ImportRDF parses and stores triples from supported RDF serializations.
func (*GraphStore) InitGraphSchema ¶
func (g *GraphStore) InitGraphSchema(ctx context.Context) error
InitGraphSchema creates the graph tables if they don't exist
func (*GraphStore) ListNamespaces ¶ added in v2.16.0
func (g *GraphStore) ListNamespaces(ctx context.Context) ([]Namespace, error)
ListNamespaces returns built-in and user-defined namespaces.
func (*GraphStore) Neighbors ¶
func (g *GraphStore) Neighbors(ctx context.Context, nodeID string, opts TraversalOptions) ([]*GraphNode, error)
Neighbors performs a breadth-first search to find neighboring nodes
func (*GraphStore) PageRank ¶
func (g *GraphStore) PageRank(ctx context.Context, iterations int, dampingFactor float64) ([]PageRankResult, error)
PageRank calculates PageRank scores for all nodes in the graph Optimized to load only topology (IDs and Edges) instead of full node objects.
func (*GraphStore) PredictEdges ¶
func (g *GraphStore) PredictEdges(ctx context.Context, nodeID string, topK int) ([]EdgePrediction, error)
PredictEdges predicts potential edges using various methods
func (*GraphStore) RefreshRDFSInferences ¶ added in v2.16.0
func (g *GraphStore) RefreshRDFSInferences(ctx context.Context) (*RDFSInferenceRefreshResult, error)
RefreshRDFSInferences recomputes and persists inferred triples using an RDFS-lite ruleset.
func (*GraphStore) ShortestPath ¶
func (g *GraphStore) ShortestPath(ctx context.Context, fromID, toID string) (*PathResult, error)
ShortestPath finds the shortest path between two nodes using BFS
func (*GraphStore) SimilarityInGraph ¶
func (g *GraphStore) SimilarityInGraph(ctx context.Context, nodeID string, opts core.SearchOptions) ([]*HybridResult, error)
SimilarityInGraph finds nodes similar to a given node within the graph
func (*GraphStore) Subgraph ¶
func (g *GraphStore) Subgraph(ctx context.Context, nodeIDs []string) (*GraphResult, error)
Subgraph extracts a subgraph containing specified nodes and their connections
func (*GraphStore) SyncDeletedNodeIDs ¶ added in v2.14.1
func (g *GraphStore) SyncDeletedNodeIDs(_ context.Context, nodeIDs []string)
SyncDeletedNodeIDs removes committed graph-node deletions from the optional HNSW index.
func (*GraphStore) SyncUpsertedNodes ¶ added in v2.14.1
func (g *GraphStore) SyncUpsertedNodes(_ context.Context, nodes []*GraphNode)
SyncUpsertedNodes updates the optional graph HNSW index after nodes were committed through ExecuteBatchTx.
func (*GraphStore) UpsertEdge ¶
func (g *GraphStore) UpsertEdge(ctx context.Context, edge *GraphEdge) error
UpsertEdge inserts or updates an edge in the graph
func (*GraphStore) UpsertEdgesBatch ¶
func (g *GraphStore) UpsertEdgesBatch(ctx context.Context, edges []*GraphEdge) (*BatchResult, error)
UpsertEdgesBatch inserts or updates multiple edges in a single transaction
func (*GraphStore) UpsertNamespace ¶ added in v2.16.0
func (g *GraphStore) UpsertNamespace(ctx context.Context, ns Namespace) error
UpsertNamespace stores or replaces one namespace mapping.
func (*GraphStore) UpsertNode ¶
func (g *GraphStore) UpsertNode(ctx context.Context, node *GraphNode) error
UpsertNode inserts or updates a node in the graph
func (*GraphStore) UpsertNodesBatch ¶
func (g *GraphStore) UpsertNodesBatch(ctx context.Context, nodes []*GraphNode) (*BatchResult, error)
UpsertNodesBatch inserts or updates multiple nodes in a single transaction
func (*GraphStore) UpsertTriple ¶ added in v2.16.0
func (g *GraphStore) UpsertTriple(ctx context.Context, triple *RDFTriple) error
UpsertTriple writes one RDF triple/quad and mirrors it into the property graph tables.
func (*GraphStore) UpsertTriplesBatch ¶ added in v2.16.0
func (g *GraphStore) UpsertTriplesBatch(ctx context.Context, triples []*RDFTriple) (*BatchResult, error)
UpsertTriplesBatch writes multiple RDF triples/quads.
type HNSWGraphIndex ¶
type HNSWGraphIndex struct {
// contains filtered or unexported fields
}
HNSWGraphIndex provides HNSW-accelerated graph searches
type HybridQuery ¶
type HybridQuery struct {
Vector []float32 `json:"vector,omitempty"`
StartNodeID string `json:"start_node_id,omitempty"`
CenterNodes []string `json:"center_nodes,omitempty"`
GraphFilter *GraphFilter `json:"graph_filter,omitempty"`
TopK int `json:"top_k"`
Threshold float64 `json:"threshold,omitempty"`
VectorThreshold float64 `json:"vector_threshold,omitempty"`
TotalThreshold float64 `json:"total_threshold,omitempty"`
VectorWeight float64 `json:"vector_weight"`
GraphWeight float64 `json:"graph_weight"`
Weights HybridWeights `json:"weights"`
}
HybridQuery represents a combined vector and graph query
type HybridResult ¶
type HybridResult struct {
Node *GraphNode `json:"node"`
VectorScore float64 `json:"vector_score"`
GraphScore float64 `json:"graph_score"`
CombinedScore float64 `json:"combined_score"`
TotalScore float64 `json:"total_score"`
Path []string `json:"path,omitempty"` // Path from start node
Distance int `json:"distance"` // Graph distance from start
}
HybridResult represents a result from hybrid search
type HybridWeights ¶
type HybridWeights struct {
VectorWeight float64 `json:"vector_weight"` // Weight for vector similarity
GraphWeight float64 `json:"graph_weight"` // Weight for graph proximity
EdgeWeight float64 `json:"edge_weight"` // Weight for edge strength
}
HybridWeights defines the weights for hybrid scoring
type PageRankResult ¶
PageRankResult represents the PageRank score for a node
type PathResult ¶
type PathResult struct {
Nodes []*GraphNode `json:"nodes"`
Edges []*GraphEdge `json:"edges"`
Distance int `json:"distance"`
Weight float64 `json:"weight"`
}
PathResult represents a path in the graph
type RDFFormat ¶ added in v2.16.0
type RDFFormat string
RDFFormat represents a supported RDF serialization format.
const ( // RDFFormatNTriples exports triples in N-Triples syntax. RDFFormatNTriples RDFFormat = "ntriples" // RDFFormatNQuads exports statements in N-Quads syntax when graph names are present. RDFFormatNQuads RDFFormat = "nquads" // RDFFormatTurtle exports statements in a Turtle-like syntax with prefixes when possible. RDFFormatTurtle RDFFormat = "turtle" // RDFFormatTriG exports quads in TriG syntax with graph blocks. RDFFormatTriG RDFFormat = "trig" )
type RDFSInferenceExplanation ¶ added in v2.16.0
type RDFSInferenceExplanation struct {
Triple RDFTriple `json:"triple"`
Explicit bool `json:"explicit"`
Rule string `json:"rule,omitempty"`
SupportTripleIDs []string `json:"support_triple_ids,omitempty"`
}
RDFSInferenceExplanation returns provenance information for one triple.
type RDFSInferenceRefreshResult ¶ added in v2.16.0
type RDFSInferenceRefreshResult struct {
ExplicitCount int `json:"explicit_count"`
InferredCount int `json:"inferred_count"`
}
RDFSInferenceRefreshResult summarizes a refresh of inferred triples.
type RDFSInferenceTraceEntry ¶ added in v2.16.0
type RDFSInferenceTraceEntry struct {
TripleID string `json:"triple_id"`
ParentTripleID string `json:"parent_triple_id,omitempty"`
Depth int `json:"depth"`
Explanation RDFSInferenceExplanation `json:"explanation"`
Truncated bool `json:"truncated,omitempty"`
}
RDFSInferenceTraceEntry is one flattened node in an explanation trace.
type RDFTerm ¶ added in v2.16.0
type RDFTerm struct {
Kind string `json:"kind"`
Value string `json:"value"`
Datatype string `json:"datatype,omitempty"`
Language string `json:"language,omitempty"`
}
RDFTerm represents one RDF term.
func NewBlankNode ¶ added in v2.16.0
NewBlankNode creates a blank node term.
func NewLangLiteral ¶ added in v2.16.0
NewLangLiteral creates a language-tagged literal term.
func NewLiteral ¶ added in v2.16.0
NewLiteral creates a plain literal term.
func NewTypedLiteral ¶ added in v2.16.0
NewTypedLiteral creates a typed literal term.
type RDFTriple ¶ added in v2.16.0
type RDFTriple struct {
ID string `json:"id,omitempty"`
Subject RDFTerm `json:"subject"`
Predicate RDFTerm `json:"predicate"`
Object RDFTerm `json:"object"`
Graph *RDFTerm `json:"graph,omitempty"`
Inferred bool `json:"inferred,omitempty"`
Rule string `json:"rule,omitempty"`
SupportIDs []string `json:"support_ids,omitempty"`
}
RDFTriple represents one RDF triple or quad when Graph is set.
type SPARQLResult ¶ added in v2.16.0
type SPARQLResult struct {
QueryType string `json:"query_type"`
Vars []string `json:"vars,omitempty"`
Bindings []map[string]RDFTerm `json:"bindings,omitempty"`
Triples []RDFTriple `json:"triples,omitempty"`
Boolean bool `json:"boolean,omitempty"`
Count int `json:"count"`
}
SPARQLResult contains the result of executing a SPARQL query.
type SimpleHNSW ¶
type SimpleHNSW struct {
// contains filtered or unexported fields
}
SimpleHNSW implements a simplified HNSW-like index for vector search
func NewSimpleHNSW ¶
func NewSimpleHNSW(dimensions int, maxConns int) *SimpleHNSW
NewSimpleHNSW creates a new simplified HNSW index
func (*SimpleHNSW) Add ¶
func (h *SimpleHNSW) Add(id string, vector []float32) error
Add inserts a vector into the HNSW index
func (*SimpleHNSW) Remove ¶
func (h *SimpleHNSW) Remove(nodeID string)
Remove removes a node from the index
func (*SimpleHNSW) Search ¶
func (h *SimpleHNSW) Search(query []float32, k int) []searchCandidate
Search performs HNSW search
type TraversalOptions ¶
type TraversalOptions struct {
MaxDepth int `json:"max_depth"`
EdgeTypes []string `json:"edge_types,omitempty"`
NodeTypes []string `json:"node_types,omitempty"`
Direction string `json:"direction"` // "out", "in", "both"
Limit int `json:"limit"`
}
TraversalOptions defines options for graph traversal
type TriplePattern ¶ added in v2.16.0
type TriplePattern struct {
Subject *RDFTerm `json:"subject,omitempty"`
Predicate *RDFTerm `json:"predicate,omitempty"`
Object *RDFTerm `json:"object,omitempty"`
Graph *RDFTerm `json:"graph,omitempty"`
Inferred *bool `json:"inferred,omitempty"`
Limit int `json:"limit,omitempty"`
}
TriplePattern filters triple lookup operations. Nil fields behave as wildcards.