Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Algorithm.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Algorithm.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Algorithm.cs	(revision 2178)
@@ -0,0 +1,56 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  [Table(Name = "Algorithm")]
+  public class Algorithm {
+    public Algorithm() {
+      models = new EntitySet<Model>(attach_Model, detach_Model);
+    }
+
+    private int id;
+    [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private string name;
+    [Column(Storage = "name", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
+    public string Name {
+      get { return this.name; }
+      private set { this.name = value; }
+    }
+
+    private string description;
+    [Column(Storage = "description", DbType = "VarChar(200) NOT NULL", CanBeNull = true)]
+    public string Description {
+      get { return this.description; }
+      private set { this.description = value; }
+    }
+
+    private EntitySet<Model> models;
+    [Association(Storage = "models", ThisKey = "Id", OtherKey = "AlgorithmId")]
+    public EntitySet<Model> Models {
+      get {
+        if (models.HasLoadedOrAssignedValues)
+          return models;
+        return null;
+      }
+      set {
+        models.Assign(value);
+      }
+    }
+
+    private void attach_Model(Model model) {
+      model.Algorithm = this;
+    }
+
+    private void detach_Model(Model model) {
+      model.Algorithm = null;
+    }
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/HeuristicLab.Modeling.SQLiteBackend-3.2.csproj
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/HeuristicLab.Modeling.SQLiteBackend-3.2.csproj	(revision 2177)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/HeuristicLab.Modeling.SQLiteBackend-3.2.csproj	(revision 2178)
@@ -70,4 +70,7 @@
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
     </Reference>
+    <Reference Include="System.Data.Linq">
+      <RequiredTargetFramework>3.5</RequiredTargetFramework>
+    </Reference>
     <Reference Include="System.Xml.Linq">
       <RequiredTargetFramework>3.5</RequiredTargetFramework>
@@ -84,4 +87,12 @@
   </ItemGroup>
   <ItemGroup>
+    <ProjectReference Include="..\..\HeuristicLab.Core\3.2\HeuristicLab.Core-3.2.csproj">
+      <Project>{F43B59AB-2B8C-4570-BC1E-15592086517C}</Project>
+      <Name>HeuristicLab.Core-3.2</Name>
+    </ProjectReference>
+    <ProjectReference Include="..\..\HeuristicLab.DataAnalysis\3.2\HeuristicLab.DataAnalysis-3.2.csproj">
+      <Project>{7DD3A97A-56E9-462F-90E2-A351FE7AF5C2}</Project>
+      <Name>HeuristicLab.DataAnalysis-3.2</Name>
+    </ProjectReference>
     <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\HeuristicLab.PluginInfrastructure.csproj">
       <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>
@@ -90,5 +101,14 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Algorithm.cs" />
+    <Compile Include="InputVariable.cs" />
+    <Compile Include="InputVariableResult.cs" />
+    <Compile Include="Model.cs" />
+    <Compile Include="ModelingDataContext.cs" />
+    <Compile Include="ModelResult.cs" />
+    <Compile Include="Problem.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="Result.cs" />
+    <Compile Include="Variable.cs" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariable.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariable.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariable.cs	(revision 2178)
@@ -0,0 +1,56 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  [Table(Name = "InputVariable")]
+  public class InputVariable {
+    public InputVariable() {
+      this.model = default(EntityRef<Model>);
+      this.variable = default(EntityRef<Variable>);
+    }
+
+    public InputVariable(Model model, Variable variable) :base() {
+      this.modelId = model.Id;
+      this.model.Entity = model;
+      this.variableId = variable.Id;
+      this.variable.Entity = variable;
+    }
+
+    private int variableId;
+    [Column(Storage = "variableId", DbType = "Int not null", IsPrimaryKey = true)]
+    public int TargetVariableId {
+      get { return this.variableId; }
+      private set {
+        if (variableId != value) {
+          variableId = value;
+        }
+      }
+    }
+
+    private EntityRef<Variable> variable;
+    [Association(Storage="variable", ThisKey="variableId", OtherKey="Id", IsForeignKey=true)]
+    public Variable Variable {
+      get { return variable.Entity; }
+    }
+
+    private int modelId;
+    [Column(Storage = "modelId", DbType = "Int not null", IsPrimaryKey = true)]
+    public int ModelId {
+      get { return this.modelId; }
+      private set {
+        if (modelId != value) {
+          modelId = value;
+        }
+      }
+    }
+
+    private EntityRef<Model> model;
+    [Association(Storage = "model", ThisKey = "modelId", OtherKey = "Id", IsForeignKey = true)]
+    public Model Model {
+      get { return model.Entity; }
+    }
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariableResult.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariableResult.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/InputVariableResult.cs	(revision 2178)
@@ -0,0 +1,9 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  public class InputVariableResult {
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Model.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Model.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Model.cs	(revision 2178)
@@ -0,0 +1,110 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {  
+  [Table(Name="Model")]
+  public class Model {
+    public Model() {
+      targetVariable = default(EntityRef<Variable>);
+      algorithm = default(EntityRef<Algorithm>);
+    }
+
+    private int id;
+    [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private object data;
+    [Column(Storage = "data", DbType = "text", CanBeNull = false)]
+    public object Data {
+      get { return this.data; }
+      set { this.data = value; }
+    }
+
+    private int algorithmId;
+    [Column(Storage="algorithmId", DbType="Int not null")]
+    public int AlgorithmId {
+      get { return this.algorithmId;}
+      private set { 
+        if(algorithmId != value) {
+          if(algorithm.HasLoadedOrAssignedValue)
+            throw new ForeignKeyReferenceAlreadyHasValueException();
+          algorithmId =value;
+        }
+      }
+    }
+
+
+    private EntityRef<Algorithm> algorithm;
+    [Association(Storage="algorithm",ThisKey="AlgorithmId",OtherKey="Id",IsForeignKey=true)]
+    public Algorithm Algorithm {
+      get { return this.algorithm.Entity; }
+      set {
+        Algorithm previousValue = algorithm.Entity;
+        if (previousValue != value || (!algorithm.HasLoadedOrAssignedValue)) {
+          if (previousValue == null) {
+            algorithm.Entity = null;
+            previousValue.Models.Remove(this);
+          }
+          algorithm.Entity = value;
+          if (value != null) {
+            value.Models.Add(this);
+            algorithmId = value.Id;
+          } else
+            throw new NullReferenceException("Null not allowed as value for Model.Algorithm");
+        }
+      }
+    }
+
+    private int targetVariableId;
+    [Column(Storage = "targetVariableId", DbType = "Int not null")]
+    public int TargetVariableId {
+      get { return this.targetVariableId; }
+      private set {
+        if (targetVariableId != value) {
+          if (targetVariable.HasLoadedOrAssignedValue)
+            throw new ForeignKeyReferenceAlreadyHasValueException();
+          targetVariableId = value;
+        }
+      }
+    }
+
+    private EntityRef<Variable> targetVariable;
+    [Association(Storage = "targetVariable", ThisKey = "TargetVariableId", OtherKey = "Id", IsForeignKey = true)]
+    public Variable TargetVariable {
+      get { return this.targetVariable.Entity; }
+      set {
+        Variable previousValue = targetVariable.Entity;
+        if (previousValue != value || (!targetVariable.HasLoadedOrAssignedValue)) {
+          if (previousValue == null) {
+            targetVariable.Entity = null;
+            previousValue.ModelsPredictingThisVariable.Remove(this);
+          }
+          targetVariable.Entity = value;
+          if (value != null) {
+            value.ModelsPredictingThisVariable.Add(this);
+            targetVariableId = value.Id;
+          } else
+            throw new NullReferenceException("Null not allowed as value for Model.TargetVariable");
+        }
+      }
+    }
+
+    public IEnumerable<Variable> inputVariables {
+      get {
+        using (ModelingDataContext ctx = new ModelingDataContext()) {
+          var x = from inputVariable in ctx.InputVariables
+                  where inputVariable.Model == this
+                  select inputVariable.Variable;
+          return x.AsEnumerable();
+        }
+      }
+    }
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelResult.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelResult.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelResult.cs	(revision 2178)
@@ -0,0 +1,9 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  public class ModelResult {
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelingDataContext.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelingDataContext.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/ModelingDataContext.cs	(revision 2178)
@@ -0,0 +1,48 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  public class ModelingDataContext : DataContext{
+
+    public static string connectionString = @"data source=D:\Reps\HL3-Source\branches\HeuristicLab.Modeling Database Backend\sources\HeuristicLab.Modeling.SQLiteBackend\3.2\HeuristicLab.Modeling.SQLiteBackend.database";
+
+    public ModelingDataContext() : this(connectionString) {
+    }
+
+    public ModelingDataContext(string connection)
+      : base(connection) {
+    }
+
+    #region Tables
+    public Table<Algorithm> Algorithms {
+      get { return GetTable<Algorithm>(); }
+    }
+
+    public Table<InputVariable> InputVariables {
+      get { return GetTable<InputVariable>(); }
+    }
+
+    public Table<InputVariableResult> InputVariableResults {
+      get { return GetTable<InputVariableResult>(); }
+    }
+    public Table<Model> Models {
+      get { return GetTable<Model>(); }
+    }
+
+    public Table<ModelResult> ModelResults {
+      get { return GetTable<ModelResult>(); }
+    }
+
+    public Table<Problem> Problems {
+      get { return GetTable<Problem>(); }
+    }
+
+    public Table<Result> Results {
+      get { return GetTable<Result>(); }
+    }
+    #endregion
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Problem.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Problem.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Problem.cs	(revision 2178)
@@ -0,0 +1,29 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+using HeuristicLab.DataAnalysis;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  [Table(Name = "Problem")]
+  public class Problem {
+    public Problem() {
+    }
+
+    private int id;
+    [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private Dataset dataset;
+    [Column(Storage = "dataset", DbType = "text", CanBeNull = false)]
+    public Dataset Dataset {
+      get { return this.dataset; }
+      set { this.dataset = value; }
+    }    
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Result.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Result.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Result.cs	(revision 2178)
@@ -0,0 +1,28 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  [Table(Name = "Result")]
+  public class Result {
+    public Result() {
+    }
+
+    private int id;
+    [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private string name;
+    [Column(Storage = "name", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
+    public string Name {
+      get { return this.name; }
+      private set { this.name = value; }
+    }
+
+  }
+}
Index: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Variable.cs
===================================================================
--- branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Variable.cs	(revision 2178)
+++ branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.Modeling.SQLiteBackend/3.2/Variable.cs	(revision 2178)
@@ -0,0 +1,61 @@
+﻿using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Data.Linq;
+using System.Data.Linq.Mapping;
+using System.Text;
+
+namespace HeuristicLab.Modeling.SQLiteBackend {
+  [Table(Name = "Variable")]
+  public class Variable {
+    public Variable() {
+      modelsPredictingThisVariable = new EntitySet<Model>(attach_Model, detach_Model);
+    }
+
+    private int id;
+    [Column(Storage = "id", DbType = "integer", IsPrimaryKey = true, IsDbGenerated = true, UpdateCheck = UpdateCheck.Never)]
+    public int Id {
+      get { return this.id; }
+      private set { this.id = value; }
+    }
+
+    private string name;
+    [Column(Storage = "name", DbType = "VarChar(50) NOT NULL", CanBeNull = false)]
+    public string Name {
+      get { return this.name; }
+      private set { this.name = value; }
+    }
+
+    private EntitySet<Model> modelsPredictingThisVariable;
+    [Association(Storage = "modelsPredictingThisVariable", ThisKey = "Id", OtherKey = "TargetVariableId")]
+    public EntitySet<Model> ModelsPredictingThisVariable {
+      get {
+        if (modelsPredictingThisVariable.HasLoadedOrAssignedValues)
+          return modelsPredictingThisVariable;
+        return null;
+      }
+      set {
+        modelsPredictingThisVariable.Assign(value);
+      }
+    }
+
+    private void attach_Model(Model model) {
+      model.TargetVariable = this;
+    }
+
+    private void detach_Model(Model model) {
+      model.TargetVariable = null;
+    }
+
+    public IEnumerable<Model> ModelsUsingThisVariable {
+      get {
+        using (ModelingDataContext ctx = new ModelingDataContext()) {
+          var x = from inputVariable in ctx.InputVariables
+                  where inputVariable.Variable == this
+                  select inputVariable.Model;
+          return x.AsEnumerable();
+        }
+      }
+    }
+  }
+}
