backend: support external SPARQL and named-graph snapshots

This commit is contained in:
Oxy8
2026-04-06 13:36:08 -03:00
parent 696844f341
commit 44c1d3eaa6
25 changed files with 1695 additions and 243 deletions

View File

@@ -0,0 +1,24 @@
package main
import "testing"
func TestGraphAccumulatorDeduplicatesEdges(t *testing.T) {
preds := NewPredicateDict([]string{"http://example.com/p"})
acc := newGraphAccumulator(16, false, 16, preds)
binding := sparqlTripleBinding{
S: sparqlTerm{Type: "uri", Value: "http://example.com/s"},
P: sparqlTerm{Type: "uri", Value: "http://example.com/p"},
O: sparqlTerm{Type: "uri", Value: "http://example.com/o"},
}
acc.addTripleBinding(binding)
acc.addTripleBinding(binding)
if len(acc.nodes) != 2 {
t.Fatalf("expected 2 nodes after duplicate bindings, got %d", len(acc.nodes))
}
if len(acc.edges) != 1 {
t.Fatalf("expected 1 deduplicated edge, got %d", len(acc.edges))
}
}