<commit_before>package db

import (
	ll "log"
	"strings"
	"testing"

	"github.com/gtfierro/hod/config"
	"github.com/gtfierro/hod/query"
)

func TestQueryPlan(t *testing.T) {
	for _, test := range []struct {
		query string
	}{
		{
			"SELECT ?x WHERE { ?x rdf:type brick:Room . } ;",
		},
		{
			"SELECT ?x ?y WHERE { ?x ?y brick:Room . } ;",
		},
		{
			"SELECT ?x ?y WHERE { ?y rdf:type rdf:type . ?x ?y brick:Room . } ;",
		},
		{
			"SELECT ?a WHERE { ?a bf:feeds ?b . ?b bf:feeds ?c . ?c bf:feeds ?d . ?d bf:feeds ?e . ?e bf:feeds ?loc . ?loc bf:hasPoint brick:Power_Meter . };",
		},
		{
			"SELECT ?a WHERE { ?a bf:feeds ?b . ?b bf:feeds ?c . ?c bf:feeds ?d . ?d bf:feeds ?e . ?e bf:feeds ?loc . ?loc bf:hasPoint brick:Power_Meter . };",
		},
		{
			"SELECT ?meter WHERE { ?meter rdf:type brick:Power_Meter . ?room rdf:type brick:Room . ?meter bf:isPointOf ?equipment . ?equipment rdf:type ?class . ?class rdfs:subClassOf+ brick:Heating_Ventilation_Air_Conditioning_System . ?zone rdf:type/rdfs:subClassOf* brick:HVAC_Zone . ?equipment bf:feeds+ ?zone . ?zone bf:hasPart ?room . } ;",
		},
	} {
		ll.Println(test.query)
		q, e := query.Parse(strings.NewReader(test.query))
		if e != nil {
			t.Error(e)
			continue
		}
		//db := &DB{}
		makeDependencyGraph(q)
	}
}

func BenchmarkExpandTuples(b *testing.B) {
	cfg, err := config.ReadConfig("testhodconfig.yaml")
	if err != nil {
		b.Error(err)<commit_msg>remove other extraneous print<commit_after>package db

import (
	"strings"
	"testing"

	"github.com/gtfierro/hod/config"
	"github.com/gtfierro/hod/query"
)

func TestQueryPlan(t *testing.T) {
	for _, test := range []struct {
		query string
	}{
		{
			"SELECT ?x WHERE { ?x rdf:type brick:Room . } ;",
		},
		{
			"SELECT ?x ?y WHERE { ?x ?y brick:Room . } ;",
		},
		{
			"SELECT ?x ?y WHERE { ?y rdf:type rdf:type . ?x ?y brick:Room . } ;",
		},
		{
			"SELECT ?a WHERE { ?a bf:feeds ?b . ?b bf:feeds ?c . ?c bf:feeds ?d . ?d bf:feeds ?e . ?e bf:feeds ?loc . ?loc bf:hasPoint brick:Power_Meter . };",
		},
		{
			"SELECT ?a WHERE { ?a bf:feeds ?b . ?b bf:feeds ?c . ?c bf:feeds ?d . ?d bf:feeds ?e . ?e bf:feeds ?loc . ?loc bf:hasPoint brick:Power_Meter . };",
		},
		{
			"SELECT ?meter WHERE { ?meter rdf:type brick:Power_Meter . ?room rdf:type brick:Room . ?meter bf:isPointOf ?equipment . ?equipment rdf:type ?class . ?class rdfs:subClassOf+ brick:Heating_Ventilation_Air_Conditioning_System . ?zone rdf:type/rdfs:subClassOf* brick:HVAC_Zone . ?equipment bf:feeds+ ?zone . ?zone bf:hasPart ?room . } ;",
		},
	} {
		q, e := query.Parse(strings.NewReader(test.query))
		if e != nil {
			t.Error(e)
			continue
		}
		//db := &DB{}
		makeDependencyGraph(q)
	}
}

func BenchmarkExpandTuples(b *testing.B) {
	cfg, err := config.ReadConfig("testhodconfig.yaml")
	if err != nil {
		b.Error(err)
{'fraction_non_alphanumeric': 0.17838030681412773, 'fraction_numerical': 0.0, 'mean_word_length': 3.3006134969325154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5274204', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1194, 'n_words': 263}