--- a/src/main/scala/Main.scala Sun Sep 26 07:12:51 2010 -0400
+++ b/src/main/scala/Main.scala Sun Sep 26 07:48:33 2010 -0400
@@ -60,15 +60,22 @@
implicit def iri2objectiri(i:IRI):Object = ObjectIRI(i)
case class ObjectBNode(b:BNode) extends Object
implicit def bnode2objectbnode(b:BNode):Object = ObjectBNode(b)
- case class ObjectTypedLiteral (l:TypedLiteral) extends Object
- implicit def literal2objectliteral(l:TypedLiteral):Object = ObjectTypedLiteral(l)
+ case class ObjectLiteral (l:Literal) extends Object
case class IRI(iri:String)
+
case class BNode(label:String)
+
+ sealed abstract class Literal
+ case class LiteralTyped(i:TypedLiteral) extends Literal
+ implicit def typed2object(i:TypedLiteral):Object = ObjectLiteral(LiteralTyped(i))
+ case class LiteralPlain(b:PlainLiteral) extends Literal
+ implicit def plain2object(b:PlainLiteral):Object = ObjectLiteral(LiteralPlain(b))
+
+ case class PlainLiteral(value:String, langtag:Option[String])
+
case class TypedLiteral(value:String, datatype:IRI)
-
-
}
object Transformer {
@@ -108,14 +115,14 @@
def scalartriples (u:StemIRI, rn:RelName, s:IRI, a:AttrName, h:Header, t:Tuple) : Triple = {
val p = predicatemap (u, rn, a)
val l = t(a).asInstanceOf[LexicalValue]
- val o = ObjectTypedLiteral(literalmap(l, sqlDatatype(h, a)))
+ val o = literalmap(l, sqlDatatype(h, a))
Triple(s, p, o)
}
def referencetriples (u:StemIRI, rn:RelName, s:IRI, a:AttrName, h:Header, t:Tuple) : Triple = {
val p = predicatemap (u, rn, a)
val l = t(a).asInstanceOf[LexicalValue]
val target = h.fks(a)
- val o = ObjectIRI(nodemap(u, target.rel, target.attr, l))
+ val o = nodemap(u, target.rel, target.attr, l)
Triple(s, p, o)
}
@@ -135,12 +142,12 @@
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))
+ val o = nodemap(u, target.rel, target.attr, l)
Some(Triple(s, p, o))
}
case l:LexicalValue => {
val p = predicatemap (u, rn, a)
- val o = ObjectTypedLiteral(literalmap(l, sqlDatatype(h, a)))
+ val o = literalmap(l, sqlDatatype(h, a))
Some(Triple(s, p, o))
}
}