--- a/src/main/scala/Main.scala Tue Jun 08 16:55:37 2010 -0400
+++ b/src/main/scala/Main.scala Tue Jun 08 16:58:32 2010 -0400
@@ -127,20 +127,22 @@
}
def cellmap (u:StemIRI, rn:RelName, h:Header, a:AttrName, s:IRI, t:Tuple) : Option[Triple] = {
- if (h.pk.find(x => x == a) != None)
- None
- else
- lexvalue(h, t, a) match {
- case ☹() => None
- case l:LexicalValue => {
- val p = predicatemap (u, rn, a)
- val o = h.fks.get(a) match {
- case Some(target:Target) => ObjectIRI(nodemap(u, target.rel, target.attr, l))
- case None => ObjectLiteral(literalmap(l, sqlDatatype(h, a)))
- }
- Some(Triple(s, p, o))
- }
+ def hasForeignKeys(a:AttrName):Boolean = h.fks.get(a).isDefined
+ lexvalue(h, t, a) match {
+ case _ if h.pk contains a => None
+ case ☹() => None
+ case l:LexicalValue if hasForeignKeys(a) => {
+ val target = h.fks(a)
+ val p = predicatemap (u, rn, a)
+ val o = ObjectIRI(nodemap(u, target.rel, target.attr, l))
+ Some(Triple(s, p, o))
}
+ case l:LexicalValue => {
+ val p = predicatemap (u, rn, a)
+ val o = ObjectLiteral(literalmap(l, sqlDatatype(h, a)))
+ Some(Triple(s, p, o))
+ }
+ }
}
def nodemap (u:StemIRI, rn:RelName, a:AttrName, l:LexicalValue) : IRI =