FeDeRate

view directmapping/src/test/scala/DirectMappingTest.scala @ 264:060df0861705

~ fix the access to the default configuration file + error message more readable in case of malformed generated SQL query
author Alexandre Bertails <bertails@w3.org>
date Wed, 03 Nov 2010 15:58:58 -0400
parents d9caadd558bc
children 18e140f8fd6f
line source
1 package org.w3.sw.directmapping
3 import org.w3.sw.rdf._
4 import org.w3.sw.rdb.RDB._
5 import org.w3.sw.sql.SqlParser
6 import org.w3.sw.directmapping.DirectMapping._
8 import org.scalatest.FunSuite
10 class Test extends FunSuite {
12 implicit def l2db (rs:List[Relation]):Map[RelName, Relation] =
13 rs.map(r => (r.name -> r)).toMap
14 implicit def string2relName (n:String) = RelName(n)
15 implicit def string2attrName (n:String) = AttrName(n)
17 test("2 People 1 Addresses") {
19 val p = SqlParser()
20 val s = """
21 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
22 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
23 CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT, FOREIGN KEY (addr) REFERENCES Addresses(ID));
24 INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
25 INSERT INTO People (ID, fname, addr) VALUES (8, "Sue", NULL);
26 """
27 val db = p.parseAll(p.ddl, s).get
28 val g = directDB(StemIRI("http://foo.example/DB"), db)
30 val expected:Graph =
31 Set(
32 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
33 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))),
34 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
35 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("8",IRI("http://www.w3.org/2001/XMLSchema#int"))),
36 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Sue",IRI("http://www.w3.org/2001/XMLSchema#string"))),
38 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
39 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
40 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),TypedLiteral("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
41 )
42 assert (expected === g)
43 }
46 test("2 People 1 Addresses 1 Department") {
48 val p = SqlParser()
49 val s = """
50 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
51 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
52 CREATE TABLE Department (ID INT PRIMARY KEY, name STRING, city STRING,
53 manager INT, FOREIGN KEY (manager) REFERENCES People(ID), UNIQUE (name, city));
54 INSERT INTO Department (ID, name, city, manager) VALUES (23, "accounting", "Cambridge", 8);
55 CREATE TABLE People (ID INT PRIMARY KEY, fname STRING,
56 addr INT, FOREIGN KEY (addr) REFERENCES Addresses(ID),
57 deptName STRING, deptCity STRING, FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
58 INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (7, "Bob", 18, "accounting", "Cambridge");
59 INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (8, "Sue", NULL, NULL, NULL);
60 """
61 val db = p.parseAll(p.ddl, s).get
62 val g = directDB(StemIRI("http://foo.example/DB"), db)
64 val expected:Graph =
65 Set(
66 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptName"),TypedLiteral("accounting",IRI("http://www.w3.org/2001/XMLSchema#string"))),
67 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptCity"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
68 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptName_deptCity"),IRI("http://foo.example/DB/Department/ID.23#_")),
70 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#ID"),TypedLiteral("23",IRI("http://www.w3.org/2001/XMLSchema#int"))),
71 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#name"),TypedLiteral("accounting",IRI("http://www.w3.org/2001/XMLSchema#string"))),
72 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
73 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#manager"),IRI("http://foo.example/DB/People/ID.8#_")),
75 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
76 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))),
77 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
78 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("8",IRI("http://www.w3.org/2001/XMLSchema#int"))),
79 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Sue",IRI("http://www.w3.org/2001/XMLSchema#string"))),
81 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
82 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
83 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),TypedLiteral("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
84 )
85 assert (expected === g)
86 }
89 test("2 People 1 Addresses 1 Department 2 Projects 1 Task") {
91 val p = SqlParser()
92 val s = """
93 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
94 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
95 CREATE TABLE Department (ID INT PRIMARY KEY, name STRING, city STRING, manager INT,
96 FOREIGN KEY (manager) REFERENCES People(ID),
97 UNIQUE (name, city));
98 INSERT INTO Department (ID, name, city, manager) VALUES (23, "accounting", "Cambridge", 8);
99 CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
100 FOREIGN KEY (addr) REFERENCES Addresses(ID),
101 deptName STRING, deptCity STRING,
102 FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
103 INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (7, "Bob", 18, "accounting", "Cambridge");
104 INSERT INTO People (ID, fname, addr, deptName, deptCity) VALUES (8, "Sue", NULL, NULL, NULL);
105 CREATE TABLE Projects (lead INT,
106 FOREIGN KEY (lead) REFERENCES People(ID),
107 name STRING, UNIQUE (lead, name),
108 deptName STRING, deptCity STRING,
109 UNIQUE (name, deptName, deptCity),
110 FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
111 INSERT INTO Projects (lead, name, deptName, deptCity) VALUES (8, "pencil survey", "accounting", "Cambridge");
112 INSERT INTO Projects (lead, name, deptName, deptCity) VALUES (8, "eraser survey", "accounting", "Cambridge");
113 CREATE TABLE TaskAssignments (worker INT,
114 FOREIGN KEY (worker) REFERENCES People(ID),
115 project STRING, PRIMARY KEY (worker, project),
116 deptName STRING, deptCity STRING,
117 FOREIGN KEY (worker) REFERENCES People(ID),
118 FOREIGN KEY (project, deptName, deptCity) REFERENCES Projects(name, deptName, deptCity),
119 FOREIGN KEY (deptName, deptCity) REFERENCES Department(name, city));
120 INSERT INTO TaskAssignments (worker, project, deptName, deptCity) VALUES (7, "pencil survey", "accounting", "Cambridge");
121 """
122 val db = p.parseAll(p.ddl, s).get
123 val g = directDB(StemIRI("http://foo.example/DB"), db)
125 val expected:Graph =
126 Set(
127 Triple(BNode("a"), IRI("http://foo.example/DB/Projects#lead"), IRI("http://foo.example/DB/People/ID.8#_")),
128 Triple(BNode("a"), IRI("http://foo.example/DB/Projects#name"), TypedLiteral("pencil survey", IRI("http://www.w3.org/2001/XMLSchema#string"))),
129 Triple(BNode("a"), IRI("http://foo.example/DB/Projects#deptName"), TypedLiteral("accounting", IRI("http://www.w3.org/2001/XMLSchema#string"))),
130 Triple(BNode("a"), IRI("http://foo.example/DB/Projects#deptCity"), TypedLiteral("Cambridge", IRI("http://www.w3.org/2001/XMLSchema#string"))),
131 Triple(BNode("a"), IRI("http://foo.example/DB/Projects#deptName_deptCity"), IRI("http://foo.example/DB/Department/ID.23#_")),
133 Triple(BNode("b"), IRI("http://foo.example/DB/Projects#lead"), IRI("http://foo.example/DB/People/ID.8#_")),
134 Triple(BNode("b"), IRI("http://foo.example/DB/Projects#name"), TypedLiteral("eraser survey", IRI("http://www.w3.org/2001/XMLSchema#string"))),
135 Triple(BNode("b"), IRI("http://foo.example/DB/Projects#deptName"), TypedLiteral("accounting", IRI("http://www.w3.org/2001/XMLSchema#string"))),
136 Triple(BNode("b"), IRI("http://foo.example/DB/Projects#deptCity"), TypedLiteral("Cambridge", IRI("http://www.w3.org/2001/XMLSchema#string"))),
137 Triple(BNode("b"), IRI("http://foo.example/DB/Projects#deptName_deptCity"), IRI("http://foo.example/DB/Department/ID.23#_")),
139 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#worker"), IRI("http://foo.example/DB/People/ID.7#_")),
140 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#project"), TypedLiteral("pencil survey", IRI("http://www.w3.org/2001/XMLSchema#string"))),
141 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#deptName"), TypedLiteral("accounting", IRI("http://www.w3.org/2001/XMLSchema#string"))),
142 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#deptCity"), TypedLiteral("Cambridge", IRI("http://www.w3.org/2001/XMLSchema#string"))),
143 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#deptName_deptCity"), IRI("http://foo.example/DB/Department/ID.23#_")),
144 Triple(IRI("http://foo.example/DB/TaskAssignments/worker.7_project.pencil+survey#_"), IRI("http://foo.example/DB/TaskAssignments#project_deptName_deptCity"), BNode("a")),
146 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptName"),TypedLiteral("accounting",IRI("http://www.w3.org/2001/XMLSchema#string"))),
147 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptCity"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
148 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#deptName_deptCity"),IRI("http://foo.example/DB/Department/ID.23#_")),
150 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#ID"),TypedLiteral("23",IRI("http://www.w3.org/2001/XMLSchema#int"))),
151 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#name"),TypedLiteral("accounting",IRI("http://www.w3.org/2001/XMLSchema#string"))),
152 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
153 Triple(IRI("http://foo.example/DB/Department/ID.23#_"),IRI("http://foo.example/DB/Department#manager"),IRI("http://foo.example/DB/People/ID.8#_")),
155 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
156 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))),
157 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
158 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("8",IRI("http://www.w3.org/2001/XMLSchema#int"))),
159 Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Sue",IRI("http://www.w3.org/2001/XMLSchema#string"))),
161 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
162 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
163 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),TypedLiteral("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
164 )
165 assert (expected === g)
166 }
169 test("1 People 1 Addresses 1 Offices") {
171 val p = SqlParser()
172 val s = """
173 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
174 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
175 CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
176 FOREIGN KEY (addr) REFERENCES Addresses(ID));
177 INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
178 CREATE TABLE Offices (ID INT PRIMARY KEY,
179 building INT, ofcNumber STRING,
180 FOREIGN KEY (ID) REFERENCES Addresses(ID));
181 INSERT INTO Offices (ID, building, ofcNumber) VALUES (18, 32, "G528");
182 """
183 val db = p.parseAll(p.ddl, s).get
184 val g = directDB(StemIRI("http://foo.example/DB"), db)
186 val expected:Graph =
187 Set(
188 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
189 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#building"),TypedLiteral("32",IRI("http://www.w3.org/2001/XMLSchema#int"))),
190 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#ofcNumber"),TypedLiteral("G528",IRI("http://www.w3.org/2001/XMLSchema#string"))),
192 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
193 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))),
194 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
196 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
197 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
198 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),TypedLiteral("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
199 )
200 assert (expected === g)
201 }
204 test("1 People 1 Addresses 1 Offices 1 ExectutiveOffices") {
206 val p = SqlParser()
207 val s = """
208 CREATE TABLE Addresses (ID INT PRIMARY KEY, city STRING, state STRING);
209 INSERT INTO Addresses (ID, city, state) VALUES (18, "Cambridge", "MA");
210 CREATE TABLE People (ID INT PRIMARY KEY, fname STRING, addr INT,
211 FOREIGN KEY (addr) REFERENCES Addresses(ID));
212 INSERT INTO People (ID, fname, addr) VALUES (7, "Bob", 18);
213 CREATE TABLE Offices (ID INT PRIMARY KEY,
214 building INT, ofcNumber STRING,
215 FOREIGN KEY (ID) REFERENCES Addresses(ID));
216 INSERT INTO Offices (ID, building, ofcNumber) VALUES (18, 32, "G528");
217 CREATE TABLE ExecutiveOffices (ID INT PRIMARY KEY,
218 desk STRING,
219 FOREIGN KEY (ID) REFERENCES Offices(ID));
220 INSERT INTO ExecutiveOffices (ID, desk) VALUES (18, "oak");
221 """
223 val db = p.parseAll(p.ddl, s).get
224 val g = directDB(StemIRI("http://foo.example/DB"), db)
226 val expected:Graph =
227 Set(
228 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/ExecutiveOffices#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
229 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/ExecutiveOffices#desk"),TypedLiteral("oak",IRI("http://www.w3.org/2001/XMLSchema#string"))),
231 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
232 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#building"),TypedLiteral("32",IRI("http://www.w3.org/2001/XMLSchema#int"))),
233 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Offices#ofcNumber"),TypedLiteral("G528",IRI("http://www.w3.org/2001/XMLSchema#string"))),
235 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),TypedLiteral("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
236 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#fname"),TypedLiteral("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))),
237 Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
239 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),TypedLiteral("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
240 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#city"),TypedLiteral("Cambridge",IRI("http://www.w3.org/2001/XMLSchema#string"))),
241 Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),TypedLiteral("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
242 )
243 assert (expected === g)
244 }
247 test("NodeMap") {
249 val ck1:CandidateKey = CandidateKey("name", "ssn")
250 val ck2:CandidateKey = CandidateKey("ID")
251 val v11:List[CellValue] = List(LexicalValue("bob"), LexicalValue("123"))
252 val v21:List[CellValue] = List(LexicalValue("alice"), LexicalValue("8"))
253 val v12:List[CellValue] = List(LexicalValue("18"))
254 val v22:List[CellValue] = List(LexicalValue("23"))
255 val s1:Node = BNode("1")
256 val s2:Node = BNode("2")
257 val data:Set[(List[(CandidateKey, List[CellValue])], Node)] =
258 Set((List((ck1, v11),(ck2, v21)), s1),
259 (List((ck1, v12),(ck2, v22)), s2))
260 val test = data.foldLeft(KeyMap(Map[CandidateKey, Map[List[CellValue], Node]]()))((m, t) => m ++ (t._1, t._2))
262 val goal:KeyMap = KeyMap(
263 Map(ck1 -> Map(v11 -> s1,
264 v12 -> s2),
265 ck2 -> Map(v21 -> s1,
266 v22 -> s2))
267 )
268 assert(goal === test)
269 }
271 }
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.