--- a/src/main/scala/RDB2RDFMain.scala Mon Dec 14 21:13:55 2009 -0500
+++ b/src/main/scala/RDB2RDFMain.scala Tue Dec 15 01:02:16 2009 -0500
@@ -240,11 +240,15 @@
var notNulls:List[PrimaryExpressionNotNull] = List()
r2rState.allVars.foreach(s => notNulls = nullGuard(notNulls, r2rState.inConstraint, r2rState.varmap, s))
+ val where = notNulls.size match {
+ case 0 => None
+ case _ => Some(Expression(notNulls))
+ }
Select(
AttributeList(attrlist),
TableList(r2rState.joins),
- Some(Expression(notNulls))
+ where
)
}
}
--- a/src/test/scala/RDB2RDFTest.scala Mon Dec 14 21:13:55 2009 -0500
+++ b/src/test/scala/RDB2RDFTest.scala Tue Dec 15 01:02:16 2009 -0500
@@ -26,9 +26,9 @@
val sqlSelect = sqlParser.parseAll(sqlParser.select, """
SELECT R_emp.id AS A_emp
FROM Employee AS R_emp
- INNER JOIN Employee AS R_manager ON R_manager.id=R_emp.manager
-""").get
- RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), PrimaryKey(Attribute(Name("id"))))
+ INNER JOIN Employee AS id18 ON id18.id=18
+""").get // !!! id18.id=R_emp.manager
+ assert(RDB2RDF(db, sparqlSelect, StemURI("http://hr.example/DB/"), PrimaryKey(Attribute(Name("id")))) === sqlSelect)
true
}