package main

import (
	"strings"
	"testing"
)

func TestRDFSLabelQueryUsesNamedGraphs(t *testing.T) {
	query := rdfsLabelQuery([]string{
		"http://example.com/A",
		"http://example.com/B",
	})

	if !strings.Contains(query, "SELECT DISTINCT ?s ?label") {
		t.Fatalf("label query should de-duplicate rows across named graphs:\n%s", query)
	}
	if !strings.Contains(query, "GRAPH ?g") {
		t.Fatalf("label query should read from named graphs:\n%s", query)
	}
	if !strings.Contains(query, "<"+rdfsLabelIRI+">") {
		t.Fatalf("label query should still fetch rdfs:label:\n%s", query)
	}
}
