Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/AndFilterView.Designer.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/AndFilterView.Designer.cs	(revision 5301)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-namespace HeuristicLab.Clients.OKB {
-  partial class AndFilterView {
-    /// <summary> 
-    /// Required designer variable.
-    /// </summary>
-    private System.ComponentModel.IContainer components = null;
-
-    /// <summary> 
-    /// Clean up any resources being used.
-    /// </summary>
-    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-    protected override void Dispose(bool disposing) {
-      if (disposing) {
-        if (components != null) components.Dispose();
-      }
-      base.Dispose(disposing);
-    }
-
-    #region Component Designer generated code
-
-    /// <summary> 
-    /// Required method for Designer support - do not modify 
-    /// the contents of this method with the code editor.
-    /// </summary>
-    private void InitializeComponent() {
-      this.SuspendLayout();
-      // 
-      // AndFilterView
-      // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-      this.Name = "AndFilterView";
-      this.Size = new System.Drawing.Size(727, 327);
-      this.ResumeLayout(false);
-
-    }
-
-    #endregion
-
-
-
-
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/AndFilterView.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/AndFilterView.cs	(revision 5301)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Windows.Forms;
-using HeuristicLab.MainForm;
-using HeuristicLab.MainForm.WindowsForms;
-
-namespace HeuristicLab.Clients.OKB {
-  [View("AndFilter View")]
-  [Content(typeof(AndFilter), true)]
-  public partial class AndFilterView : CombinedFilterView {
-    public new AndFilter Content {
-      get { return (AndFilter)base.Content; }
-      set { base.Content = value; }
-    }
-
-    public AndFilterView() {
-      InitializeComponent();
-      string nl = Environment.NewLine;
-      label.Text = "A" + nl + "N" + nl + "D";
-    }
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/CombinedFilterView.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/CombinedFilterView.cs	(revision 5301)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/CombinedFilterView.cs	(revision 5304)
@@ -20,4 +20,5 @@
 #endregion
 
+using System;
 using System.Collections.Generic;
 using System.Windows.Forms;
@@ -48,5 +49,9 @@
       base.OnContentChanged();
       RemoveFilters();
+      label.Text = string.Empty;
       if (Content != null) {
+        string nl = Environment.NewLine;
+        label.Text = Content.Operation == BooleanOperation.And ? "A" + nl + "N" + nl + "D" : "O" + nl + "R";
+
         foreach (Filter filter in Content.Filters)
           AddFilter(filter);
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/OrFilterView.Designer.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/OrFilterView.Designer.cs	(revision 5301)
+++ 	(revision )
@@ -1,65 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-namespace HeuristicLab.Clients.OKB {
-  partial class OrFilterView {
-    /// <summary> 
-    /// Required designer variable.
-    /// </summary>
-    private System.ComponentModel.IContainer components = null;
-
-    /// <summary> 
-    /// Clean up any resources being used.
-    /// </summary>
-    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-    protected override void Dispose(bool disposing) {
-      if (disposing) {
-        if (components != null) components.Dispose();
-      }
-      base.Dispose(disposing);
-    }
-
-    #region Component Designer generated code
-
-    /// <summary> 
-    /// Required method for Designer support - do not modify 
-    /// the contents of this method with the code editor.
-    /// </summary>
-    private void InitializeComponent() {
-      this.SuspendLayout();
-      // 
-      // OrFilterView
-      // 
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
-      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-      this.Name = "OrFilterView";
-      this.Size = new System.Drawing.Size(727, 327);
-      this.ResumeLayout(false);
-
-    }
-
-    #endregion
-
-
-
-
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/OrFilterView.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/OrFilterView.cs	(revision 5301)
+++ 	(revision )
@@ -1,42 +1,0 @@
-#region License Information
-/* HeuristicLab
- * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
- *
- * This file is part of HeuristicLab.
- *
- * HeuristicLab is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * HeuristicLab is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
- */
-#endregion
-
-using System;
-using System.Windows.Forms;
-using HeuristicLab.MainForm;
-using HeuristicLab.MainForm.WindowsForms;
-
-namespace HeuristicLab.Clients.OKB {
-  [View("OrFilter View")]
-  [Content(typeof(OrFilter), true)]
-  public partial class OrFilterView : CombinedFilterView {
-    public new OrFilter Content {
-      get { return (OrFilter)base.Content; }
-      set { base.Content = value; }
-    }
-
-    public OrFilterView() {
-      InitializeComponent();
-      string nl = Environment.NewLine;
-      label.Text = "O" + nl + "R";
-    }
-  }
-}
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs	(revision 5301)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.Designer.cs	(revision 5304)
@@ -46,13 +46,13 @@
     private void InitializeComponent() {
       this.components = new System.ComponentModel.Container();
+      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QueryView));
       this.refreshResultsButton = new System.Windows.Forms.Button();
       this.toolTip = new System.Windows.Forms.ToolTip(this.components);
-      this.showRunsButton = new System.Windows.Forms.Button();
-      this.runCollectionView = new HeuristicLab.Clients.OKB.RunCollectionView();
+      this.runCollectionView = new HeuristicLab.Optimization.Views.RunCollectionView();
       this.splitContainer = new System.Windows.Forms.SplitContainer();
       this.filtersGroupBox = new System.Windows.Forms.GroupBox();
+      this.filterPanel = new System.Windows.Forms.Panel();
       this.resultsGroupBox = new System.Windows.Forms.GroupBox();
-      this.nrOfRunsButton = new System.Windows.Forms.Button();
-      this.filterPanel = new System.Windows.Forms.Panel();
+      this.deserializeBlobsCheckBox = new System.Windows.Forms.CheckBox();
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
       this.splitContainer.Panel1.SuspendLayout();
@@ -73,14 +73,4 @@
       this.refreshResultsButton.UseVisualStyleBackColor = true;
       this.refreshResultsButton.Click += new System.EventHandler(this.refreshResultsButton_Click);
-      // 
-      // showRunsButton
-      // 
-      this.showRunsButton.Location = new System.Drawing.Point(36, 19);
-      this.showRunsButton.Name = "showRunsButton";
-      this.showRunsButton.Size = new System.Drawing.Size(75, 24);
-      this.showRunsButton.TabIndex = 1;
-      this.showRunsButton.Text = "&Show Runs";
-      this.showRunsButton.UseVisualStyleBackColor = true;
-      this.showRunsButton.Click += new System.EventHandler(this.showRunsButton_Click);
       // 
       // runCollectionView
@@ -130,30 +120,4 @@
       this.filtersGroupBox.Text = "Filters";
       // 
-      // resultsGroupBox
-      // 
-      this.resultsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
-                  | System.Windows.Forms.AnchorStyles.Left)
-                  | System.Windows.Forms.AnchorStyles.Right)));
-      this.resultsGroupBox.Controls.Add(this.nrOfRunsButton);
-      this.resultsGroupBox.Controls.Add(this.refreshResultsButton);
-      this.resultsGroupBox.Controls.Add(this.runCollectionView);
-      this.resultsGroupBox.Controls.Add(this.showRunsButton);
-      this.resultsGroupBox.Location = new System.Drawing.Point(0, 3);
-      this.resultsGroupBox.Name = "resultsGroupBox";
-      this.resultsGroupBox.Size = new System.Drawing.Size(734, 211);
-      this.resultsGroupBox.TabIndex = 0;
-      this.resultsGroupBox.TabStop = false;
-      this.resultsGroupBox.Text = "Results";
-      // 
-      // nrOfRunsButton
-      // 
-      this.nrOfRunsButton.Location = new System.Drawing.Point(117, 19);
-      this.nrOfRunsButton.Name = "nrOfRunsButton";
-      this.nrOfRunsButton.Size = new System.Drawing.Size(75, 23);
-      this.nrOfRunsButton.TabIndex = 3;
-      this.nrOfRunsButton.Text = "No. of Runs";
-      this.nrOfRunsButton.UseVisualStyleBackColor = true;
-      this.nrOfRunsButton.Click += new System.EventHandler(this.nrOfRunsButton_Click);
-      // 
       // filterPanel
       // 
@@ -165,4 +129,31 @@
       this.filterPanel.Size = new System.Drawing.Size(722, 189);
       this.filterPanel.TabIndex = 0;
+      // 
+      // resultsGroupBox
+      // 
+      this.resultsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.resultsGroupBox.Controls.Add(this.deserializeBlobsCheckBox);
+      this.resultsGroupBox.Controls.Add(this.refreshResultsButton);
+      this.resultsGroupBox.Controls.Add(this.runCollectionView);
+      this.resultsGroupBox.Location = new System.Drawing.Point(0, 3);
+      this.resultsGroupBox.Name = "resultsGroupBox";
+      this.resultsGroupBox.Size = new System.Drawing.Size(734, 211);
+      this.resultsGroupBox.TabIndex = 0;
+      this.resultsGroupBox.TabStop = false;
+      this.resultsGroupBox.Text = "Results";
+      // 
+      // deserializeBlobsCheckBox
+      // 
+      this.deserializeBlobsCheckBox.AutoSize = true;
+      this.deserializeBlobsCheckBox.Checked = true;
+      this.deserializeBlobsCheckBox.CheckState = System.Windows.Forms.CheckState.Checked;
+      this.deserializeBlobsCheckBox.Location = new System.Drawing.Point(62, 24);
+      this.deserializeBlobsCheckBox.Name = "deserializeBlobsCheckBox";
+      this.deserializeBlobsCheckBox.Size = new System.Drawing.Size(106, 17);
+      this.deserializeBlobsCheckBox.TabIndex = 3;
+      this.deserializeBlobsCheckBox.Text = "&Deserialize Blobs";
+      this.deserializeBlobsCheckBox.UseVisualStyleBackColor = true;
       // 
       // QueryView
@@ -179,4 +170,5 @@
       this.filtersGroupBox.ResumeLayout(false);
       this.resultsGroupBox.ResumeLayout(false);
+      this.resultsGroupBox.PerformLayout();
       this.ResumeLayout(false);
 
@@ -187,11 +179,10 @@
     private System.Windows.Forms.Button refreshResultsButton;
     private System.Windows.Forms.ToolTip toolTip;
-    private RunCollectionView runCollectionView;
-    private System.Windows.Forms.Button showRunsButton;
+    private HeuristicLab.Optimization.Views.RunCollectionView runCollectionView;
     private System.Windows.Forms.SplitContainer splitContainer;
     private System.Windows.Forms.GroupBox filtersGroupBox;
     private System.Windows.Forms.GroupBox resultsGroupBox;
-    private System.Windows.Forms.Button nrOfRunsButton;
     private System.Windows.Forms.Panel filterPanel;
+    private System.Windows.Forms.CheckBox deserializeBlobsCheckBox;
 
   }
Index: branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs	(revision 5301)
+++ branches/OKB (trunk integration)/HeuristicLab.Clients.OKB/3.3/Views/QueryView.cs	(revision 5304)
@@ -21,8 +21,14 @@
 
 using System;
+using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Windows.Forms;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
 using HeuristicLab.MainForm;
 using HeuristicLab.MainForm.WindowsForms;
+using HeuristicLab.Optimization;
+using HeuristicLab.Persistence.Default.Xml;
 
 namespace HeuristicLab.Clients.OKB {
@@ -30,5 +36,5 @@
   [Content(typeof(OKBClient), false)]
   public sealed partial class QueryView : HeuristicLab.MainForm.WindowsForms.View {
-    private AndFilterView andFilterView;
+    private CombinedFilterView combinedFilterView;
 
     public QueryView() {
@@ -40,20 +46,20 @@
       this.Cursor = Cursors.AppStarting;
 
-      Func<AndFilter> func = () => {
-        return OKBClient.Instance.GetFilters().OfType<AndFilter>().FirstOrDefault();
+      Func<CombinedFilter> func = () => {
+        return OKBClient.Instance.GetFilters().OfType<CombinedFilter>().Where(x => x.Operation == BooleanOperation.And).FirstOrDefault();
       };
 
       func.BeginInvoke((IAsyncResult result) => {
-        AndFilter filter = func.EndInvoke(result);
-        if (InvokeRequired) Invoke(new Action<AndFilter>(FinishedLoadingAndFilter), filter);
-        else FinishedLoadingAndFilter(filter);
+        CombinedFilter filter = func.EndInvoke(result);
+        if (InvokeRequired) Invoke(new Action<CombinedFilter>(FinishedLoadingFilter), filter);
+        else FinishedLoadingFilter(filter);
       }, null);
     }
 
-    private void FinishedLoadingAndFilter(AndFilter filter) {
+    private void FinishedLoadingFilter(CombinedFilter filter) {
       if (filter != null) {
-        andFilterView = (AndFilterView)MainFormManager.CreateView(typeof(AndFilterView));
-        andFilterView.Content = (AndFilter)filter.Clone();
-        Control control = (Control)andFilterView;
+        combinedFilterView = (CombinedFilterView)MainFormManager.CreateView(typeof(CombinedFilterView));
+        combinedFilterView.Content = (CombinedFilter)filter.Clone();
+        Control control = (Control)combinedFilterView;
         control.Dock = DockStyle.Fill;
         filterPanel.Controls.Add(control);
@@ -65,24 +71,81 @@
     protected override void SetEnabledStateOfControls() {
       base.SetEnabledStateOfControls();
-      resultsGroupBox.Enabled = andFilterView != null;
-      showRunsButton.Enabled = (runCollectionView.Content != null) && (runCollectionView.Content.Count > 0);
+      resultsGroupBox.Enabled = combinedFilterView != null;
     }
 
     private void refreshResultsButton_Click(object sender, EventArgs e) {
-      DateTime start = DateTime.Now;
-      runCollectionView.Content = OKBClient.Instance.QueryRuns(andFilterView.Content);
-      MessageBox.Show((DateTime.Now - start).ToString());
+      bool deserialize = deserializeBlobsCheckBox.Checked;
+
+      System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
+      sw.Start();
+      long count = OKBClient.Instance.GetNumberOfQueryResults(combinedFilterView.Content);
+      sw.Stop();
+      MessageBox.Show(count.ToString() + " Runs");
+      if (MessageBox.Show(sw.Elapsed.ToString(), "GetNumberOfQueryResults", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+
+      sw.Restart();
+      var ids = OKBClient.Instance.GetQueryResultIds(combinedFilterView.Content);
+      sw.Stop();
+      if (MessageBox.Show(sw.Elapsed.ToString(), "GetQueryResultIds", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+
+      sw.Restart();
+      List<QueryResult> results = new List<QueryResult>();
+      while (ids.Count() > 0) {
+        results.AddRange(OKBClient.Instance.GetQueryResults(ids.Take(50)));
+        ids = ids.Skip(50);
+      }
+      sw.Stop();
+      if (MessageBox.Show(sw.Elapsed.ToString(), "GetQueryResults", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return;
+
+      sw.Restart();
+      IEnumerable<QueryResult> res = results.AsEnumerable();
+      RunCollection runs = new RunCollection();
+      runCollectionView.Content = runs;
+      while (res.Count() > 0) {
+        runs.AddRange(res.Take(50).Select(x => ConvertToOptimizationRun(x, deserialize)));
+        res = res.Skip(50);
+      }
+      sw.Stop();
+      MessageBox.Show(sw.Elapsed.ToString(), "Conversion", MessageBoxButtons.OK);
+
       SetEnabledStateOfControls();
     }
 
-    private void showRunsButton_Click(object sender, EventArgs e) {
-      DateTime start = DateTime.Now;
-      MainFormManager.MainForm.ShowContent(OKBClient.Instance.ConvertOKBRunsToOptimizationRuns(runCollectionView.Content));
-      MessageBox.Show((DateTime.Now - start).ToString());
+    private Optimization.IRun ConvertToOptimizationRun(QueryResult queryResult, bool deserialize) {
+      Optimization.Run run = new Optimization.Run();
+      foreach (QueryValue value in queryResult.AlgorithmParameters)
+        run.Parameters.Add(value.Name, ConvertToItem(value, deserialize));
+      foreach (QueryValue value in queryResult.ProblemParameters)
+        run.Parameters.Add(value.Name, ConvertToItem(value, deserialize));
+      foreach (QueryValue value in queryResult.Results)
+        run.Results.Add(value.Name, ConvertToItem(value, deserialize));
+      return run;
     }
 
-    private void nrOfRunsButton_Click(object sender, EventArgs e) {
-      long runs = OKBClient.Instance.QueryNumberOfRuns(andFilterView.Content);
-      MessageBox.Show(runs.ToString());
+    private IItem ConvertToItem(QueryValue value, bool deserialize) {
+      if (value is QueryBlobValue) {
+        if (deserialize) {
+          IItem item = null;
+          using (MemoryStream stream = new MemoryStream(((QueryBlobValue)value).Value)) {
+            try {
+              item = XmlParser.Deserialize<IItem>(stream);
+            }
+            catch (Exception) { }
+            stream.Close();
+          }
+          return item != null ? item : new StringValue(((QueryBlobValue)value).DataTypeName);
+        } else {
+          return new StringValue(((QueryBlobValue)value).DataTypeName);
+        }
+      } else if (value is QueryBoolValue) {
+        return new BoolValue(((QueryBoolValue)value).Value);
+      } else if (value is QueryFloatValue) {
+        return new DoubleValue(((QueryFloatValue)value).Value);
+      } else if (value is QueryIntValue) {
+        return new IntValue((int)((QueryIntValue)value).Value);
+      } else if (value is QueryStringValue) {
+        return new StringValue(((QueryStringValue)value).Value);
+      }
+      return null;
     }
   }
