~ tweaked val names in tests
authorEric Prud'hommeaux <eric@w3.org>
Thu, 07 Jan 2010 19:43:09 -0500
changeset 126 03503fe0284f
parent 125 d7a285ec49f6
child 127 2be389f659cc
~ tweaked val names in tests
src/test/scala/RDB2RDFTest.scala
--- a/src/test/scala/RDB2RDFTest.scala	Thu Jan 07 19:25:14 2010 -0500
+++ b/src/test/scala/RDB2RDFTest.scala	Thu Jan 07 19:43:09 2010 -0500
@@ -48,13 +48,14 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.id AS A_emp
        FROM Employee AS R_emp
             INNER JOIN Employee AS R_id18
  WHERE R_id18.id=R_emp.manager AND R_id18.id=18 AND R_emp.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
   }
 
   test("SELECT <x> { ?sf <p> <x>} (in-SQL Nodizer)") {
@@ -67,13 +68,14 @@
 """).get
     val sqlParser = Sql()
     val StemUrlString = "\"http://hr.example/DB/\""
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT CONCAT(""" + StemUrlString + """, "Employee", "/", "id", ".", R_emp.id, "#record") AS A_emp
        FROM Employee AS R_emp
             INNER JOIN Employee AS R_id18
  WHERE R_id18.id=R_emp.manager AND R_id18.id=18 AND R_emp.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, true) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, true)
+    assert(generated === parsed)
     true
   }
 
@@ -87,12 +89,13 @@
 """).get
     val sqlParser = Sql()
     val StemUrlString = "\"http://hr.example/DB/\""
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT CONCAT("\"", R_emp.lastName, "\"^^<http://www.w3.org/2001/XMLSchema#string>") AS A_name
        FROM Employee AS R_emp
  WHERE R_emp.id IS NOT NULL AND R_emp.lastName IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, true) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, true)
+    assert(generated === parsed)
     true
   }
 
@@ -105,13 +108,14 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_manager.id AS A_manager
        FROM Employee AS R_id18
             INNER JOIN Employee AS R_manager
  WHERE R_manager.id=R_id18.manager AND R_id18.id=18 AND R_manager.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
     true
   }
 
@@ -127,13 +131,14 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.id AS A_emp
        FROM Employee AS R_emp
             INNER JOIN Employee AS R_18
  WHERE R_18.id=R_emp.manager AND R_18.id=18 AND R_emp.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
     true
   }
 
@@ -147,13 +152,14 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp1.id AS A_emp1, R_emp2.id AS A_emp2, R_emp1.lastName AS A_sharedName
        FROM Employee AS R_emp1
             INNER JOIN Employee AS R_emp2 ON R_emp2.lastName=R_emp1.lastName
  WHERE R_emp1.id IS NOT NULL AND R_emp1.lastName IS NOT NULL AND R_emp2.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
     true
   }
 
@@ -168,7 +174,7 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName, R_manager.lastName AS A_manageName
        FROM Employee AS R_emp
             INNER JOIN Employee AS R_manager
@@ -176,7 +182,8 @@
  AND R_emp.id IS NOT NULL
  AND R_manager.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
   }
 
   test("transform tup1 no-enforce") {
@@ -189,13 +196,14 @@
  }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName
        FROM Employee AS R_emp
  WHERE R_emp.manager=18 AND R_emp.lastName IS NOT NULL
  AND R_emp.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(generated === parsed)
   }
 
   test("transform tup1 enforce") {
@@ -208,14 +216,15 @@
  }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName
        FROM Employee AS R_emp
             INNER JOIN Employee AS R_id18
  WHERE R_id18.id=R_emp.manager AND R_id18.id=18 AND R_emp.lastName IS NOT NULL
  AND R_emp.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
   }
 
 
@@ -231,7 +240,7 @@
  }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName
   FROM Employee AS R_emp
        INNER JOIN Employee AS R_manager
@@ -239,7 +248,8 @@
  AND R_emp.id IS NOT NULL
  AND R_manager.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
   }
 
   test("transform filter1") {
@@ -264,7 +274,7 @@
 }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName,
        R_grandManager.lastName AS A_grandManagName
   FROM Employee AS R_emp
@@ -282,7 +292,8 @@
    AND R_taskLead.birthday IS NOT NULL AND R_ltask.taskid IS NOT NULL
    AND R_lower.id IS NOT NULL AND R_upper.id IS NOT NULL
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), true, false) === sqlSelect)
+    val generated = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), true, false)
+    assert(generated === parsed)
   }
 
   test("transform disj1") {
@@ -304,7 +315,7 @@
            ?managed empP:lastName  ?name } }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_union1.A_name AS A_name
   FROM Employee AS R_who
        INNER JOIN (
@@ -336,7 +347,8 @@
        AND (R_union1._DISJOINT_!=0 OR R_union1.A_who=R_who.empid)
        AND (R_union1._DISJOINT_!=1 OR R_union1.A_who=R_who.empid)
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform assymDisj1") {
@@ -361,7 +373,7 @@
          ?who empP:birthday ?bday }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_union0.A_name AS A_name
   FROM (
          SELECT R_above.id AS A_above, R_above.task AS A_atask, NULL AS A_bday, NULL AS A_below,
@@ -388,7 +400,8 @@
    AND (R_union0._DISJOINT_!=1 OR R_who.empid=R_union0.A_who)
    AND R_union0.A_bday IS NOT NULL AND R_union0.A_who IS NOT NULL AND R_who.lastName="Smith"
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform assymDisj1 reversed") {
@@ -415,7 +428,7 @@
        }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_union1.A_name AS A_name
   FROM Employee AS R_who
        INNER JOIN (
@@ -442,7 +455,8 @@
    AND (R_union1._DISJOINT_!=1 OR R_union1.A_who=R_who.empid)
    AND R_who.birthday IS NOT NULL AND R_who.empid IS NOT NULL AND R_who.lastName="Smith"
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform assymDisj1 interspersed") {
@@ -469,7 +483,7 @@
        }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_union1.A_name AS A_name
   FROM Employee AS R_who
        INNER JOIN (
@@ -496,7 +510,8 @@
    AND (R_union1._DISJOINT_!=1 OR R_who.birthday=R_union1.A_bday)
    AND R_union1.A_bday IS NOT NULL AND R_who.empid IS NOT NULL AND R_who.lastName="Smith"
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform optJoin1") {
@@ -512,7 +527,7 @@
               ?grandManager emplP:lastName   ?grandManagName } }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName, R_opt1.A_grandManagName AS A_grandManagName, R_opt1.A_managName AS A_managName
   FROM Employee AS R_emp
        LEFT OUTER JOIN (
@@ -525,7 +540,8 @@
                   ) AS R_opt1 ON R_opt1.A_emp=R_emp.empid
  WHERE R_emp.empid IS NOT NULL AND R_emp.lastName IS NOT NULL
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform leadOpt1") {
@@ -540,7 +556,7 @@
                   ?emp            emplP:lastName   ?empName }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName, R_opt1.A_grandManagName AS A_grandManagName
   FROM ( SELECT 1 AS _EMPTY_ ) AS _EMPTY_
        LEFT OUTER JOIN (
@@ -554,7 +570,8 @@
    AND R_emp.lastName IS NOT NULL
    AND R_opt1.A_emp IS NOT NULL
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform nestOpt") {
@@ -571,7 +588,7 @@
        }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp.lastName AS A_empName, R_opt1.A_grandManagName AS A_grandManagName, R_opt1.A_managName AS A_managName
   FROM Employee AS R_emp
        LEFT OUTER JOIN (
@@ -590,7 +607,8 @@
                   ) AS R_opt1 ON R_opt1.A_emp=R_emp.empid
  WHERE R_emp.empid IS NOT NULL AND R_emp.lastName IS NOT NULL
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }
 
   test("transform equivOpt1") {
@@ -610,7 +628,7 @@
          FILTER ( ?emp1Name < ?emp2Name && ?emp2Name < ?emp3Name && ?emp3Name < ?emp4Name) }
 """).get
     val sqlParser = Sql()
-    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+    val parsed = sqlParser.parseAll(sqlParser.select, """
 SELECT R_emp1.lastName AS A_emp1Name, R_emp2.lastName AS A_emp2Name, R_emp3.lastName AS A_emp3Name
   FROM Employee AS R_emp1
        LEFT OUTER JOIN (
@@ -633,7 +651,8 @@
    AND R_emp3.empid IS NOT NULL AND R_emp3.lastName IS NOT NULL AND R_emp3.lastName<R_emp4.lastName
    AND R_emp4.empid IS NOT NULL AND R_emp4.lastName IS NOT NULL AND R_opt1.A_birthday IS NOT NULL
 """).get
-    assert(RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false) === sqlSelect)
+    val transformed = RDB2RDF(db2, sparqlSelect, StemURI("http://hr.example/DB/"), false, false)
+    assert(transformed === parsed)
   }