changeset 16:add26642a710

+ 2 employees test
author Eric Prud'hommeaux <eric@w3.org>
date Tue, 08 Jun 2010 16:55:37 -0400
parents fdc36e0b0a87
children 5653130b620a
files src/test/scala/Test.scala
diffstat 1 files changed, 38 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/test/scala/Test.scala	Fri Jun 04 18:21:49 2010 -0400
+++ b/src/test/scala/Test.scala	Tue Jun 08 16:55:37 2010 -0400
@@ -22,7 +22,9 @@
 				     "fname" -> SQLString(),
 				     "addr" -> SQLInt()),
 				 List("ID"),
-				 Map[AttrName, Target]("addr" -> Target("Addresses", "ID"))),
+				 Map[AttrName, Target](
+				   "addr" -> Target("Addresses", "ID")
+				 )),
 			  Set(Map("ID" -> LexicalValue("7"),
 				  "fname" -> LexicalValue("Bob"),
 				  "addr" -> LexicalValue("18")),
@@ -32,21 +34,50 @@
 
     val db = Database(Map("Addresses" -> addresses, 
 			  "People" -> people))
+    val g = databasemap(StemIRI("http://foo.example/DB"), db)
 
-    val u = StemIRI("http://foo.example/DB")
     val expected:RDFGraph =
       Set(
-//	Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),Literal("7",IRI("http://www.w3.org/2001/XMLSchema#int"))),
+/*	Triple(IRI("http://foo.example/DB/People/ID.7#_"),IRI("http://foo.example/DB/People#ID"),Literal("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"),Literal("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/People/ID.8#_"),IRI("http://foo.example/DB/People#ID"),Literal("8",IRI("http://www.w3.org/2001/XMLSchema#int"))),
+/*	Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#ID"),Literal("8",IRI("http://www.w3.org/2001/XMLSchema#int"))), */
 	Triple(IRI("http://foo.example/DB/People/ID.8#_"),IRI("http://foo.example/DB/People#fname"),Literal("Sue",IRI("http://www.w3.org/2001/XMLSchema#string"))), 
 
-//	Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),Literal("18",IRI("http://www.w3.org/2001/XMLSchema#int"))),
+/*	Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#ID"),Literal("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"),Literal("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"),Literal("MA",IRI("http://www.w3.org/2001/XMLSchema#string"))))
+	Triple(IRI("http://foo.example/DB/Addresses/ID.18#_"),IRI("http://foo.example/DB/Addresses#state"),Literal("MA",IRI("http://www.w3.org/2001/XMLSchema#string")))
+      )
+    assert (expected === g)
+  }
 
-    assert (expected === databasemap(u, db))
+  test("2 Employees") {
+    val employees = Relation(Header(Map("ID" -> SQLInt(),
+					"fname" -> SQLString(),
+					"boss" -> SQLInt()),
+				    List("ID"),
+				    Map[AttrName, Target](
+				      "boss" -> Target("Employees", "ID")
+				    )),
+			     Set(Map("ID" -> LexicalValue("1"),
+				     "fname" -> LexicalValue("Alice"),
+				     "boss" -> ☹()),
+				 Map("ID" -> LexicalValue("2"),
+				     "fname" -> LexicalValue("Bob"),
+				     "boss" -> LexicalValue("1"))
+			       ))
+    val db = Database(Map("Employees" -> employees))
+    val g = databasemap(StemIRI("http://foo.example/DB"), db)
+
+    val expected:RDFGraph =
+      Set(
+/*	Triple(IRI("http://foo.example/DB/Employees/ID.1#_"),IRI("http://foo.example/DB/Employees#ID"),Literal("1",IRI("http://www.w3.org/2001/XMLSchema#int"))), */
+	Triple(IRI("http://foo.example/DB/Employees/ID.1#_"),IRI("http://foo.example/DB/Employees#fname"),Literal("Alice",IRI("http://www.w3.org/2001/XMLSchema#string"))),
+/*	Triple(IRI("http://foo.example/DB/Employees/ID.2#_"),IRI("http://foo.example/DB/Employees#ID"),Literal("2",IRI("http://www.w3.org/2001/XMLSchema#int"))), */
+	Triple(IRI("http://foo.example/DB/Employees/ID.2#_"),IRI("http://foo.example/DB/Employees#fname"),Literal("Bob",IRI("http://www.w3.org/2001/XMLSchema#string"))), 
+	Triple(IRI("http://foo.example/DB/Employees/ID.2#_"),IRI("http://foo.example/DB/Employees#boss"),IRI("http://foo.example/DB/Employees/ID.1#_"))
+      )
+    assert (expected === g)
   }
 
 }
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.