--- a/src/main/scala/SparqlToSql.scala Fri Jun 11 20:21:02 2010 -0400
+++ b/src/main/scala/SparqlToSql.scala Fri Jun 11 20:21:52 2010 -0400
@@ -993,7 +993,7 @@
* @param concat if true, keys will produce SQL functions to generate a URI, e.g. SELECT CONCAT(stemURI, table, "/", pk, ".", R_who.pk) AS who
* @return an SQL query corresponding to sparquery
*/
- def apply (db:sql.DatabaseDesc, sparquery:sparql.Select, stem:StemURI, enforceForeignKeys:Boolean, concat:Boolean) : sql.Select = {
+ def translate (db:sql.DatabaseDesc, sparquery:sparql.Select, stem:StemURI, enforceForeignKeys:Boolean, concat:Boolean) : (sql.Select, Map[sparql.Assignable, SQL2RDFValueMapper]) = {
val sparql.Select(attrs, triples) = sparquery
/** Create an object to hold our compilation state. */
@@ -1037,9 +1037,13 @@
case _ => Some(sql.ExprConjunction(r2rState.exprs))
}
)
+ (select, r2rState.varmap)
+ }
+
+ def apply (db:sql.DatabaseDesc, sparquery:sparql.Select, stem:StemURI, enforceForeignKeys:Boolean, concat:Boolean) : sql.Select = {
// println("r2rState.varmap: " + r2rState.varmap)
// println("select.expression: " + select.expression)
- select.makePretty() // eliminate foo.bar=foo.bar and stuff like that.
+ translate(db, sparquery, stem, enforceForeignKeys, concat)._1.makePretty() // eliminate foo.bar=foo.bar and stuff like that.
}
}