--- a/directmapping/src/main/scala/DirectMapping.scala Sun Oct 31 20:43:14 2010 -0400
+++ b/directmapping/src/main/scala/DirectMapping.scala Tue Nov 02 16:55:25 2010 -0400
@@ -27,6 +27,7 @@
})
KeyMap(m2)
}
+ def contains(ck:CandidateKey) = m.contains(ck)
}
case class NodeMap(m:Map[RelName, KeyMap]) {
def apply(rn:RelName) = m(rn)
@@ -39,6 +40,7 @@
} else
m(rn)(k)(vs)
}
+ def contains(rn:RelName) = m.contains(rn)
}
implicit def list2map (l:Set[(RelName, KeyMap)]):Map[RelName,KeyMap] = l.toMap
implicit def list2Nmap (l:Set[(RelName, KeyMap)]):NodeMap = NodeMap(l)
@@ -158,6 +160,12 @@
val p = predicatemap (u, r.name, as)
val ls:List[LexicalValue] = t.lexvaluesNoNulls(as)
val target = r.fks(as)
+ if (!nodes.contains(target.rel))
+ error("No referent relation \"" + target.rel + "\" to match " + r.name + t)
+ if (!nodes(target.rel).contains(target.key))
+ error("Relation " + target.rel + " has no attributes (" + target.key + ") to match " + r.name + t)
+ if (!nodes(target.rel)(target.key).contains(ls))
+ error("Relation " + target.rel + "(" + target.key + ") has no values " + ls + " to match " + r.name + t)
val o:Object = nodes(target.rel)(target.key)(ls)
Triple(s, p, o)
}