Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/AndFilter.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/AndFilter.cs	(revision 5299)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/AndFilter.cs	(revision 5304)
@@ -43,5 +43,5 @@
       Filters = new List<IFilter>(filters);
     }
-    public AndFilter(DataTransfer.AndFilter filter) {
+    public AndFilter(DataTransfer.CombinedFilter filter) {
       Filters = new List<IFilter>(filter.Filters.Select(x => (IFilter)Activator.CreateInstance(Type.GetType(x.FilterTypeName), x)));
     }
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/OrFilter.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/OrFilter.cs	(revision 5299)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Filters/OrFilter.cs	(revision 5304)
@@ -43,5 +43,5 @@
       Filters = new List<IFilter>(filters);
     }
-    public OrFilter(DataTransfer.OrFilter filter) {
+    public OrFilter(DataTransfer.CombinedFilter filter) {
       Filters = new List<IFilter>(filter.Filters.Select(x => (IFilter)Activator.CreateInstance(Type.GetType(x.FilterTypeName), x)));
     }
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IQueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IQueryService.cs	(revision 5299)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/Interfaces/IQueryService.cs	(revision 5304)
@@ -35,8 +35,11 @@
 
     [OperationContract]
-    long QueryNumberOfRuns(Filter filter);
+    long GetNumberOfQueryResults(Filter filter);
 
     [OperationContract]
-    IEnumerable<Run> QueryRuns(Filter filter);
+    IEnumerable<long> GetQueryResultIds(Filter filter);
+
+    [OperationContract]
+    IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids);
   }
 }
Index: branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/QueryService.cs
===================================================================
--- branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/QueryService.cs	(revision 5299)
+++ branches/OKB (trunk integration)/HeuristicLab.Services.OKB/3.3/QueryService.cs	(revision 5304)
@@ -26,4 +26,5 @@
 using System.ServiceModel;
 using HeuristicLab.Services.OKB.DataAccess;
+using HeuristicLab.Services.OKB.DataTransfer;
 
 namespace HeuristicLab.Services.OKB {
@@ -33,168 +34,189 @@
   [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
   public class QueryService : IQueryService {
-    public IEnumerable<DataTransfer.Filter> GetFilters() {
-      List<DataTransfer.Filter> filters = new List<DataTransfer.Filter>();
-      using (OKBDataContext okb = new OKBDataContext()) {
-        //DataLoadOptions dlo = new DataLoadOptions();
-        //dlo.LoadWith<Algorithm>(x => x.AlgorithmData);
-        //dlo.LoadWith<AlgorithmData>(x => x.DataType);
-        //dlo.LoadWith<Problem>(x => x.ProblemData);
-        //dlo.LoadWith<ProblemData>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameter>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameter>(x => x.DataType);
-        //dlo.LoadWith<Result>(x => x.DataType);
-        //okb.LoadOptions = dlo;
-
+    public IEnumerable<Filter> GetFilters() {
+      List<Filter> filters = new List<Filter>();
+      using (OKBDataContext okb = new OKBDataContext()) {
         // run filters
-        filters.Add(new DataTransfer.OrdinalComparisonLongFilter(typeof(RunRandomSeedFilter).AssemblyQualifiedName, "Run Random Seed"));
-        filters.Add(new DataTransfer.OrdinalComparisonDateTimeFilter(typeof(RunCreatedDateFilter).AssemblyQualifiedName, "Run Created Date"));
-        filters.Add(new DataTransfer.SetComparisonStringFilter(typeof(RunUserNameFilter).AssemblyQualifiedName, "Run User Name"));
-        filters.Add(new DataTransfer.SetComparisonStringFilter(typeof(RunClientNameFilter).AssemblyQualifiedName, "Run Client Name"));
+        filters.Add(new OrdinalComparisonLongFilter(typeof(RunRandomSeedFilter).AssemblyQualifiedName, "Run Random Seed"));
+        filters.Add(new OrdinalComparisonDateTimeFilter(typeof(RunCreatedDateFilter).AssemblyQualifiedName, "Run Created Date"));
+        filters.Add(new SetComparisonStringFilter(typeof(RunUserNameFilter).AssemblyQualifiedName, "Run User Name"));
+        filters.Add(new SetComparisonStringFilter(typeof(RunClientNameFilter).AssemblyQualifiedName, "Run Client Name"));
 
         // result filters
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ResultNameFilter).AssemblyQualifiedName, "Result Name", okb.Results.Select(x => x.Name).Distinct().ToArray()));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringAvailableValuesFilter(typeof(ResultBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value Data Type Name", entity.Name, okb.ResultBlobValues.Where(x => x.Result.Name == entity.Name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonByteArrayFilter(typeof(ResultBlobValueValueFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value", entity.Name));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "bit").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonBoolFilter(typeof(ResultBoolValueValueFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value", entity.Name));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "float").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonDoubleFilter(typeof(ResultFloatValueValueFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value", entity.Name));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "bigint").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonLongFilter(typeof(ResultIntValueValueFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value", entity.Name));
-        foreach (Result entity in okb.Results.Where(x => x.DataType.SqlName == "nvarchar").AsEnumerable().Distinct<Result>(new GenericEqualityComparer<Result>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringFilter(typeof(ResultStringValueValueFilter).AssemblyQualifiedName, "Result " + entity.Name + " Value", entity.Name));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ResultNameFilter).AssemblyQualifiedName, "Result Name", okb.Results.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ResultBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Result " + name + " Value Data Type Name", name, okb.ResultBlobValues.Where(x => x.Result.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ResultBlobValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ResultBoolValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ResultFloatValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ResultIntValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
+        foreach (string name in okb.Results.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(ResultStringValueValueFilter).AssemblyQualifiedName, "Result " + name + " Value", name));
 
         // algorithm parameter filters
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterNameFilter).AssemblyQualifiedName, "Algorithm Parameter Name", okb.AlgorithmParameters.Select(x => x.Name).Distinct().ToArray()));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value Data Type Name", entity.Name, okb.AlgorithmParameterBlobValues.Where(x => x.AlgorithmParameter.Name == entity.Name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonByteArrayFilter(typeof(AlgorithmParameterBlobValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value", entity.Name));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bit").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonBoolFilter(typeof(AlgorithmParameterBoolValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value", entity.Name));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "float").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonDoubleFilter(typeof(AlgorithmParameterFloatValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value", entity.Name));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bigint").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonLongFilter(typeof(AlgorithmParameterIntValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value", entity.Name));
-        foreach (AlgorithmParameter entity in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "nvarchar").AsEnumerable().Distinct<AlgorithmParameter>(new GenericEqualityComparer<AlgorithmParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringFilter(typeof(AlgorithmParameterStringValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + entity.Name + " Value", entity.Name));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterNameFilter).AssemblyQualifiedName, "Algorithm Parameter Name", okb.AlgorithmParameters.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(AlgorithmParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value Data Type Name", name, okb.AlgorithmParameterBlobValues.Where(x => x.AlgorithmParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(AlgorithmParameterBlobValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(AlgorithmParameterBoolValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(AlgorithmParameterFloatValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(AlgorithmParameterIntValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
+        foreach (string name in okb.AlgorithmParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(AlgorithmParameterStringValueValueFilter).AssemblyQualifiedName, "Algorithm Parameter " + name + " Value", name));
 
         // algorithm filters
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(AlgorithmNameFilter).AssemblyQualifiedName, "Algorithm Name", okb.Algorithms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(AlgorithmClassNameFilter).AssemblyQualifiedName, "Algorithm Class Name", okb.AlgorithmClasses.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(AlgorithmPlatformNameFilter).AssemblyQualifiedName, "Algorithm Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(AlgorithmDataDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Data Type Name", okb.Algorithms.Select(x => x.AlgorithmData.DataType.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmNameFilter).AssemblyQualifiedName, "Algorithm Name", okb.Algorithms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmClassNameFilter).AssemblyQualifiedName, "Algorithm Class Name", okb.AlgorithmClasses.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmPlatformNameFilter).AssemblyQualifiedName, "Algorithm Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(AlgorithmDataDataTypeNameFilter).AssemblyQualifiedName, "Algorithm Data Type Name", okb.Algorithms.Select(x => x.AlgorithmData.DataType.Name).Distinct().ToArray()));
 
         // problem parameter filters
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ProblemParameterNameFilter).AssemblyQualifiedName, "Problem Parameter Name", okb.ProblemParameters.Select(x => x.Name).Distinct().ToArray()));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringAvailableValuesFilter(typeof(ProblemParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value Data Type Name", entity.Name, okb.ProblemParameterBlobValues.Where(x => x.ProblemParameter.Name == entity.Name).Select(x => x.DataType.Name).Distinct().ToArray()));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonByteArrayFilter(typeof(ProblemParameterBlobValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value", entity.Name));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bit").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameEqualityComparisonBoolFilter(typeof(ProblemParameterBoolValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value", entity.Name));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "float").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonDoubleFilter(typeof(ProblemParameterFloatValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value", entity.Name));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bigint").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameOrdinalComparisonLongFilter(typeof(ProblemParameterIntValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value", entity.Name));
-        foreach (ProblemParameter entity in okb.ProblemParameters.Where(x => x.DataType.SqlName == "nvarchar").AsEnumerable().Distinct<ProblemParameter>(new GenericEqualityComparer<ProblemParameter>((x, y) => x.Name == y.Name)))
-          filters.Add(new DataTransfer.NameSetComparisonStringFilter(typeof(ProblemParameterStringValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + entity.Name + " Value", entity.Name));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemParameterNameFilter).AssemblyQualifiedName, "Problem Parameter Name", okb.ProblemParameters.Select(x => x.Name).Distinct().ToArray()));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringAvailableValuesFilter(typeof(ProblemParameterBlobValueDataTypeNameFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value Data Type Name", name, okb.ProblemParameterBlobValues.Where(x => x.ProblemParameter.Name == name).Select(x => x.DataType.Name).Distinct().ToArray()));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "varbinary").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonByteArrayFilter(typeof(ProblemParameterBlobValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bit").Select(x => x.Name).Distinct())
+          filters.Add(new NameEqualityComparisonBoolFilter(typeof(ProblemParameterBoolValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "float").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonDoubleFilter(typeof(ProblemParameterFloatValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "bigint").Select(x => x.Name).Distinct())
+          filters.Add(new NameOrdinalComparisonLongFilter(typeof(ProblemParameterIntValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
+        foreach (string name in okb.ProblemParameters.Where(x => x.DataType.SqlName == "nvarchar").Select(x => x.Name).Distinct())
+          filters.Add(new NameSetComparisonStringFilter(typeof(ProblemParameterStringValueValueFilter).AssemblyQualifiedName, "Problem Parameter " + name + " Value", name));
 
         // problem filters
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ProblemNameFilter).AssemblyQualifiedName, "Problem Name", okb.Problems.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ProblemClassNameFilter).AssemblyQualifiedName, "Problem Class Name", okb.ProblemClasses.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ProblemPlatformNameFilter).AssemblyQualifiedName, "Problem Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
-        filters.Add(new DataTransfer.SetComparisonStringAvailableValuesFilter(typeof(ProblemDataDataTypeNameFilter).AssemblyQualifiedName, "Problem Data Type Name", okb.Problems.Select(x => x.ProblemData.DataType.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemNameFilter).AssemblyQualifiedName, "Problem Name", okb.Problems.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemClassNameFilter).AssemblyQualifiedName, "Problem Class Name", okb.ProblemClasses.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemPlatformNameFilter).AssemblyQualifiedName, "Problem Platform Name", okb.Platforms.Select(x => x.Name).Distinct().ToArray()));
+        filters.Add(new SetComparisonStringAvailableValuesFilter(typeof(ProblemDataDataTypeNameFilter).AssemblyQualifiedName, "Problem Data Type Name", okb.Problems.Select(x => x.ProblemData.DataType.Name).Distinct().ToArray()));
 
         // and/or filters
-        filters.Add(new DataTransfer.AndFilter(typeof(AndFilter).AssemblyQualifiedName, "And"));
-        filters.Add(new DataTransfer.OrFilter(typeof(OrFilter).AssemblyQualifiedName, "Or"));
+        filters.Add(new CombinedFilter(typeof(AndFilter).AssemblyQualifiedName, "AND", BooleanOperation.And));
+        filters.Add(new CombinedFilter(typeof(OrFilter).AssemblyQualifiedName, "OR", BooleanOperation.Or));
       }
       return filters.OrderBy(x => x.Label);
     }
-    public long QueryNumberOfRuns(DataTransfer.Filter filter) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        IFilter convertedFilter = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
-        return okb.Runs.Where(convertedFilter.Expression).LongCount();
-      }
-    }
-    public IEnumerable<DataTransfer.Run> QueryRuns(DataTransfer.Filter filter) {
-      using (OKBDataContext okb = new OKBDataContext()) {
-        //DataLoadOptions dlo = new DataLoadOptions();
-        //dlo.LoadWith<Run>(x => x.ResultBlobValues);
-        //dlo.LoadWith<Run>(x => x.ResultBoolValues);
-        //dlo.LoadWith<Run>(x => x.ResultFloatValues);
-        //dlo.LoadWith<Run>(x => x.ResultIntValues);
-        //dlo.LoadWith<Run>(x => x.ResultStringValues);
-        //dlo.LoadWith<Run>(x => x.Experiment);
-        //dlo.LoadWith<ResultBlobValue>(x => x.Result);
-        //dlo.LoadWith<ResultBlobValue>(x => x.DataType);
-        //dlo.LoadWith<ResultBoolValue>(x => x.Result);
-        //dlo.LoadWith<ResultBoolValue>(x => x.DataType);
-        //dlo.LoadWith<ResultFloatValue>(x => x.Result);
-        //dlo.LoadWith<ResultFloatValue>(x => x.DataType);
-        //dlo.LoadWith<ResultIntValue>(x => x.Result);
-        //dlo.LoadWith<ResultIntValue>(x => x.DataType);
-        //dlo.LoadWith<ResultStringValue>(x => x.Result);
-        //dlo.LoadWith<ResultStringValue>(x => x.DataType);
-        //dlo.LoadWith<Result>(x => x.Algorithm);
-        //dlo.LoadWith<Result>(x => x.DataType);
-        //dlo.LoadWith<Experiment>(x => x.Algorithm);
-        //dlo.LoadWith<Experiment>(x => x.Problem);
-        //dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBlobValues);
-        //dlo.LoadWith<Experiment>(x => x.AlgorithmParameterBoolValues);
-        //dlo.LoadWith<Experiment>(x => x.AlgorithmParameterFloatValues);
-        //dlo.LoadWith<Experiment>(x => x.AlgorithmParameterIntValues);
-        //dlo.LoadWith<Experiment>(x => x.AlgorithmParameterStringValues);
-        //dlo.LoadWith<Experiment>(x => x.ProblemParameterBlobValues);
-        //dlo.LoadWith<Experiment>(x => x.ProblemParameterBoolValues);
-        //dlo.LoadWith<Experiment>(x => x.ProblemParameterFloatValues);
-        //dlo.LoadWith<Experiment>(x => x.ProblemParameterIntValues);
-        //dlo.LoadWith<Experiment>(x => x.ProblemParameterStringValues);
-        //dlo.LoadWith<AlgorithmParameterBlobValue>(x => x.AlgorithmParameter);
-        //dlo.LoadWith<AlgorithmParameterBlobValue>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameterBoolValue>(x => x.AlgorithmParameter);
-        //dlo.LoadWith<AlgorithmParameterBoolValue>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameterFloatValue>(x => x.AlgorithmParameter);
-        //dlo.LoadWith<AlgorithmParameterFloatValue>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameterIntValue>(x => x.AlgorithmParameter);
-        //dlo.LoadWith<AlgorithmParameterIntValue>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameterStringValue>(x => x.AlgorithmParameter);
-        //dlo.LoadWith<AlgorithmParameterStringValue>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameterBlobValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<ProblemParameterBlobValue>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameterBoolValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<ProblemParameterBoolValue>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameterFloatValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<ProblemParameterFloatValue>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameterIntValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<ProblemParameterIntValue>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameterStringValue>(x => x.ProblemParameter);
-        //dlo.LoadWith<ProblemParameterStringValue>(x => x.DataType);
-        //dlo.LoadWith<AlgorithmParameter>(x => x.Algorithm);
-        //dlo.LoadWith<AlgorithmParameter>(x => x.DataType);
-        //dlo.LoadWith<ProblemParameter>(x => x.Problem);
-        //dlo.LoadWith<ProblemParameter>(x => x.DataType);
-        //dlo.LoadWith<Algorithm>(x => x.AlgorithmClass);
-        //dlo.LoadWith<Algorithm>(x => x.Platform);
-        //dlo.LoadWith<Problem>(x => x.ProblemClass);
-        //dlo.LoadWith<Problem>(x => x.Platform);
-        //okb.LoadOptions = dlo;
-
+
+    public long GetNumberOfQueryResults(Filter filter) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return FilterRuns(okb.Runs, filter).LongCount();
+      }
+    }
+
+    public IEnumerable<long> GetQueryResultIds(Filter filter) {
+      using (OKBDataContext okb = new OKBDataContext()) {
+        return FilterRuns(okb.Runs, filter).Select(x => x.Id).ToArray();
+      }
+    }
+
+    public IEnumerable<QueryResult> GetQueryResults(IEnumerable<long> ids) {
+      using (OKBDataContext okb = new OKBDataContext()) {
         DataLoadOptions dlo = new DataLoadOptions();
-        dlo.LoadWith<Run>(x => x.ResultBlobValues);
-        dlo.LoadWith<Run>(x => x.ResultBoolValues);
-        dlo.LoadWith<Run>(x => x.ResultFloatValues);
-        dlo.LoadWith<Run>(x => x.ResultIntValues);
-        dlo.LoadWith<Run>(x => x.ResultStringValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultBlobValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultBoolValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultFloatValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultIntValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.ResultStringValues);
+        dlo.LoadWith<DataAccess.Run>(x => x.Experiment);
+        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.ResultBoolValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultFloatValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultIntValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.ResultStringValue>(x => x.Result);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBlobValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterBoolValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterFloatValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterIntValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.AlgorithmParameterStringValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBlobValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterBoolValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterFloatValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterIntValues);
+        dlo.LoadWith<DataAccess.Experiment>(x => x.ProblemParameterStringValues);
+        //dlo.LoadWith<DataAccess.Experiment>(x => x.Algorithm);
+        //dlo.LoadWith<DataAccess.Experiment>(x => x.Problem);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.AlgorithmParameterBoolValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterFloatValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterIntValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.AlgorithmParameterStringValue>(x => x.AlgorithmParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterBlobValue>(x => x.DataType);
+        dlo.LoadWith<DataAccess.ProblemParameterBoolValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterFloatValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterIntValue>(x => x.ProblemParameter);
+        dlo.LoadWith<DataAccess.ProblemParameterStringValue>(x => x.ProblemParameter);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmParameters);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Results);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.AlgorithmClass);
+        //dlo.LoadWith<DataAccess.Algorithm>(x => x.Platform);
+        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemParameters);
+        //dlo.LoadWith<DataAccess.Problem>(x => x.ProblemClass);
         okb.LoadOptions = dlo;
 
-        IFilter convertedFilter = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
-        var runs = okb.Runs.Where(convertedFilter.Expression).ToArray();
-        var result = runs.Select(x => Convert.ToDto(x)).ToArray();
-        return result;
-      }
+        return okb.Runs.Where(x => ids.Contains(x.Id)).Select(x => ConvertToQueryResult(x)).ToArray();
+      }
+    }
+
+    private IQueryable<DataAccess.Run> FilterRuns(IQueryable<DataAccess.Run> runs, Filter filter) {
+      IFilter f = (IFilter)Activator.CreateInstance(Type.GetType(filter.FilterTypeName), filter);
+      return runs.Where(f.Expression);
+    }
+
+    private QueryResult ConvertToQueryResult(DataAccess.Run run) {
+      List<QueryValue> algorithmParameters = new List<QueryValue>();
+      List<QueryValue> problemParameters = new List<QueryValue>();
+      List<QueryValue> results = new List<QueryValue>();
+
+      foreach (DataAccess.AlgorithmParameterBlobValue value in run.Experiment.AlgorithmParameterBlobValues)
+        algorithmParameters.Add(new QueryBlobValue { Name = value.AlgorithmParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.AlgorithmParameterBoolValue value in run.Experiment.AlgorithmParameterBoolValues)
+        algorithmParameters.Add(new QueryBoolValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterFloatValue value in run.Experiment.AlgorithmParameterFloatValues)
+        algorithmParameters.Add(new QueryFloatValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterIntValue value in run.Experiment.AlgorithmParameterIntValues)
+        algorithmParameters.Add(new QueryIntValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+      foreach (DataAccess.AlgorithmParameterStringValue value in run.Experiment.AlgorithmParameterStringValues)
+        algorithmParameters.Add(new QueryStringValue { Name = value.AlgorithmParameter.Name, Value = value.Value });
+
+      foreach (DataAccess.ProblemParameterBlobValue value in run.Experiment.ProblemParameterBlobValues)
+        problemParameters.Add(new QueryBlobValue { Name = value.ProblemParameter.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.ProblemParameterBoolValue value in run.Experiment.ProblemParameterBoolValues)
+        problemParameters.Add(new QueryBoolValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterFloatValue value in run.Experiment.ProblemParameterFloatValues)
+        problemParameters.Add(new QueryFloatValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterIntValue value in run.Experiment.ProblemParameterIntValues)
+        problemParameters.Add(new QueryIntValue { Name = value.ProblemParameter.Name, Value = value.Value });
+      foreach (DataAccess.ProblemParameterStringValue value in run.Experiment.ProblemParameterStringValues)
+        problemParameters.Add(new QueryStringValue { Name = value.ProblemParameter.Name, Value = value.Value });
+
+      foreach (DataAccess.ResultBlobValue value in run.ResultBlobValues)
+        results.Add(new QueryBlobValue { Name = value.Result.Name, DataTypeName = value.DataType.Name + " (" + value.DataType.TypeName + ")", Value = value.Value.ToArray() });
+      foreach (DataAccess.ResultBoolValue value in run.ResultBoolValues)
+        results.Add(new QueryBoolValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultFloatValue value in run.ResultFloatValues)
+        results.Add(new QueryFloatValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultIntValue value in run.ResultIntValues)
+        results.Add(new QueryIntValue { Name = value.Result.Name, Value = value.Value });
+      foreach (DataAccess.ResultStringValue value in run.ResultStringValues)
+        results.Add(new QueryStringValue { Name = value.Result.Name, Value = value.Value });
+
+      QueryResult result = new QueryResult();
+      result.Id = run.Id;
+      result.AlgorithmParameters = algorithmParameters;
+      result.ProblemParameters = problemParameters;
+      result.Results = results;
+      return result;
     }
   }
