Index: Dev/trunk/classes/SurveyRDFReader.php
===================================================================
--- Dev/trunk/classes/SurveyRDFReader.php	(revision 16)
+++ Dev/trunk/classes/SurveyRDFReader.php	(revision 26)
@@ -4,24 +4,72 @@
 {
 	var $model;
-		
-	public function SurveyRDFReader()
-	{
+	
+	var $surveyUID;
+	
+    public function __construct($surveyUID)
+    {
         // Create empty MemModel
 		$factory = new ModelFactory();
-		$this->model = $factory->getDefaultModel();	
+		$this->model = $factory->getDefaultModel();
+		
+		$this->surveyUID = $surveyUID;
 	}
 	
-	public function loadSurvey($sTitle)
+	public function loadSurvey()
 	{
-		$this->model->load('surveys/'.$sTitle.'.rdf');
+		$this->model->load('surveys/'.$this->surveyUID.'.rdf');
 	}
 	
-	public function readSurveyTitle()
+	public function getSurveyInfo()
+	{		
+		SurveyRDFReader::loadSurvey();
+	
+		$result = array();
+		$result[] = $this->readSurveyInfo();				
+		$result[] = $this->readSurveyQuestions();
+		
+		return $result;
+	}
+	
+	public function readSurveyInfo()
 	{
 		$querystring = '
-			PREFIX 	predicates: <' .SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
 			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-			SELECT 	?title
-			WHERE 	{ resources:survey predicates:title ?title }';
+			SELECT 	?title ?description
+			WHERE 	
+			{
+				_survey		predicates:resource_type	resources:survey ;
+							predicates:title 			?title ;
+							predicates:description		?description
+			}';
+			
+		$result = $this->model->sparqlQuery($querystring);
+				
+		return $result;
+	}
+	
+	public function readSurveyQuestions()
+	{
+		$result = array();
+		$result[] = $this->readSurveyQuestionsTitle();				
+		$result[] = $this->readSurveyQuestionsDescription();
+		$result[] = $this->readSurveyQuestionsType();
+		$result[] = $this->readSurveyQuestionsID();		
+				
+		return $result;
+	}
+	
+	public function readSurveyQuestionsTitle()
+	{
+		$querystring = '
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT 	?questionTitle
+			WHERE 
+			{	
+				_question	predicates:resource_type	resources:question ;
+							predicates:title			?questionTitle 		
+			}';
 			
 		$result = $this->model->sparqlQuery($querystring);
@@ -30,11 +78,68 @@
 	}
 	
-	public function readSurveyDescription()
+	public function readSurveyQuestionsDescription()
 	{
 		$querystring = '
-			PREFIX 	predicates: <' .SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
 			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-			SELECT 	?description 
-			WHERE 	{ resources:survey predicates:description ?description }';
+			SELECT 	?questionDescription
+			WHERE 
+			{	
+				_question	predicates:resource_type	resources:question ;
+							predicates:description	?questionDescription 		
+			}';
+			
+		$result = $this->model->sparqlQuery($querystring);
+		
+		return $result;
+	}
+	
+	public function readSurveyQuestionsType()
+	{
+		$querystring = '
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT 	?questionType
+			WHERE 
+			{	
+				_question	predicates:resource_type	resources:question ;
+							predicates:question_type	?questionType				
+			}';
+			
+		$result = $this->model->sparqlQuery($querystring);
+		
+		return $result;
+	}
+	
+	public function readSurveyQuestionsID()
+	{
+		$querystring = '
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT 	?questionID
+			WHERE 
+			{	
+				_question	predicates:resource_type	resources:question ;
+							predicates:uid				?questionID				
+			}';
+			
+		$result = $this->model->sparqlQuery($querystring);
+		
+		return $result;
+	}
+	
+	public function readSurveyAnswers($qID)
+	{
+		$querystring = '
+			PREFIX 	predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX	resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT 	?answerTitle
+			WHERE 
+			{
+				_question		predicates:resource_type	resources:question ;
+								predicates:uid				"' . $qID . '"  ;
+								predicates:has_answer		_answer .
+				_answer			predicates:title			?answerTitle								
+			}';
 			
 		$result = $this->model->sparqlQuery($querystring);
