Index: Dev/trunk/classes/ApplicationConnector.php
===================================================================
--- Dev/trunk/classes/ApplicationConnector.php	(revision 131)
+++ Dev/trunk/classes/ApplicationConnector.php	(revision 144)
@@ -11,6 +11,6 @@
  * @author jkraaijeveld
  */
-class ApplicationConnector implements IConnector{
-    
+class ApplicationConnector implements IConnector {
+
     protected $model;
     protected $fileName = 'data/applications/applications.rdf';
@@ -19,11 +19,11 @@
      * Constructor for ApplicationConnector.
      */
-    public function __construct()
-    {
+    public function __construct() {
         //Ensure the required folder for this connector exists
-        if (!is_dir('data/applications/'))
-            mkdir('data/applications/');	
+        if (!is_dir('data/applications/')) {
+            mkdir('data/applications/', null, true);
+        }
     }
-    
+
     /**
      * function load()
@@ -33,10 +33,10 @@
         //Get the Memory Model from the ModelFactory
         $this->model = ModelFactory::getDefaultModel();
-        
+
         //Ensure the required file exists before loading
-        if(file_exists($this->fileName))
+        if (file_exists($this->fileName))
             $this->model->load($this->fileName);
     }
-    
+
     /**
      * function save()
@@ -44,7 +44,7 @@
      */
     public function save() {
-        $this->model->saveAs($this->fileName,'rdf'); 
+        $this->model->saveAs($this->fileName, 'rdf');
     }
-    
+
     /**
      * function get($arguments)
@@ -58,14 +58,17 @@
         $keys = array_keys($arguments);
         //Set default values for arguments
-        $uid = "?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("uid", $keys))
-            $uid = "\"".$arguments["uid"]."\"";
-        if(in_array("title", $keys))
-            $title = '\''.$arguments["title"].'\'';
-        if(in_array("description", $keys))
-            $description = "\"".$arguments["description"]."\"";
-        if(in_array("style", $keys))
-            $style = "\"".$arguments["style"]."\"";    
+        if (in_array("uid", $keys))
+            $uid = "\"" . $arguments["uid"] . "\"";
+        if (in_array("title", $keys))
+            $title = '\'' . $arguments["title"] . '\'';
+        if (in_array("description", $keys))
+            $description = "\"" . $arguments["description"] . "\"";
+        if (in_array("style", $keys))
+            $style = "\"" . $arguments["style"] . "\"";
 
         //Create the querystring 
@@ -90,15 +93,13 @@
         $results = $this->model->sparqlQuery($querystring);
         $applications = array();
-        if(!empty($results))
-        {
+        if (!empty($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);
+            foreach ($results as $result) {
+                $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
             }
         }
         return $applications;
     }
-    
+
     /**
      * function set()
@@ -107,8 +108,7 @@
      * @param type $rToolObject: The ResearchToolObject to be saved. 
      */
-    public function set($rToolObject)
-    {
+    public function set($rToolObject) {
         $this->load();
-        $resourceApplication = new Resource(APPLICATION.'/'.$rToolObject->uid);
+        $resourceApplication = new Resource(APPLICATION . '/' . $rToolObject->uid);
         //Remove the old value stored with the given id
         $this->model->subtract($this->model->find($resourceApplication, null, null));
@@ -117,24 +117,25 @@
         $resourceApplicationType = new Resource(APPLICATION);
         $predicateRType = new Resource(RTYPE);
-        $this->model->add(new Statement($resourceApplication,$predicateRType,$resourceApplicationType));
-		
+        $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));
+        $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));
+        $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));
+        $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();
+        $this->model->add(new Statement($resourceApplication, $predicateStyle, $applicationStyle));
+
+        $this->save();
     }
+
 }
 
