backend: support external SPARQL and named-graph snapshots
This commit is contained in:
24
backend_go/graph_export_test.go
Normal file
24
backend_go/graph_export_test.go
Normal 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))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user