backend: support external SPARQL and named-graph snapshots
This commit is contained in:
33
backend_go/selection_queries/named_graph_test.go
Normal file
33
backend_go/selection_queries/named_graph_test.go
Normal file
@@ -0,0 +1,33 @@
|
||||
package selection_queries
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSelectionQueriesUseNamedGraphs(t *testing.T) {
|
||||
selected := []NodeRef{
|
||||
{ID: 1, TermType: "uri", IRI: "http://example.com/A"},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
query string
|
||||
}{
|
||||
{name: "neighbors", query: neighborsQuery(selected, false)},
|
||||
{name: "superclasses", query: superclassesQuery(selected, false)},
|
||||
{name: "subclasses", query: subclassesQuery(selected, false)},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
if !strings.Contains(tt.query, "SELECT DISTINCT ?s ?p ?o") {
|
||||
t.Fatalf("%s query should de-duplicate triples across named graphs:\n%s", tt.name, tt.query)
|
||||
}
|
||||
if !strings.Contains(tt.query, "GRAPH ?g") {
|
||||
t.Fatalf("%s query should read from named graphs:\n%s", tt.name, tt.query)
|
||||
}
|
||||
if strings.Contains(tt.query, "owl:Class") {
|
||||
t.Fatalf("%s query should no longer depend on owl:Class:\n%s", tt.name, tt.query)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user