Index: /reasoner/measures/script.r
===================================================================
--- /reasoner/measures/script.r	(revision 249)
+++ /reasoner/measures/script.r	(revision 250)
@@ -21,5 +21,4 @@
   c("REASONING",   "REASONING",   "SCENARIO (incremental)", "SCENARIO (runtime)",  "REASONING (incremental)"))
 names(replaceTags) <- c("orig", "subst")
-
 
 # na-tolerant length function
@@ -160,7 +159,21 @@
 }
 
-# composes a diagram title from a type (name) and an indicator (name)
-my.composeDiagramTitle = function(type, indicator) {
-  return (paste(type, " (", indicator, ")", sep=""))
+#returns the last path segment of dir or an empty string
+my.lastPathSegment = function(dir) {
+  tmp <- str_match(dir, '.*/([^/]+)/?')
+  return (ifelse(is.na(tmp[1,2]), "", tmp[1,2]))
+}
+
+# composes a diagram title from a type (name), an indicator (name) and the directory name
+my.composeDiagramTitle = function(type, indicator, dir) {
+  if (length(dir) > 0) {
+    dir <- my.lastPathSegment(dir)
+    #remove prefix
+    dir <- str_remove(dir, "^benchmark-results-")
+    #remove date postfix
+    dir <- str_remove(dir, "-[:digit:]{8}$")
+    dir <- paste(" ", dir, sep="")
+  }
+  return (paste(type, dir, " (", indicator, ")", sep=""))
 }
 
@@ -175,19 +188,14 @@
 }
 
-#returns the last path segment of dir or an empty string
-my.lastPathSegment = function(dir) {
-  tmp <- str_match(dir, '.*/([^/]+)/?')
-  return (ifelse(is.na(tmp[1,2]), "", tmp[1,2]))
-}
-
 # creates the diagrams for a data set to be written into dir using the given indicator (name)
 my.createDiagrams = function(data, dir, indicator) {
   print(paste(" reasoning time diagram", indicator))
-  gg <- my.createErrorBarDiagram(
+  gg <-
+    my.createErrorBarDiagram(
     data, 
     data$REASONER_REASONING_TIME.mean, 
     "mean reasoning time", 
     data$REASONER_REASONING_TIME.ci, 
-    diagramTitle=my.composeDiagramTitle("Reasoning Time", indicator))
+    diagramTitle=my.composeDiagramTitle("Reasoning Time", indicator, dir))
   ggsave(
     filename=my.composeFileName(dir, "reasoningTime", indicator), 
@@ -200,5 +208,5 @@
     "mean translation time", 
     data$REASONER_TRANSLATION_TIME.ci, 
-    diagramTitle=my.composeDiagramTitle("Translation Time", indicator))
+    diagramTitle=my.composeDiagramTitle("Translation Time", indicator, dir))
   ggsave(
     filename=my.composeFileName(dir, "translationTime", indicator), 
@@ -211,5 +219,5 @@
     "mean evaluation time", 
     data$REASONER_TRANSLATION_TIME.ci, 
-    diagramTitle=my.composeDiagramTitle("Evaluation Time", indicator))
+    diagramTitle=my.composeDiagramTitle("Evaluation Time", indicator, dir))
   ggsave(
     filename=my.composeFileName(dir, "evaluationTime", indicator), 
@@ -217,17 +225,40 @@
 }
 
-dirs <- list.dirs(path="W:/offlineFiles/EASy-concepts/reasoner/measures", recursive=FALSE)
-for (d in dirs) {
-  if (!is.na(str_match(d, "benchmark-results.*"))) {
-    print(paste("processing folder ", d))
-    print(" loading data (1)")
-    data <- my.readData(d, 1)
-    my.createDiagrams(data, d, 1)
-    print(" loading data (all)")
-    data <- my.readData(d)
-    my.createDiagrams(data, d, "all")
-  }
-}
-
+# process the given directories, i.e., load data in folders starting with benchmark-results and
+# draw/store diagrams
+my.processDirs = function(dirs) {
+  for (d in dirs) {
+    if (!is.na(str_match(d, "benchmark-results.*"))) {
+      print(paste("processing folder ", d))
+      print(" loading data (1)")
+      data <- my.readData(d, 1)
+      my.createDiagrams(data, d, 1)
+      print(" loading data (all)")
+      data <- my.readData(d)
+      my.createDiagrams(data, d, "all")
+    }
+  }
+} 
+
+# process all directores in dir using my.processDirs
+my.processAll = function(dir) {
+  dirs <- list.dirs(path=dir, recursive=FALSE)
+  my.processDirs(dirs)
+}
+
+my.processAll("W:/offlineFiles/EASy-concepts/reasoner/measures")
+
+#dirs <- list.dirs(path="W:/offlineFiles/EASy-concepts/reasoner/measures", recursive=FALSE)
+#for (d in dirs) {
+#  if (!is.na(str_match(d, "benchmark-results.*"))) {
+#    print(paste("processing folder ", d))
+#    print(" loading data (1)")
+#    data <- my.readData(d, 1)
+#    my.createDiagrams(data, d, 1)
+#    print(" loading data (all)")
+#    data <- my.readData(d)
+#    my.createDiagrams(data, d, "all")
+#  }
+#}
 
 #data <- my.readFile('W:/offlineFiles/EASy-concepts/reasoner/measures/new', 'measurements-sse.tsv')
