Index: Dev/trunk/classes/SurveyDatabaseInterface.php
===================================================================
--- Dev/trunk/classes/SurveyDatabaseInterface.php	(revision 26)
+++ Dev/trunk/classes/SurveyDatabaseInterface.php	(revision 28)
@@ -10,29 +10,24 @@
 
 class SurveyDatabaseInterface
-{	
-    protected static $instance;
-	
+{		
 	protected $surveyRDFWriter;
 	protected $surveyRDFReader;
  
 
-    protected function __construct()
+    public function __construct($surveyID=null)
     {
-        //protected to prevent direct instantiation
-		$surveyUID = md5( uniqid(rand(), true) );
-		
+		if($surveyID == null)
+			$surveyUID = md5( uniqid(rand(), true) );
+		else
+			$surveyUID = $surveyID;
+					
 		$this->surveyRDFWriter = new SurveyRDFWriter($surveyUID);
 		$this->surveyRDFReader = new SurveyRDFReader($surveyUID);
     }
-
-	public static function getInstance() 
-    { 
-        if (!self::$instance) 
-        { 
-            self::$instance = new SurveyDatabaseInterface(); 
-        } 
-
-        return self::$instance; 
-    }
+		
+	public function __destruct() 
+	{
+		echo "Destroyed";
+	}
 	
 	public function setSurveyInfo($survey)
@@ -76,4 +71,5 @@
 		$resultSurvey = $this->surveyRDFReader->getSurveyInfo();
 		
+		$surveyInfo['surveyID'] = substr($resultSurvey[0][0]['?uid'],9,strlen($resultSurvey[0][0]['?uid'])-11);
 		$surveyInfo['surveyTitle'] = substr($resultSurvey[0][0]['?title'],9,strlen($resultSurvey[0][0]['?title'])-11);
 		$surveyInfo['surveyDescription'] = substr($resultSurvey[0][0]['?description'],9,strlen($resultSurvey[0][0]['?description'])-11);
Index: Dev/trunk/classes/SurveyRDFReader.php
===================================================================
--- Dev/trunk/classes/SurveyRDFReader.php	(revision 26)
+++ Dev/trunk/classes/SurveyRDFReader.php	(revision 28)
@@ -3,7 +3,7 @@
 class SurveyRDFReader
 {
-	var $model;
+	protected $model;
 	
-	var $surveyUID;
+	protected $surveyUID;
 	
     public function __construct($surveyUID)
@@ -18,5 +18,5 @@
 	public function loadSurvey()
 	{
-		$this->model->load('surveys/'.$this->surveyUID.'.rdf');
+		$this->model->load('surveys/survey_'.$this->surveyUID.'.rdf');
 	}
 	
@@ -37,10 +37,11 @@
 			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
 			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-			SELECT 	?title ?description
+			SELECT 	?uid ?title ?description 
 			WHERE 	
 			{
 				_survey		predicates:resource_type	resources:survey ;
-							predicates:title 			?title ;
-							predicates:description		?description
+							predicates:uid				?uid	;
+							predicates:title 			?title 	;
+							predicates:description		?description 
 			}';
 			
Index: Dev/trunk/classes/SurveyRDFWriter.php
===================================================================
--- Dev/trunk/classes/SurveyRDFWriter.php	(revision 26)
+++ Dev/trunk/classes/SurveyRDFWriter.php	(revision 28)
@@ -3,8 +3,8 @@
 class SurveyRDFWriter 
 {
-	var $model;
+	protected $model;
 		
-	var $resourceSurvey;
-	var $surveyUID;
+	protected $resourceSurvey;
+	protected $surveyUID;
 	
     public function __construct($surveyUID)
@@ -16,5 +16,10 @@
 		$this->surveyUID = $surveyUID;
 		
-    }
+    }	
+	
+	public function saveSurvey()
+	{	
+		$this->model->saveAs('surveys/survey_'.$this->surveyUID.'.rdf','rdf');
+	}
 	
 	public function createSurvey($sTitle, $sDescription)
@@ -36,6 +41,5 @@
 		$predicateDescription = new Resource(DESCRIPTION);
 		$surveyDescription = new Literal($sDescription);
-		$this->model->add(new Statement($this->resourceSurvey,$predicateDescription,$surveyDescription));
-		
+		$this->model->add(new Statement($this->resourceSurvey,$predicateDescription,$surveyDescription));		
 	}
 	
@@ -89,13 +93,6 @@
 		
 		$predicateQuestion = new Resource(HAS_QUESTION);
-		$this->model->add(new Statement($this->resourceSurvey,$predicateQuestion,$resourceQuestion));
-		
+		$this->model->add(new Statement($this->resourceSurvey,$predicateQuestion,$resourceQuestion));		
 	}
-	
-	public function saveSurvey()
-	{	
-		$this->model->saveAs('surveys/'.$this->surveyUID.'.rdf','rdf');
-	}
-
 }
 
