+ tup1
authorEric Prud'hommeaux <bertails@w3.org>
Tue, 15 Dec 2009 15:16:55 -0500
changeset 44 834d9b687680
parent 43 ede4871413a2
child 45 712e76f5f5bd
+ tup1
src/test/scala/RDB2RDFTest.scala
--- a/src/test/scala/RDB2RDFTest.scala	Tue Dec 15 15:05:12 2009 -0500
+++ b/src/test/scala/RDB2RDFTest.scala	Tue Dec 15 15:16:55 2009 -0500
@@ -70,5 +70,23 @@
     assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), PrimaryKey(Attribute(Name("id")))) === sqlSelect)
   }
 
+  test("transform tup1") {
+    val sparqlParser = Sparql()
+    val sparqlSelect = sparqlParser.parseAll(sparqlParser.select, """
+SELECT ?empName {
+?emp      <http://hr.example/DB/Employee#lastName>   ?empName .
+?emp      <http://hr.example/DB/Employee#manager>    <http://hr.example/DB/Employee/id.18#record>
+ }
+""").get
+    val sqlParser = Sql()
+    val sqlSelect = sqlParser.parseAll(sqlParser.select, """
+SELECT R_emp.lastName AS A_empName
+       FROM Employee AS R_emp
+            INNER JOIN Employee AS R_id18 ON R_id18.id=R_emp.manager AND R_id18.id=18
+ WHERE R_emp.lastName IS NOT NULL
+""").get
+    assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), PrimaryKey(Attribute(Name("id")))) === sqlSelect)
+  }
+
 
 }