Index: /trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj	(revision 546)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/HeuristicLab.CEDMA.Operators.csproj	(revision 547)
@@ -54,4 +54,9 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="SelectSubjectsLiteral.cs" />
+    <Compile Include="SelectProperties.cs" />
+    <Compile Include="SelectSubjects.cs" />
+    <Compile Include="MakeLiteralStatement.cs" />
+    <Compile Include="MakeItemStatement.cs" />
     <Compile Include="ResultsExtractor.cs" />
     <Compile Include="InjectedVariableExtractor.cs" />
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/InjectedVariableExtractor.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/InjectedVariableExtractor.cs	(revision 546)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/InjectedVariableExtractor.cs	(revision 547)
@@ -58,5 +58,7 @@
         IOperatorGraph opGraph = (IOperatorGraph)PersistenceManager.RestoreFromGZip(database.GetAgentRawData(agentId));
         OperatorLinkPatcher.LinkDatabase(opGraph, database);
-        List<IVariable> vars = FindInjectedVariable(database, variableNames, opGraph);
+        ItemList<StringData> clone = new ItemList<StringData>();
+        foreach(StringData name in variableNames) clone.Add(name);
+        List<IVariable> vars = FindInjectedVariable(database, clone, opGraph);
         foreach(IVariable var in vars) {
           scope.AddVariable(var);
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/MakeItemStatement.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/MakeItemStatement.cs	(revision 547)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/MakeItemStatement.cs	(revision 547)
@@ -0,0 +1,71 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using System.Threading;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.ServiceModel;
+using HeuristicLab.CEDMA.Core;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.CEDMA.Operators {
+  public class MakeItemStatement : OperatorBase {
+    private static readonly string cedmaNamespace = "http://www.heuristiclab.com/cedma/";
+
+    public override string Description {
+      get { return "TASK."; }
+    }
+
+    public MakeItemStatement()
+      : base() {
+      AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Subject", "", typeof(IItem), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Predicate", "", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Property", "", typeof(IItem), VariableKind.In));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      string serverUrl = GetVariableValue<StringData>("CedmaServerUri", scope, true).Data;
+      IItem subject = GetVariableValue<IItem>("Subject", scope, true);
+      StringData predicate = GetVariableValue<StringData>("Predicate", scope, true);
+      IItem property = GetVariableValue<IItem>("Property", scope, true);
+
+      NetTcpBinding binding = new NetTcpBinding();
+      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
+      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
+      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
+      binding.Security.Mode = SecurityMode.None;
+      using(ChannelFactory<IStore> factory = new ChannelFactory<IStore>(binding)) {
+        IStore store = factory.CreateChannel(new EndpointAddress(serverUrl));
+        Statement s = new Statement(
+          new Entity(cedmaNamespace + "Items/" + subject.Guid),
+          new Entity(cedmaNamespace + predicate.Data),
+          new Entity(cedmaNamespace + "Items/" + property.Guid));
+        store.Add(s);
+      }
+      return null;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/MakeLiteralStatement.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/MakeLiteralStatement.cs	(revision 547)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/MakeLiteralStatement.cs	(revision 547)
@@ -0,0 +1,93 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using System.Threading;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.ServiceModel;
+using HeuristicLab.CEDMA.Core;
+using HeuristicLab.Operators;
+using System.Xml;
+using System.IO;
+
+namespace HeuristicLab.CEDMA.Operators {
+  public class MakeLiteralStatement : OperatorBase {
+    private static readonly string cedmaNamespace = "http://www.heuristiclab.com/cedma/";
+
+    public override string Description {
+      get { return "TASK."; }
+    }
+
+    public MakeLiteralStatement()
+      : base() {
+      AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Subject", "", typeof(IItem), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Predicate", "", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Property", "", typeof(IItem), VariableKind.In));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      string serverUrl = GetVariableValue<StringData>("CedmaServerUri", scope, true).Data;
+      IItem subject = GetVariableValue<IItem>("Subject", scope, true);
+      StringData predicate = GetVariableValue<StringData>("Predicate", scope, true);
+      IItem property = GetVariableValue<IItem>("Property", scope, true);
+
+      NetTcpBinding binding = new NetTcpBinding();
+      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
+      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
+      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
+      binding.Security.Mode = SecurityMode.None;
+      using(ChannelFactory<IStore> factory = new ChannelFactory<IStore>(binding)) {
+        IStore store = factory.CreateChannel(new EndpointAddress(serverUrl));
+        Statement s = new Statement(
+          new Entity(cedmaNamespace + "Items/" + subject.Guid),
+          new Entity(cedmaNamespace + predicate.Data),
+          TranslateItem(property));
+        store.Add(s);
+      }
+      return null;
+    }
+
+    private Resource TranslateItem(IItem property) {
+      if(property is IntData) {
+        return new Literal(((IntData)property).Data);
+      } else if(property is DoubleData) {
+        return new Literal(((DoubleData)property).Data);
+      } else if(property is BoolData) {
+        return new Literal(((BoolData)property).Data);
+      } else if(property is StringData) {
+        return new Literal(((StringData)property).Data);
+      } else {
+        XmlDocument doc = PersistenceManager.CreateXmlDocument();
+        XmlNode root = PersistenceManager.Persist(property, doc, new Dictionary<Guid, IStorable>());
+        doc.AppendChild(root);
+        StringWriter writer = new StringWriter();
+        doc.Save(writer);
+        writer.Flush();
+        return new SerializedLiteral(writer.ToString());
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/SelectProperties.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/SelectProperties.cs	(revision 547)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/SelectProperties.cs	(revision 547)
@@ -0,0 +1,99 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using System.Threading;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.ServiceModel;
+using HeuristicLab.CEDMA.Core;
+using HeuristicLab.Operators;
+using System.IO;
+using System.Xml;
+
+namespace HeuristicLab.CEDMA.Operators {
+  public class SelectProperties : OperatorBase {
+    private static readonly string cedmaNamespace = "http://www.heuristiclab.com/cedma/";
+
+    public override string Description {
+      get { return "TASK."; }
+    }
+
+    public SelectProperties()
+      : base() {
+      AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("SubjectGuid", "", typeof(StringData), VariableKind.In));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      string serverUrl = GetVariableValue<StringData>("CedmaServerUri", scope, true).Data;
+      StringData subjectGuid = GetVariableValue<StringData>("SubjectGuid", scope, true);
+
+      NetTcpBinding binding = new NetTcpBinding();
+      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
+      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
+      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
+      binding.Security.Mode = SecurityMode.None;
+      using(ChannelFactory<IStore> factory = new ChannelFactory<IStore>(binding)) {
+        IStore store = factory.CreateChannel(new EndpointAddress(serverUrl));
+        Statement template = new Statement(
+          new Entity(cedmaNamespace+subjectGuid.Data),
+          new Entity(null),
+          new Entity(null));
+        IList<Statement> result = store.Select(template);
+
+        foreach(Statement s in result) {
+          if(s.Property is Literal) {
+            scope.AddVariable(new Variable(s.Predicate.Uri.Replace(cedmaNamespace,""), TranslateLiteral((Literal)s.Property)));
+          } else if(s.Property is SerializedLiteral) {
+            scope.AddVariable(new Variable(s.Predicate.Uri.Replace(cedmaNamespace, ""), TranslateLiteral((SerializedLiteral)s.Property)));
+          } else {
+            scope.AddVariable(new Variable(s.Predicate.Uri, new StringData(((Entity)s.Property).Uri.Replace(cedmaNamespace, ""))));
+          }
+        }
+      }
+      return null;
+    }
+
+    private IItem TranslateLiteral(SerializedLiteral serializedLiteral) {
+      XmlDocument doc = new XmlDocument();
+      doc.LoadXml(serializedLiteral.RawData);      
+      return (IItem)PersistenceManager.Restore(doc.ChildNodes[1], new Dictionary<Guid, IStorable>());
+    }
+
+    private IItem TranslateLiteral(Literal literal) {
+      if(literal.Value is bool) {
+        return new BoolData((bool)literal.Value);
+      } else if(literal.Value is double) {
+        return new DoubleData((double)literal.Value);
+      } else if(literal.Value is int) {
+        return new IntData((int)literal.Value);
+      } else if(literal.Value is string) {
+        return new StringData((string)literal.Value);
+      } else {
+        return new StringData(literal.Value.ToString());
+      }
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjects.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjects.cs	(revision 547)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjects.cs	(revision 547)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using System.Threading;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.ServiceModel;
+using HeuristicLab.CEDMA.Core;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.CEDMA.Operators {
+  public class SelectSubjects : OperatorBase {
+    private static readonly string cedmaNamespace = "http://www.heuristiclab.com/cedma/";
+
+    public override string Description {
+      get { return "TASK."; }
+    }
+
+    public SelectSubjects()
+      : base() {
+      AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Subject", "", typeof(IItem), VariableKind.New));
+      AddVariableInfo(new VariableInfo("Predicate", "", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Property", "", typeof(IItem), VariableKind.In));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      string serverUrl = GetVariableValue<StringData>("CedmaServerUri", scope, true).Data;
+      StringData predicate = GetVariableValue<StringData>("Predicate", scope, true);
+      IItem property = GetVariableValue<IItem>("Property", scope, true);
+
+      NetTcpBinding binding = new NetTcpBinding();
+      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
+      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
+      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
+      binding.Security.Mode = SecurityMode.None;
+      using(ChannelFactory<IStore> factory = new ChannelFactory<IStore>(binding)) {
+        IStore store = factory.CreateChannel(new EndpointAddress(serverUrl));
+        Statement template = new Statement(
+          new Entity(null),
+          new Entity(cedmaNamespace + predicate.Data),
+          new Entity(cedmaNamespace + "Items/" + property.Guid));
+        IList<Statement> result = store.Select(template);
+
+        foreach(Statement s in result) {
+          Scope subScope = new Scope(s.Subject.Uri.Replace(cedmaNamespace, ""));
+          subScope.AddVariable(new Variable(scope.TranslateName("Subject"), new StringData(s.Subject.Uri.Replace(cedmaNamespace, ""))));
+          scope.AddSubScope(subScope);
+        }
+      }
+      return null;
+    }
+  }
+}
Index: /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjectsLiteral.cs
===================================================================
--- /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjectsLiteral.cs	(revision 547)
+++ /trunk/sources/HeuristicLab.CEDMA.Operators/SelectSubjectsLiteral.cs	(revision 547)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 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.Collections.Generic;
+using System.Text;
+using HeuristicLab.Core;
+using HeuristicLab.Data;
+using System.Threading;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.ServiceModel;
+using HeuristicLab.CEDMA.Core;
+using HeuristicLab.Operators;
+
+namespace HeuristicLab.CEDMA.Operators {
+  public class SelectSubjectsLiteral : OperatorBase {
+    private static readonly string cedmaNamespace = "http://www.heuristiclab.com/cedma/";
+
+    public override string Description {
+      get { return "TASK."; }
+    }
+
+    public SelectSubjectsLiteral()
+      : base() {
+      AddVariableInfo(new VariableInfo("CedmaServerUri", "Uri of the CEDMA server", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Subject", "", typeof(IItem), VariableKind.New));
+      AddVariableInfo(new VariableInfo("Predicate", "", typeof(StringData), VariableKind.In));
+      AddVariableInfo(new VariableInfo("Property", "", typeof(ObjectData), VariableKind.In));
+    }
+
+    public override IOperation Apply(IScope scope) {
+      string serverUrl = GetVariableValue<StringData>("CedmaServerUri", scope, true).Data;
+      StringData predicate = GetVariableValue<StringData>("Predicate", scope, true);
+      ObjectData property = GetVariableValue<ObjectData>("Property", scope, true);
+
+      NetTcpBinding binding = new NetTcpBinding();
+      binding.MaxReceivedMessageSize = 10000000; // 10Mbytes
+      binding.ReaderQuotas.MaxStringContentLength = 10000000; // also 10M chars
+      binding.ReaderQuotas.MaxArrayLength = 10000000; // also 10M elements;
+      binding.Security.Mode = SecurityMode.None;
+      using(ChannelFactory<IStore> factory = new ChannelFactory<IStore>(binding)) {
+        IStore store = factory.CreateChannel(new EndpointAddress(serverUrl));
+        Statement template = new Statement(
+          new Entity(null),
+          new Entity(cedmaNamespace + predicate.Data),
+          new Literal(property.Data));
+        IList<Statement> result = store.Select(template);
+
+        foreach(Statement s in result) {
+          Scope subScope = new Scope(s.Subject.Uri.Replace(cedmaNamespace, ""));
+          subScope.AddVariable(new Variable(scope.TranslateName("Subject"), new StringData(s.Subject.Uri.Replace(cedmaNamespace,""))));
+          scope.AddSubScope(subScope);
+        }
+      }
+      return null;
+    }
+  }
+}
