changeset 342:05d5a585b109 no-hierarchy

~ simplifications (db not needed most of the time)
author Alexandre Bertails <bertails@gmail.com>
date Sun, 13 Feb 2011 18:09:52 -0500
parents acbc6ab3c0b5
children b4679fb25560
files directmapping/src/main/scala/DirectMapping.scala rdb/src/main/scala/RDB.scala
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/directmapping/src/main/scala/DirectMapping.scala	Sun Feb 13 01:06:00 2011 -0500
+++ b/directmapping/src/main/scala/DirectMapping.scala	Sun Feb 13 18:09:52 2011 -0500
@@ -104,17 +104,17 @@
     def databaseSemantics(db:Database):Graph = {
       NextBNode = 97
       val nodemap = dbToNodeMap(db)
-      Graph(db.relations flatMap { r => relationSemantics(db, nodemap, r) })
+      Graph(db.relations flatMap { r => relationSemantics(nodemap, r) })
     }
   
-    def relationSemantics(db:Database, nodemap:NodeMap, r:Relation):Graph =
+    def relationSemantics(nodemap:NodeMap, r:Relation):Graph =
       /* flatMap.toSet assumes that no two triples from directT would be the same.
        * We know this because relations with candidate keys are mapped to unique
        * subjects, and potentially redundant rows get unique blank node subjects.
        */
-      Graph(r.body flatMap { t => tupleSemantics(db, nodemap, r, t) })
+      Graph(r.body flatMap { t => tupleSemantics(nodemap, r, t) })
   
-    def tupleSemantics (db:Database, nodemap:NodeMap, r:Relation, t:Tuple):Set[Triple] = {
+    def tupleSemantics (nodemap:NodeMap, r:Relation, t:Tuple):Set[Triple] = {
       val s:SubjectNode =
 	// look for the first candidate key if available
         r.candidates.headOption match {
--- a/rdb/src/main/scala/RDB.scala	Sun Feb 13 01:06:00 2011 -0500
+++ b/rdb/src/main/scala/RDB.scala	Sun Feb 13 18:09:52 2011 -0500
@@ -60,7 +60,6 @@
   case class Header(private val m:Map[AttrName, Datatype]) extends PartialFunction[AttrName, Datatype] {
     def apply(a:AttrName) = m(a)
     def isDefinedAt(a:AttrName) = m isDefinedAt a
-    def attrNames:Set[AttrName] = m.keySet.toSet
   }
 
   object Header {
@@ -139,10 +138,7 @@
    * the expected operation are available
    */
   case class ForeignKeys (private val fks:Set[ForeignKey]) {
-    def has(as:AttrList) = fks exists { _.attrs == as }
-    def getFK(as:AttrList):ForeignKey = fks find { _.attrs == as } get
-    def unaryFKs:Set[ForeignKey] = fks filter { _.isUnary }
-    def definesActuallyUnaryFK(a:AttrName):Boolean = unaryFKs exists { _.attrs contains a }
+    def definesActuallyUnaryFK(a:AttrName):Boolean = fks filter { _.isUnary } exists { _.attrs contains a }
     def filter(p: ForeignKey => Boolean):Set[ForeignKey] = fks filter p
     def foreach(f:ForeignKey => Unit) = fks foreach f
   }
Set up and maintained by W3C Systems Team, please report bugs to sysreq@w3.org.

W3C would like to thank Microsoft who donated the server that allows us to run this service.