--- a/src/main/scala/Main.scala Thu May 27 21:45:29 2010 -0400
+++ b/src/main/scala/Main.scala Thu May 27 21:47:03 2010 -0400
@@ -1,5 +1,7 @@
package w3c.sw.StemGraph
+import scala.collection.Set
+
object Transformer {
// Transformation argument:
type StemURI = IRI
@@ -33,7 +35,7 @@
// Accessor functions:
def pk (h:Header) : AttrName // Assume: one primary key.
- = h.filter(x => x._2._1 == Pk()).keysIterator.toList(0)
+ = h.find(x => x._2._1 == Pk()).get._1
def header (r:Relation) : Header = r.header
def body (r:Relation) : Body = r.body
@@ -51,7 +53,7 @@
val h = header(r)
val k = pk(h)
val s = nodemap(u, r, k, lexvalue(h, t, k).asInstanceOf[LexicalValue]) // Assume: no NULLs in primary key
- h.keysIterator.toList.flatMap(a => cellmap(u, r, a, s, t)).toSet
+ h.keySet.flatMap(a => cellmap(u, r, a, s, t))
}
def cellmap (u:StemURI, r:Relation, a:AttrName, s:IRI, t:Tuple) : Option[RDFTriple] = {
@@ -80,16 +82,6 @@
}
def literalmap (l:LexicalValue, d:SQLDatatype) : RDFLiteral
= "\"" + l.s + "\"^^" + XSD(d)
-
- // Utilities:
- def toSet[T](list: List[T]) = {
- def traverse(list: List[T])(set: Set[T]): Set[T] = list match {
- case hd :: tail => traverse(tail)(set + hd)
- case Nil => set
- }
-
- traverse(list)(Set[T]())
- }
}