Index: Dev/branches/jos-branch/classes/Application.php
===================================================================
--- Dev/branches/jos-branch/classes/Application.php	(revision 127)
+++ Dev/branches/jos-branch/classes/Application.php	(revision 128)
@@ -12,7 +12,7 @@
     public $style;
 
-    public function __construct($id = null, $title = null, $description = null, $style = null) 
+    public function __construct($uid = null, $title = null, $description = null, $style = null) 
     {
-        $this->id = $id;
+        $this->uid = $uid;
         $this->title = $title;
         $this->description = $description;
Index: Dev/branches/jos-branch/classes/ApplicationConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/ApplicationConnector.php	(revision 127)
+++ Dev/branches/jos-branch/classes/ApplicationConnector.php	(revision 128)
@@ -51,5 +51,5 @@
      * Gets the array of Application objects belonging to arguments supplied.
      * @param type $arguments : An array containing zero or more of the following keys:
-     *                          'id', 'title', 'description', 'style'
+     *                          'uid', 'title', 'description', 'style'
      */
     public function get($arguments) {
@@ -58,8 +58,8 @@
         $keys = array_keys($arguments);
         //Set default values for arguments
-        $id = "?uid"; $title = "?title"; $description = "?description"; $style = "?style";
+        $uid = "?uid"; $title = "?title"; $description = "?description"; $style = "?style";
         //Set the arguments if they are supplied
-        if(in_array("id", $keys))
-            $id = "\"".$arguments["id"]."\"";
+        if(in_array("uid", $keys))
+            $uid = "\"".$arguments["id"]."\"";
         if(in_array("title", $keys))
             $title = '\''.$arguments["title"].'\'';
@@ -77,33 +77,67 @@
             {
                     _application	predicates:resource_type	resources:application ;
-                                        predicates:uid			'. $id . ';
-                                        predicates:title 		'. $title . ';
-                                        predicates:description		'. $description . ';
-                                        predicates:style		'. $style .'
+					predicates:uid ?uid ;
+					predicates:title ?title ;
+					predicates:description ?description ;
+					predicates:style ?style ;
+					predicates:uid ' . $uid . ' 
+					predicates:title ' . $title . ' 
+					predicates:description ' . $description . ' 
+					predicates:style ' . $style . ' 
             }';
+
         //Query the model
-        echo $querystring;
         $results = $this->model->sparqlQuery($querystring);
-        $applications = array();
-        echo count($results);
-        //Run over all results and create appropriate Application objets
-        foreach($results as $result)
-        {
-            
-            $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
-        }
-        //Return the list of application objects
-        return $applications;
+		if(!empty($results))
+			{
+			$applications = array();
+			//Run over all results and create appropriate Application objets
+			foreach($results as $result)
+			{ 
+				$applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
+			}
+			//Return the list of application objects
+			return $applications;
+		}
+		else
+		{
+			return array();
+		}
     }
     
     /**
      * function set()
-     * Finds the required databaseentry matching the given objects and removes
-     * it from the rdf file.
-     * @param type $rToolObject 
+     * Finds the required databaseentry matching the given object and removes
+     * it from the rdf file. Then adds the new RDF entry matching the object.
+     * @param type $rToolObject: The ResearchToolObject to be saved. 
      */
     public function set($rToolObject)
     {
-        //TODO
+        $resourceApplication = new Resource(APPLICATION.'/'.$rToolObject->uid);
+		//Remove the old value stored with the given id
+		$this->model->subtract($this->model->find($resourceApplication, null, null));
+		
+		//Add the new statements to the model
+        $resourceApplicationType = new Resource(APPLICATION);
+        $predicateRType = new Resource(RTYPE);
+        $this->model->add(new Statement($resourceApplication,$predicateRType,$resourceApplicationType));
+		
+        $literalApplicationID = new Literal($rToolObject->uid);
+        $predicateUniqueID = new Resource(UID);
+        $this->model->add(new Statement($resourceApplication,$predicateUniqueID,$literalApplicationID));
+
+        $applicationTitle = new Literal($rToolObject->title);
+        $predicateTitle = new Resource(TITLE);	
+        $this->model->add(new Statement($resourceApplication,$predicateTitle,$applicationTitle));
+
+        $applicationDescription = new Literal($rToolObject->description);
+        $predicateDescription = new Resource(DESCRIPTION);
+        $this->model->add(new Statement($resourceApplication,$predicateDescription,$applicationDescription));
+
+        $applicationStyle = new Literal($rToolObject->style);
+        $predicateStyle = new Resource(STYLE);
+        $this->model->add(new Statement($resourceApplication,$predicateStyle,$applicationStyle));
+		
+		$this->save();
     }
 }
Index: Dev/branches/jos-branch/classes/DatabaseInterface.php
===================================================================
--- Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 127)
+++ Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 128)
@@ -32,4 +32,15 @@
         }
     }
+	
+	public function set($rToolObject)
+	{
+		switch(get_class($rToolObject))
+		{
+			case "Application":
+				$this->applicationConnector->set($rToolObject);
+		}
+	}
+	
+	
 }
 
Index: Dev/branches/jos-branch/classes/ResearchToolObject.php
===================================================================
--- Dev/branches/jos-branch/classes/ResearchToolObject.php	(revision 127)
+++ Dev/branches/jos-branch/classes/ResearchToolObject.php	(revision 128)
@@ -6,5 +6,5 @@
  */
 class ResearchToolObject {
-    public $id;
+    private $uid;
 }
 
Index: Dev/branches/jos-branch/testpage.php
===================================================================
--- Dev/branches/jos-branch/testpage.php	(revision 128)
+++ Dev/branches/jos-branch/testpage.php	(revision 128)
@@ -0,0 +1,16 @@
+<?php 
+	require 'classes/master.php';
+	require 'rdfConstants.php';
+
+
+	
+	$di = new DatabaseInterface();
+	
+	
+	$args = array("description" => "test");
+	$apps = $di->get("application", $args);
+	$app = $apps[0];
+	$app->title = "Sup, testing if the title changes properly.";
+	$di->set($app);
+
+?>
