--- a/src/test/scala/Test.scala Tue Sep 28 22:54:18 2010 -0400
+++ b/src/test/scala/Test.scala Tue Sep 28 23:40:05 2010 -0400
@@ -309,6 +309,74 @@
assert (expected === g)
}
+
+ test("1 People 1 Addresses 1 Offices 1 ExectutiveOffices") {
+
+ val addresses = Relation(Header(Map("ID" -> SQLInt(),
+ "city" -> SQLString(),
+ "state" -> SQLString())),
+ Set(Map("ID" -> LexicalValue("18"),
+ "city" -> LexicalValue("Cambridge"),
+ "state" -> LexicalValue("MA"))),
+ List(List("ID")),
+ Some(List("ID")),
+ Map())
+
+ val people = Relation(Header(Map("ID" -> SQLInt(),
+ "fname" -> SQLString(),
+ "addr" -> SQLInt())),
+ Set(Map("ID" -> LexicalValue("7"),
+ "fname" -> LexicalValue("Bob"),
+ "addr" -> LexicalValue("18"))),
+ List(List("ID")),
+ Some(List("ID")),
+ Map(List("addr") -> Target("Addresses", List("ID"))))
+
+ val offices = Relation(Header(Map("ID" -> SQLInt(),
+ "building" -> SQLInt(),
+ "ofcNumber" -> SQLString())),
+ Set(Map("ID" -> LexicalValue("18"),
+ "building" -> LexicalValue("32"),
+ "ofcNumber" -> LexicalValue("G528"))),
+ List(List("ID")),
+ Some(List("ID")),
+ Map(List("ID") -> Target("Addresses", List("ID"))))
+
+ val execoffices = Relation(Header(Map("ID" -> SQLInt(),
+ "desk" -> SQLString())),
+ Set(Map("ID" -> LexicalValue("18"),
+ "desk" -> LexicalValue("oak"))),
+ List(List("ID")),
+ Some(List("ID")),
+ Map(List("ID") -> Target("Offices", List("ID"))))
+
+ val db = Database(Map("Addresses" -> addresses,
+ "People" -> people,
+ "Offices" -> offices,
+ "ExecutiveOffices" -> execoffices))
+ val g = databasemap(StemIRI("http://foo.example/DB"), db)
+
+ val expected:RDFGraph =
+ Set(
+ 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"))),
+ 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"))),
+
+ 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"))),
+ 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"))),
+ 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"))),
+
+ 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"))),
+ 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"))),
+ Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#addr"),IRI("http://foo.example/DB/Addresses/ID.18#_")),
+
+ 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"))),
+ 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"))),
+ 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")))
+ )
+ assert (expected === g)
+ }
+
+
test("NodeMap") {
val ck1:CandidateKey = List("name", "ssn")
@@ -333,6 +401,7 @@
assert(goal === test)
}
+
test("2 Employees") {
val employees = Relation(Header(Map("ID" -> SQLInt(),
"fname" -> SQLString(),