Index: /trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSet.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSet.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/3.3/DataSet.cs	(revision 2053)
@@ -47,14 +47,4 @@
     public Problem Problem {
       get {
-        // lazy loading of problem from DB
-        if (problem == null) {
-          var persistedData = Store.Query(
-            "<" + Ontology.CedmaNameSpace + Guid + "> <" + Ontology.SerializedData.Uri + "> ?SerializedData .", 0, 10);
-          if (persistedData.Count() == 1) {
-            Literal persistedLiteral = (Literal)persistedData.First().Get("SerializedData");
-            this.problem = (Problem)PersistenceManager.RestoreFromGZip(Convert.FromBase64String((string)persistedLiteral.Value));
-          } else
-            this.problem = new Problem(); // no entry in the DB => create a new problem
-        }
         return problem;
       }
@@ -71,4 +61,5 @@
       name = "Data set";
       activated = false;
+      problem = new Problem();
     }
 
@@ -78,4 +69,10 @@
       guid = new Guid(dataSetEntity.Uri.Remove(0, Ontology.CedmaNameSpace.Length));
       name = guid.ToString();
+      var persistedData = Store.Query(
+        "<" + Ontology.CedmaNameSpace + Guid + "> <" + Ontology.SerializedData.Uri + "> ?SerializedData .", 0, 10);
+      if (persistedData.Count() == 1) {
+        Literal persistedLiteral = (Literal)persistedData.First().Get("SerializedData");
+        problem = (Problem)PersistenceManager.RestoreFromGZip(Convert.FromBase64String((string)persistedLiteral.Value));
+      } else problem = new Problem();
       activated = true;
     }
@@ -83,7 +80,10 @@
     public void Activate() {
       Entity myEntity = new Entity(Ontology.CedmaNameSpace + Guid);
-      Store.Add(new Statement(myEntity, Ontology.InstanceOf, Ontology.TypeDataSet));
-      Store.Add(new Statement(myEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(PersistenceManager.SaveToGZip(problem)))));
-      Store.Add(new Statement(myEntity, Ontology.Name, new Literal(name)));
+      Store.AddRange(
+        new Statement[] { 
+          new Statement(myEntity, Ontology.InstanceOf, Ontology.TypeDataSet),
+          new Statement(myEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(PersistenceManager.SaveToGZip(problem)))),
+          new Statement(myEntity, Ontology.Name, new Literal(name))
+        });
       activated = true;
     }
Index: /trunk/sources/HeuristicLab.CEDMA.Core/3.3/StoreProxy.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Core/3.3/StoreProxy.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.Core/3.3/StoreProxy.cs	(revision 2053)
@@ -76,4 +76,8 @@
     }
 
+    public void AddRange(ICollection<Statement> statements) {
+      ExecuteSavely(() => { store.AddRange(statements); return 1.0; });
+    }
+
     public ICollection<VariableBindings> Query(ICollection<Statement> query, int page, int pageSize) {
       return ExecuteSavely(() => store.Query(query, page, pageSize));
Index: /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/3.3/IStore.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/3.3/IStore.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.DB.Interfaces/3.3/IStore.cs	(revision 2053)
@@ -35,4 +35,7 @@
 
     [OperationContract]
+    void AddRange(ICollection<Statement> statements);
+
+    [OperationContract]
     ICollection<VariableBindings> Query(ICollection<Statement> query, int page, int pageSize);
 
Index: /trunk/sources/HeuristicLab.CEDMA.DB/3.3/Store.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.DB/3.3/Store.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.DB/3.3/Store.cs	(revision 2053)
@@ -61,17 +61,29 @@
     }
 
+    public void AddRange(ICollection<Statement> statements) {
+      lock (bigLock) {
+        foreach (Statement s in statements) {
+          store.Add(Translate(s));
+        }
+      }
+    }
+
 
     public ICollection<VariableBindings> Query(string query, int page, int pageSize) {
-      MyQueryResultSink resultSink = new MyQueryResultSink();
-      SemWeb.N3Reader n3Reader = new SemWeb.N3Reader(new StringReader(query));
-      SemWeb.Query.GraphMatch matcher = new SemWeb.Query.GraphMatch(n3Reader);
-      matcher.Run(store, resultSink);
-      return resultSink.Bindings.Skip(page*pageSize).Take(pageSize).ToList();
+      lock (bigLock) {
+        MyQueryResultSink resultSink = new MyQueryResultSink();
+        SemWeb.N3Reader n3Reader = new SemWeb.N3Reader(new StringReader(query));
+        SemWeb.Query.GraphMatch matcher = new SemWeb.Query.GraphMatch(n3Reader);
+        matcher.Run(store, resultSink);
+        return resultSink.Bindings.Skip(page * pageSize).Take(pageSize).ToList();
+      }
     }
 
     public ICollection<VariableBindings> Query(ICollection<Statement> query, int page, int pageSize) {
-      MyQueryResultSink resultSink = new MyQueryResultSink();
-      Translate(query).Run(store, resultSink);
-      return resultSink.Bindings.Skip(page * pageSize).Take(pageSize).ToList();
+      lock (bigLock) {
+        MyQueryResultSink resultSink = new MyQueryResultSink();
+        Translate(query).Run(store, resultSink);
+        return resultSink.Bindings.Skip(page * pageSize).Take(pageSize).ToList();
+      }
     }
 
Index: /trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/3.3/ExecuterBase.cs	(revision 2053)
@@ -71,24 +71,25 @@
     protected void StoreResults(IAlgorithm finishedAlgorithm) {
       Entity modelEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
-      store.Add(new Statement(modelEntity, Ontology.InstanceOf, Ontology.TypeModel));
-      StoreEntityAttribute(modelEntity, Ontology.TargetVariable, finishedAlgorithm.Model.TargetVariable);
-      StoreEntityAttribute(modelEntity, Ontology.Name, finishedAlgorithm.Description);
+      List<Statement> statements = new List<Statement>();
+      statements.Add(new Statement(modelEntity, Ontology.InstanceOf, Ontology.TypeModel));
+      statements.Add(new Statement(modelEntity, Ontology.TargetVariable, new Literal(finishedAlgorithm.Model.TargetVariable)));
+      statements.Add(new Statement(modelEntity, Ontology.Name, new Literal(finishedAlgorithm.Description)));
       
       IModel model = finishedAlgorithm.Model;
-      StoreEntityAttribute(modelEntity, Ontology.TrainingMeanSquaredError, model.TrainingMeanSquaredError);
-      StoreEntityAttribute(modelEntity, Ontology.ValidationMeanSquaredError, model.ValidationMeanSquaredError);
-      StoreEntityAttribute(modelEntity, Ontology.TestMeanSquaredError, model.TestMeanSquaredError);
-      StoreEntityAttribute(modelEntity, Ontology.TrainingCoefficientOfDetermination, model.TrainingCoefficientOfDetermination);
-      StoreEntityAttribute(modelEntity, Ontology.ValidationCoefficientOfDetermination, model.ValidationCoefficientOfDetermination);
-      StoreEntityAttribute(modelEntity, Ontology.TestCoefficientOfDetermination, model.TestCoefficientOfDetermination);
-      StoreEntityAttribute(modelEntity, Ontology.TrainingVarianceAccountedFor, model.TrainingVarianceAccountedFor);
-      StoreEntityAttribute(modelEntity, Ontology.ValidationVarianceAccountedFor, model.ValidationVarianceAccountedFor);
-      StoreEntityAttribute(modelEntity, Ontology.TestVarianceAccountedFor, model.TestVarianceAccountedFor);
-      StoreEntityAttribute(modelEntity, Ontology.TrainingMeanAbsolutePercentageError, model.TrainingMeanAbsolutePercentageError);
-      StoreEntityAttribute(modelEntity, Ontology.ValidationMeanAbsolutePercentageError, model.ValidationMeanAbsolutePercentageError);
-      StoreEntityAttribute(modelEntity, Ontology.TestMeanAbsolutePercentageError, model.TestMeanAbsolutePercentageError);
-      StoreEntityAttribute(modelEntity, Ontology.TrainingMeanAbsolutePercentageOfRangeError, model.TrainingMeanAbsolutePercentageOfRangeError);
-      StoreEntityAttribute(modelEntity, Ontology.ValidationMeanAbsolutePercentageOfRangeError, model.ValidationMeanAbsolutePercentageOfRangeError);
-      StoreEntityAttribute(modelEntity, Ontology.TestMeanAbsolutePercentageOfRangeError, model.TestMeanAbsolutePercentageOfRangeError);
+      statements.Add(new Statement(modelEntity, Ontology.TrainingMeanSquaredError, new Literal(model.TrainingMeanSquaredError)));
+      statements.Add(new Statement(modelEntity, Ontology.ValidationMeanSquaredError, new Literal(model.ValidationMeanSquaredError)));
+      statements.Add(new Statement(modelEntity, Ontology.TestMeanSquaredError, new Literal(model.TestMeanSquaredError)));
+      statements.Add(new Statement(modelEntity, Ontology.TrainingCoefficientOfDetermination, new Literal(model.TrainingCoefficientOfDetermination)));
+      statements.Add(new Statement(modelEntity, Ontology.ValidationCoefficientOfDetermination, new Literal(model.ValidationCoefficientOfDetermination)));
+      statements.Add(new Statement(modelEntity, Ontology.TestCoefficientOfDetermination, new Literal(model.TestCoefficientOfDetermination)));
+      statements.Add(new Statement(modelEntity, Ontology.TrainingVarianceAccountedFor, new Literal(model.TrainingVarianceAccountedFor)));
+      statements.Add(new Statement(modelEntity, Ontology.ValidationVarianceAccountedFor, new Literal(model.ValidationVarianceAccountedFor)));
+      statements.Add(new Statement(modelEntity, Ontology.TestVarianceAccountedFor, new Literal(model.TestVarianceAccountedFor)));
+      statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageError, new Literal(model.TrainingMeanAbsolutePercentageError)));
+      statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageError, new Literal(model.ValidationMeanAbsolutePercentageError)));
+      statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageError, new Literal(model.TestMeanAbsolutePercentageError)));
+      statements.Add(new Statement(modelEntity, Ontology.TrainingMeanAbsolutePercentageOfRangeError, new Literal(model.TrainingMeanAbsolutePercentageOfRangeError)));
+      statements.Add(new Statement(modelEntity, Ontology.ValidationMeanAbsolutePercentageOfRangeError, new Literal(model.ValidationMeanAbsolutePercentageOfRangeError)));
+      statements.Add(new Statement(modelEntity, Ontology.TestMeanAbsolutePercentageOfRangeError, new Literal(model.TestMeanAbsolutePercentageOfRangeError)));
 
       for (int i = 0; i < finishedAlgorithm.Dataset.Columns; i++) {
@@ -99,9 +100,9 @@
 
           Entity inputVariableEntity = new Entity(Ontology.CedmaNameSpace + Guid.NewGuid());
-          store.Add(new Statement(inputVariableEntity, Ontology.InstanceOf, Ontology.TypeVariableImpact));
-          store.Add(new Statement(modelEntity, Ontology.HasInputVariable, inputVariableEntity));
-          StoreEntityAttribute(inputVariableEntity, Ontology.EvaluationImpact, evalImpact);
-          StoreEntityAttribute(inputVariableEntity, Ontology.QualityImpact, qualImpact);
-          StoreEntityAttribute(inputVariableEntity, Ontology.Name, variableName);
+          statements.Add(new Statement(inputVariableEntity, Ontology.InstanceOf, Ontology.TypeVariableImpact));
+          statements.Add(new Statement(modelEntity, Ontology.HasInputVariable, inputVariableEntity));
+          statements.Add(new Statement(inputVariableEntity, Ontology.EvaluationImpact, new Literal(evalImpact)));
+          statements.Add(new Statement(inputVariableEntity, Ontology.QualityImpact, new Literal(qualImpact)));
+          statements.Add(new Statement(inputVariableEntity, Ontology.Name, new Literal(variableName)));
         }
         catch (ArgumentException) {
@@ -111,9 +112,6 @@
 
       byte[] serializedModel = PersistenceManager.SaveToGZip(model.Data);
-      store.Add(new Statement(modelEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(serializedModel))));
-    }
-
-    private void StoreEntityAttribute(Entity entity, Entity predicate, object value) {
-      store.Add(new Statement(entity, predicate, new Literal(value)));
+      statements.Add(new Statement(modelEntity, Ontology.SerializedData, new Literal(Convert.ToBase64String(serializedModel))));
+      store.AddRange(statements);
     }
 
Index: /trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs	(revision 2052)
+++ /trunk/sources/HeuristicLab.CEDMA.Server/3.3/GridExecuter.cs	(revision 2053)
@@ -94,13 +94,10 @@
             activeOperations.Remove(readyHandle);
             readyHandle.Close();
-            ProcessingEngine finishedEngine = null;
             try {
-              finishedEngine = jobManager.EndExecuteOperation(finishedOp);
+              ProcessingEngine finishedEngine = jobManager.EndExecuteOperation(finishedOp);
+              StoreResults(finishedAlgorithm);
             }
             catch (Exception badEx) {
               Trace.WriteLine("CEDMA Executer: Exception in job execution thread. " + badEx.Message);
-            }
-            if (finishedEngine != null) {
-              StoreResults(finishedAlgorithm);
             }
           }
