--- a/src/main/scala/SparqlToSql.scala Sun Feb 28 15:04:42 2010 -0500
+++ b/src/main/scala/SparqlToSql.scala Sun Feb 28 15:05:33 2010 -0500
@@ -242,7 +242,10 @@
val objattr = sql.RelVarAttr(relvar, attr)
val state_postSubj = s match {
case sparql.TermUri(u) => uriConstraint(stateP, sql.RelVarAttr(relvar, db.relationdescs(rel).primarykey.get), parseObjectURI(u), true)
- case sparql.TermVar(v) => varConstraint(stateP, relvar, db.relationdescs(rel).primarykey, v, db, rel)
+ case sparql.TermVar(v) => try { varConstraint(stateP, relvar, db.relationdescs(rel).primarykey, v, db, rel) } catch {
+ case e:java.util.NoSuchElementException =>
+ throw new Exception("error processing { " + s + " " + p + " " + o + " } :db.relationdescs(" + rel + ") not found in " + db)
+ }
case _ => error("illegal SPARQL subject: " + s)
}
val state_subjJoin = R2RState(state_postSubj.joins + sql.InnerJoin(sql.AliasedResource(rel,relvar), None), state_postSubj.varmap, state_postSubj.exprs)