Index: Dev/branches/jos-branch/classes/AnswerConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/AnswerConnector.php	(revision 141)
+++ Dev/branches/jos-branch/classes/AnswerConnector.php	(revision 143)
@@ -12,5 +12,6 @@
 class AnswerConnector implements IConnector{
     protected $model;
-    protected $fileName = 'data/users/users.rdf';
+	protected $fileName = 'data/answers/answers.rdf';
+	protected $db;
     
     /**
@@ -44,16 +45,123 @@
     }
     
+	/**
+	 * Function get()
+	 * Get the answers corresponding to the arguments
+	 * 'Question' argument is supposed to be the question ID
+	 * 'Values' has to be an array to make sure multiple answers can be selected.
+	 */
     public function get($arguments)
-    {
-        
-    }
-    
+	{
+		$this->load();
+		$keys = array_keys($arguments);
+		$uid = "?uid"; $question = "?question_code"; $value	= ""; 
+		if(in_array("uid", $keys))
+			$uid = '\''.$arguments["uid"].'\'';
+		if(in_array("question", $keys))
+			$question = '\''.$arguments["question"].'\'';
+		if(in_array("values", $keys))
+		{
+			foreach ($arguments["values"] as $val)
+			{
+				$value = $value . 'predicates:answered \'' . $val . '\' ';
+			}
+		}
+		//Create the querystring
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT DISTINCT ?uid, ?question_code
+			WHERE
+			{
+				_answer predicates:resource_type resources:answer;
+
+				predicates:uid ?uid ;
+				predicates:question_code ?question_code;
+
+				predicates:uid ' . $uid . '
+				predicates:question_code ' . $question . '	
+				' . $value . '
+			}';
+
+		//Query the model
+		$results = $this->model->sparqlQuery($querystring);	
+		//An answer can have multiple values, get all these values for the answer instances found.
+		$answers = array();
+		if(!empty($results))
+		{
+            $this->db = new DatabaseInterface();
+			foreach($results as $result)
+			{
+				$values = $this->getValues($result['?uid']->label);
+				$questionResult = $this->db->get("question", array("uid" => $result['?question_code']->label));
+				$answers[] = new Answer($result['?uid']->label, $questionResult[0], $values);
+			}
+		}
+		return $answers;
+
+	}
+	/**
+	 * Gets the values that belong to the answer
+	 * specified by the UID
+	 */
+	private function getValues($uid)
+	{
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT DISTINCT ?answered
+			WHERE 
+			{
+				_answer predicates:resource_type resources:answer ;
+				predicates:answered ?answered ;
+				predicates:uid \''. $uid . '\'
+		}';
+		$values = $this->model->sparqlQuery($querystring);
+		$returnArray = array();
+		if(!empty($values))
+		{
+			foreach($values as $value)
+			{
+				$returnArray[] = $value['?answered']->label;
+			}
+		}
+		return $returnArray;
+	} 
+
     /**
-     *
+     * Saves the answer Object to the RDF file.
      * @param type $rToolObject
      */
     public function set($rToolObject)
     {
+        $this->load();
         
+        $resourceAnswer = new Resource(ANSWER.'/'.$rToolObject->uid);        
+        //Remove the old value stored with the given id
+        $this->model->subtract($this->model->find($resourceAnswer, null, null));
+        
+        //Save all the new values
+        $resourceAnswerType = new Resource(ANSWER);
+        $predicateRType = new Resource(RTYPE);
+        $this->model->add(new Statement($resourceAnswer,$predicateRType,$resourceAnswerType));
+        
+		$answerId = new Literal($rToolObject->uid);
+		$predicateId = new Resource(UID);
+		$this->model->add(new Statement($resourceAnswer, $predicateId, $answerId));
+
+		$questionId = new Literal($rToolObject->question->uid);
+		$predicateQId = new Resource(QCODE);
+		$this->model->add(new Statement($resourceAnswer, $predicateQId, $questionId));
+
+		if(isset($rToolObject->values))
+		{
+			foreach($rToolObject->values as $value)
+			{
+				$answerValue = new Literal($value);
+				$predicateAnswer = new Resource(ANSWERED);
+				$this->model->add(new Statement($resourceAnswer, $predicateAnswer, $answerValue));
+			}
+		}
+        $this->save();
     }
 }
Index: Dev/branches/jos-branch/classes/AnswerSet.php
===================================================================
--- Dev/branches/jos-branch/classes/AnswerSet.php	(revision 143)
+++ Dev/branches/jos-branch/classes/AnswerSet.php	(revision 143)
@@ -0,0 +1,30 @@
+<?php
+
+/**
+ * AnswerSet is a collection of answers corresponding to a Session
+ *
+ */
+class AnswerSet extends ResearchToolObject{
+	public $survey;
+	public $respondent;
+	public $answers;
+
+	/**
+	 * Constructor for an AnswerSet object
+	 * @param type $uid
+	 * @param type $question
+	 * @param type $values
+	 */
+	public function __construct($uid=null, $survey=null, $respondent=null, $answers=null)
+	{
+		if(!isset($uid))
+		{
+			$uid = md5(uniqid(rand(), true));
+		}
+		$this->uid = $uid;
+		$this->survey = $survey;
+		$this->respondent = $respondent;
+		$this->answers = $answers;
+	}
+}
+
Index: Dev/branches/jos-branch/classes/AnswerSetConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/AnswerSetConnector.php	(revision 143)
+++ Dev/branches/jos-branch/classes/AnswerSetConnector.php	(revision 143)
@@ -0,0 +1,170 @@
+<?php
+
+/**
+ * Description of AnswerSetConnector
+ *
+ * @author jkraaijeveld
+ */
+class AnswerSetConnector implements IConnector{
+    protected $model;
+    protected $fileName = 'data/answers/answersets.rdf';
+    protected $db;
+
+	/**
+	 * Constructor for the AnswerSetConnector
+	 */
+	public function __construct()
+	{
+		//Ensure the required folder for this connector exists
+		if(!is_dir('data/answers'))
+			mkdir('data/answers');
+	}
+
+	/**
+	 * function load()
+	 * Loads the file into the standard MemModel
+	 */
+	public function load()
+	{
+	    //Get the Memory Model from the ModelFactory
+        $this->model = ModelFactory::getDefaultModel();
+        
+        //Ensure the required file exists before loading
+        if(file_exists($this->fileName))
+            $this->model->load($this->fileName);
+	}
+
+	/**
+     * function save()
+     * Saves the MemModel into the given file.
+     */
+    public function save() {
+        $this->model->saveAs($this->fileName,'rdf'); 
+	}
+
+	/**
+	 * Get the AnswerSets corresponding to the arguments
+	 * Arguments can be one or more of the following:
+	 * uid, survey, respondent, answers
+	 * Where answers is an array of answer ids
+	 */
+	public function get($arguments)
+	{
+		$this->load();
+		
+		$keys = array_keys($arguments);
+		$uid = ""; $survey = ""; $respondent = ""; $answers = "";
+		if(in_array("uid", $keys))
+			$uid = 'predicates:uid \''.$arguments["uid"].'\' ';
+		if(in_array("survey", $keys))
+			$survey = 'predicates:for_survey \''.$arguments["survey"].'\' ';
+		if(in_array("respondent", $keys))
+			$respondent = 'predicates:by_respondent \''.$arguments["respondent"].'\' ';
+		if(in_array("answers", $keys))
+		{
+			foreach ($arguments["answers"] as $answer)
+			{
+				$answers = $answers . 'predicates:given_answer \'' . $answer . '\' ';
+			}
+		}
+
+		//Build the query string
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT DISTINCT ?uid, ?for_survey, ?by_respondent
+			WHERE
+			{
+				_answerset	predicates:resource_type	resources:answerset ;
+				predicates:uid ?uid ;
+				predicates:for_survey ?for_survey ;
+				predicates:by_respondent ?by_respondent ;
+				' . $uid . $survey . $respondent . $answers . '
+			}';
+
+		//Query the model
+		$results = $this->model->sparqlQuery($querystring);
+		$answerSets = array();
+		if(!empty($results))
+		{
+			$this->db = new DatabaseInterface();
+			foreach($results as $result)
+			{
+				$survey = $this->db->get("survey", array("uid" => $result['?for_survey']->label));
+				$respondent = $this->db->get("respondent", array("uid" => $result['?by_respondent']->label));
+				$answers = 	$this->getAnswers($result['?uid']->label);
+				$answerSets[] = new AnswerSet($result['?uid']->label, $survey[0], $respondent[0], $answers);
+			}
+		}
+		return $answerSets;
+	}
+
+	/**
+	 * function getAnswers()
+	 * Gets the answers corresponding to the given answerset uid
+	 */
+	private function getAnswers($uid)
+	{
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE .'>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE .'>
+			SELECT DISTINCT ?given_answer
+			WHERE
+			{
+				_answerset predicates:resource_type resources:answerset ;
+				predicates:given_answer ?given_answer ;
+				predicates:uid \'' . $uid . '\'
+			}';
+		$answers = $this->model->sparqlQuery($querystring);
+		$returnArray = array();
+		if(!empty($answers))
+		{
+			foreach($answers as $answer)
+			{
+				$answerR = $this->db->get("answer", array("uid" => $answer["?given_answer"]->label));
+				$returnArray[] = $answerR[0];
+			}
+		}
+		return $returnArray;
+	}
+
+	/**
+	 * Save the given AnswerSet in the file.
+	 * @param type $rToolObject
+	 */
+	public function set($rToolObject)
+	{
+		$this->load();
+		$resourceAnswerSet = new Resource(ANSWERSET . '/' . $rToolObject->uid);
+		//Remove the old value stored with the given id
+		$this->model->subtract($this->model->find($resourceAnswerSet, null, null));
+
+		//Set the new values
+		$resourceAnswerSetType = new Resource(ANSWERSET);
+		$predicateRType = new Resource(RTYPE);
+		$this->model->add(new Statement($resourceAnswerSet, $predicateRType, $resourceAnswerSetType));
+
+		$answerSetId = new Literal($rToolObject->uid);
+		$predicateId = new Resource(UID);
+		$this->model->add(new Statement($resourceAnswerSet, $predicateId, $answerSetId));
+
+		$surveyId = new Literal($rToolObject->survey->uid);
+		$predicateSurvey = new Resource(FOR_SURVEY);
+		$this->model->add(new Statement($resourceAnswerSet, $predicateSurvey, $surveyId));
+
+		$respondentId = new Literal($rToolObject->respondent->uid);
+		$predicateRespondent = new Resource(BY_RESPONDENT);
+		$this->model->add(new Statement($resourceAnswerSet, $predicateRespondent, $respondentId));
+		
+		if(isset($rToolObject->answers))
+		{
+			foreach($rToolObject->answers as $answer)
+			{
+				$answerId = new Literal($answer->uid);
+				$predicateAnswer = new Resource(GIVEN_ANSWER);
+				$this->model->add(new Statement($resourceAnswerSet, $predicateAnswer, $answerId));
+			}
+		}
+		$this->save();
+	}
+}
Index: Dev/branches/jos-branch/classes/DatabaseInterface.php
===================================================================
--- Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 141)
+++ Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 143)
@@ -22,5 +22,7 @@
     private $surveyConnector;
     private $respondentConnector;
-    private $answerConnector;
+	private $answerConnector;
+	private $answerSetConnector;
+	private $sessionConnector;
     
     /**
@@ -34,5 +36,7 @@
         $this->surveyConnector = new SurveyConnector();
         $this->respondentConnector = new RespondentConnector();
-        $this->answerConnector = new AnswerConnector();
+		$this->answerConnector = new AnswerConnector();
+		$this->answerSetConnector = new AnswerSetConnector();
+		$this->sessionConnector = new SessionConnector();
     }
     
@@ -64,6 +68,10 @@
             case "answer":
                 return $this->answerConnector->get($arguments);
-                break;
-               
+				break;
+			case "answerset":
+				return $this->answerSetConnector->get($arguments);
+			case "session":
+				return $this->sessionConnector->get($arguments);
+
         }
     }
@@ -87,9 +95,19 @@
                 break;
             case "Survey":
-                $this->surveyConnector->set($rToolObject);
+				$this->surveyConnector->set($rToolObject);
+				break;
             case "Respondent":
-                $this->respondentConnector->set($rToolObject);
+				$this->respondentConnector->set($rToolObject);
+				break;
             case "Answer":
-                $this->answerConnector->set($rToolObject);
+				$this->answerConnector->set($rToolObject);
+				break;
+			case "AnswerSet":
+				$this->answerSetConnector->set($rToolObject);
+				break;
+			case "Session":
+				$this->sessionConnector->set($rToolObject);
+				break;
+
         }
     }
Index: Dev/branches/jos-branch/classes/Question.php
===================================================================
--- Dev/branches/jos-branch/classes/Question.php	(revision 141)
+++ Dev/branches/jos-branch/classes/Question.php	(revision 143)
@@ -29,4 +29,8 @@
     public function __construct($uid, $title = null, $type = null, $description = null, $category = null, $answers = null)
     {
+		if(!isset($uid))
+		{
+			$uid = md5(uniqid(rand(), true));
+		}
         $this->uid = $uid;
         $this->title = $title;
Index: Dev/branches/jos-branch/classes/QuestionConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/QuestionConnector.php	(revision 141)
+++ Dev/branches/jos-branch/classes/QuestionConnector.php	(revision 143)
@@ -59,5 +59,5 @@
         $keys = array_keys($arguments);
         //Set default values for arguments
-        $uid = "?uid"; $title = "?title"; $type = "?type"; $description = "?description"; $category = "?category";
+        $uid = "?uid"; $title = "?title"; $type = "?type"; $description = "?description"; $category = "?category"; $has_answer = "";
         //Set the arguments if they are supplied
         if(in_array("uid", $keys))
@@ -70,5 +70,12 @@
             $description = "\"".$arguments["description"]."\"";
         if(in_array("category", $keys))
-            $style = "\"".$arguments["category"]."\"";
+			$style = "\"".$arguments["category"]."\"";
+		if(in_array("answers", $keys))
+		{
+			foreach($arguments["answers"] as $answer)
+			{
+				$has_answer = $has_answer . 'predicates:has_answer \'' . $answer . '\' ';
+			}
+		}
            
         $querystring = '
@@ -89,5 +96,6 @@
                 predicates:question_type ' . $type . '
                 predicates:description ' . $description . '
-                predicates:question_category ' . $category . ' 
+				predicates:question_category ' . $category . ' 
+				' . $has_answer . '
             }';
         //Create the querystring 
Index: Dev/branches/jos-branch/classes/RespondentConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/RespondentConnector.php	(revision 141)
+++ Dev/branches/jos-branch/classes/RespondentConnector.php	(revision 143)
@@ -73,16 +73,15 @@
             WHERE 	
             {
-                    _user	predicates:resource_type	resources:user ;
+                    _respondent	predicates:resource_type	resources:respondent ;
 					predicates:uid ?uid ;
 					predicates:name ?name ;
 					predicates:password ?password ;
-                     			predicates:uid ' . $uid . ' 
+          			predicates:uid ' . $uid . ' 
 					predicates:name ' . $name . ' 
 					predicates:password ' . $password . ' 
             }';
-        echo $querystring;
         //Query the model
         $results = $this->model->sparqlQuery($querystring);
-        $respondents = array();
+		$respondents = array();
         if(!empty($results))
         {
@@ -107,4 +106,5 @@
         $this->model->subtract($this->model->find($resourceRespondent, null, null));
 
+		//Set the new values
         $resourceRespondentType = new Resource(RESPONDENT);
         $predicateRType = new Resource(RTYPE);
Index: Dev/branches/jos-branch/classes/Session.php
===================================================================
--- Dev/branches/jos-branch/classes/Session.php	(revision 143)
+++ Dev/branches/jos-branch/classes/Session.php	(revision 143)
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Description of Session
+ *
+ * @author jkraaijeveld
+ */
+
+class Session extends ResearchToolObject
+{
+	public $title;
+	public $datetime;
+	public $pipeline;
+	public $answersets;
+
+	
+	/**
+	 * Constructor for a Session object
+	 * @param type $uid
+	 * @param type $title
+	 * @param type $datetime
+	 * @param type $pipeline
+	 */
+	public function __construct($uid = null, $title = null, $datetime = null, $pipeline = null, $answersets = null)
+	{
+		if(!isset($uid))
+		{
+			$uid = md5(uniqid(rand(), true));
+		}
+		$this->uid = $uid;
+		$this->title = $title;
+		$this->datetime = $datetime;
+		$this->pipeline = $pipeline;
+		$this->answersets = $answersets;
+	}
+}	
+
+
+?>
Index: Dev/branches/jos-branch/classes/SessionConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/SessionConnector.php	(revision 143)
+++ Dev/branches/jos-branch/classes/SessionConnector.php	(revision 143)
@@ -0,0 +1,206 @@
+<?php
+/**
+ * Description of SessionConnector
+ *
+ * @author jkraaijeveld
+ */
+class SessionConnector implements IConnector
+{
+	protected $model;
+	protected $fileName = 'data/sessions/sessions.rdf';
+	protected $db;
+
+	/**
+	 * Constructor for the SessionConnector
+	 */
+	public function __construct()
+	{
+		//Ensure the required folder for this connector exists
+		if(!is_dir('data/sessions'))
+			mkdir('data/sessions');
+	}
+
+	/**
+	 * function load()
+	 * Loads the file into the standard MemModel
+	 */
+	public function load()
+	{
+		$this->model = ModelFactory::getDefaultModel();
+		if(file_exists($this->fileName))
+			$this->model->load($this->fileName);
+	}
+
+	/**
+	 * fucntion save()
+	 * Saves the MemModel into the given file.
+	 */
+	public function save()
+	{
+		$this->model->saveAs($this->fileName,'rdf');
+	}
+
+	/**
+	 * Get the Sessions corresponding to the arguments
+	 * @ param type $arguments
+	 * Arguments can be one or more of the following:
+	 * uid, title, datetime, applications, surveys, answersets
+	 * Where applications, surveys and answersets are arrays containing ids
+	 */
+	public function get($arguments)
+	{
+		$this->load();
+
+		$keys = array_keys($arguments);
+		$uid = ""; $title = ""; $datetime = ""; $applications = ""; $surveys = ""; $answersets = "";
+		if(in_array("uid", $keys))
+			$uid = 'predicates:uid \''.$arguements["uid"].'\' ';
+		if(in_array("title", $keys))
+			$title = 'predicates:title \''.$arguments["title"].'\' ';
+		if(in_array("datetime", $keys))
+			$datetime = 'predicates:datetime \''.$arguments["datetime"].'\' ';
+		if(in_array("applications", $keys))
+		{
+			foreach($arguments["applications"] as $application)
+			{
+				$applications = $applications . 'predicates:has_application \'' . $application . '\' ';
+			}
+		}
+		if(in_array("surveys", $keys))
+		{
+			foreach($arguments["surveys"] as $survey)
+			{
+				$surveys = $surveys . 'predicates:has_survey \'' . $survey . '\' ';
+			}
+		}
+		if(in_array("answersets", $keys))
+		{
+			foreach($arguments["answersets"] as $answerset)
+			{
+				$answersets = $answersets . 'predicates:has_answerset \'' . $answerset . '\' ';
+			}
+		}
+	
+		//Build the query string
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+			SELECT DISTINCT ?uid, ?title, ?datetime
+			WHERE
+			{
+				_session predicates:resource_type resources:session ;
+				predicates:uid ?uid ;
+				predicates:title ?title ;
+				' . $uid . $title . $datetime . $applications . $surveys . $answersets . '
+			}';
+		//Query the model
+		$results = $this->model->sparqlQuery($querystring);
+
+		$sessions = array();
+		if(!empty($results))
+		{
+			$this->db = new DatabaseInterface();
+			foreach($results as $result)
+			{
+				$pipeline = $this->getPipeline($result['?uid']->label);
+				$answersets = $this->getAnswerSets($result['?uid']->label);
+				$datetime = new DateTime();
+				$datetime->setTimestamp(intval($result['?datetime']));
+				$sessions[] = new Session($result['?uid']->label, $result['?title']->label, $datetime, $pipeline, $answersets);
+			}
+		}
+		return $sessions;
+	}
+	/**
+	 * function getPipeline
+	 * Get the application and survey objects of the Session in order
+	 */
+	private function getPipeline($uid)
+	{
+		$querystring = '
+			PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE .'>
+			PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE .'>
+			SELECT DISTINCT ?object 
+			WHERE
+			{
+				_session predicates:resource_type resources:session .
+				?x predicates:uid \'' . $uid . '\' .
+				{ ?x predicates:has_application ?object .}
+				UNION
+				{ ?x predicates:has_survey ?object .}
+
+			
+		}';	
+		$result = $this->model->sparqlQuery($querystring);
+		print_r($result);
+	}
+
+	/**
+	 * function getAnswerSets
+	 * Get the answersets belonging to the given session
+	 */
+	private function getAnswerSets($uid)
+	{
+	}
+
+	/**
+	 * Save the given Session object in the file.
+	 * @param type $rToolObjects
+	 */
+	public function set($rToolObject)
+	{
+		$this->load();
+		$resourceSession = new Resource(SESSION . '/' . $rToolObject->uid);
+		//Remove the old value stored with the given id
+		$this->model->subtract($this->model->find($resourceSession, null, null));
+
+		//Set the new values
+		$resourceSessionType = new Resource(SESSION);
+		$predicateType = new Resource(RTYPE);
+		$this->model->add(new Statement($resourceSession, $predicateType, $resourceSessionType));
+
+		$sessionId = new Literal($rToolObject->uid);
+		$predicateId = new Resource(UID);
+		$this->model->add(new Statement($resourceSession, $predicateId, $sessionId));
+
+		$sessionTitle = new Literal($rToolObject->title);
+		$predicateTitle = new Resource(TITLE);
+		$this->model->add(new Statement($resourceSession, $predicateTitle, $sessionTitle));
+
+		$sessionTimestamp = new Literal($rToolObject->datetime->getTimestamp());
+		$predicateTimestamp = new Resource(DATETIME);
+		$this->model->add(new Statement($resourceSession, $predicateTimestamp, $sessionTimestamp));
+
+		if(isset($rToolObject->pipeline))
+		{
+			foreach($rToolObject->pipeline as $element)
+			{
+				$sessionObject = new Literal($element->uid);
+				$predicateObject = null;
+				if(get_class($element) == "Application")
+					$predicateObject = new Resource(HAS_APPLICATION);
+				else if(get_class($element) == "Survey")
+					$predicateObject = new Resource(HAS_SURVEY);
+				if(isset($predicateObject))
+					$this->model->add(new Statement($resourceSession, $predicateObject, $sessionObject));
+			}
+		}
+
+		if(isset($rToolObjects->answerSets))
+		{
+			foreach($rToolObject->answersets as $answerset)
+			{
+				$sessionAnswerSet = new Literal($answerset->uid);
+				$predicateAnswerSet = new Resource(HAS_ANSWERSET);
+				$this->model->add(new Statement($resourceSession, $predicateAnswerSet, $sessionAnswerSet));
+			}
+		}
+
+		$this->save();
+	}
+
+
+
+}
+?>
+
Index: Dev/branches/jos-branch/classes/SurveyConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/SurveyConnector.php	(revision 141)
+++ Dev/branches/jos-branch/classes/SurveyConnector.php	(revision 143)
@@ -95,5 +95,4 @@
         if(!empty($results))
         {
-            $this->db = new DatabaseInterface();
             foreach($results as $result)
             {
@@ -128,4 +127,5 @@
         if(!empty($results))
         {
+            $this->db = new DatabaseInterface();
             foreach($results as $questionId)
             {
Index: Dev/branches/jos-branch/data/answers/answers.rdf
===================================================================
--- Dev/branches/jos-branch/data/answers/answers.rdf	(revision 143)
+++ Dev/branches/jos-branch/data/answers/answers.rdf	(revision 143)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Generated by RdfSerializer.php from RDF RAP.
+# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !-->
+
+<rdf:RDF
+   xml:base="data/answers/answers.rdf#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:ns1="http://tbm.tudelft.nl/researchtool/predicates/">
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/answer/826b5ab1c5ef9a9f59832b7dbd2f7360">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/answer"/>
+   <ns1:uid>826b5ab1c5ef9a9f59832b7dbd2f7360</ns1:uid>
+   <ns1:question_code>2807fdaf2fe624323d24a5d85599eb83</ns1:question_code>
+   <ns1:answered>42</ns1:answered>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/answer/8bd823fe04d1eba795870f6bc13a8bc7">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/answer"/>
+   <ns1:uid>8bd823fe04d1eba795870f6bc13a8bc7</ns1:uid>
+   <ns1:question_code>q2</ns1:question_code>
+   <ns1:answered>21</ns1:answered>
+   <ns1:answered>42</ns1:answered>
+</rdf:Description>
+
+</rdf:RDF>
Index: Dev/branches/jos-branch/data/answers/answersets.rdf
===================================================================
--- Dev/branches/jos-branch/data/answers/answersets.rdf	(revision 143)
+++ Dev/branches/jos-branch/data/answers/answersets.rdf	(revision 143)
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Generated by RdfSerializer.php from RDF RAP.
+# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !-->
+
+<rdf:RDF
+   xml:base="data/answers/answersets.rdf#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:ns1="http://tbm.tudelft.nl/researchtool/predicates/">
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/answerset/52fe4a3e1f42f0f646226e184852dd00">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/answerset"/>
+   <ns1:uid>52fe4a3e1f42f0f646226e184852dd00</ns1:uid>
+   <ns1:for_survey>b91d39e8667372e220bb861b3f94b5bd</ns1:for_survey>
+   <ns1:by_respondent>0e3f8fec2bd4773ab951ac8606850ebf</ns1:by_respondent>
+   <ns1:given_answer>826b5ab1c5ef9a9f59832b7dbd2f7360</ns1:given_answer>
+   <ns1:given_answer>8bd823fe04d1eba795870f6bc13a8bc7</ns1:given_answer>
+</rdf:Description>
+
+</rdf:RDF>
Index: Dev/branches/jos-branch/data/applications/applications.rdf
===================================================================
--- Dev/branches/jos-branch/data/applications/applications.rdf	(revision 141)
+++ Dev/branches/jos-branch/data/applications/applications.rdf	(revision 143)
@@ -32,3 +32,12 @@
 </rdf:Description>
 
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/application/c9390a27f525d84c1795bcb5c6caf33f">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/application"/>
+   <ns1:uid>c9390a27f525d84c1795bcb5c6caf33f</ns1:uid>
+   <ns1:title>DotA</ns1:title>
+   <ns1:description>Best game ever</ns1:description>
+   <ns1:style>highskill eu pm</ns1:style>
+</rdf:Description>
+
+
 </rdf:RDF>
Index: Dev/branches/jos-branch/data/questions/questions.rdf
===================================================================
--- Dev/branches/jos-branch/data/questions/questions.rdf	(revision 141)
+++ Dev/branches/jos-branch/data/questions/questions.rdf	(revision 143)
@@ -36,4 +36,14 @@
    <ns1:question_type>int</ns1:question_type>
    <ns1:question_category>Gaming</ns1:question_category>
+   <ns1:has_answer>4</ns1:has_answer>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/question/2807fdaf2fe624323d24a5d85599eb83">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/question"/>
+   <ns1:question_code>2807fdaf2fe624323d24a5d85599eb83</ns1:question_code>
+   <ns1:title>How much wood could a woodchuck chuck if a woodchuck could chuck wood?</ns1:title>
+   <ns1:description>Een vraag</ns1:description>
+   <ns1:question_type>INT</ns1:question_type>
+   <ns1:question_category>Tongue Twisters</ns1:question_category>
 </rdf:Description>
 
Index: Dev/branches/jos-branch/data/sessions/sessions.rdf
===================================================================
--- Dev/branches/jos-branch/data/sessions/sessions.rdf	(revision 143)
+++ Dev/branches/jos-branch/data/sessions/sessions.rdf	(revision 143)
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Generated by RdfSerializer.php from RDF RAP.
+# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !-->
+
+<rdf:RDF
+   xml:base="data/sessions/sessions.rdf#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:ns1="http://tbm.tudelft.nl/researchtool/predicates/">
+   
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/session/f2989fac2de2ac27f78162b637ae84b5">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/session"/>
+   <ns1:uid>f2989fac2de2ac27f78162b637ae84b5</ns1:uid>
+   <ns1:title>Nieuwe sessie</ns1:title>
+   <ns1:datetime>1320071908</ns1:datetime>
+   <ns1:has_application>c571ae05fa6e69ad63a8793f1484206f</ns1:has_application>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/session/6cf683023d644b1794cd8c410134ca91">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/session"/>
+   <ns1:uid>6cf683023d644b1794cd8c410134ca91</ns1:uid>
+   <ns1:title>Supervet, deze sessie</ns1:title>
+   <ns1:datetime>1320072148</ns1:datetime>
+   <ns1:has_survey>b91d39e8667372e220bb861b3f94b5bd</ns1:has_survey>
+   <ns1:has_application>c571ae05fa6e69ad63a8793f1484206f</ns1:has_application>
+   <ns1:has_application>c9390a27f525d84c1795bcb5c6caf33f</ns1:has_application>
+   <ns1:has_survey>bab0492e295700ed0324f724b9c8a815</ns1:has_survey>
+</rdf:Description>
+
+</rdf:RDF>
Index: Dev/branches/jos-branch/data/surveys/surveys.rdf
===================================================================
--- Dev/branches/jos-branch/data/surveys/surveys.rdf	(revision 141)
+++ Dev/branches/jos-branch/data/surveys/surveys.rdf	(revision 143)
@@ -18,3 +18,13 @@
 </rdf:Description>
 
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/survey/bab0492e295700ed0324f724b9c8a815">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/survey"/>
+   <ns1:uid>bab0492e295700ed0324f724b9c8a815</ns1:uid>
+   <ns1:title>TestSurveyDeluxe</ns1:title>
+   <ns1:description>Zomaar, jeweetwel</ns1:description>
+   <ns1:has_question>q2</ns1:has_question>
+   <ns1:has_question>2807fdaf2fe624323d24a5d85599eb83</ns1:has_question>
+</rdf:Description>
+
+
 </rdf:RDF>
Index: Dev/branches/jos-branch/data/users/respondents.rdf
===================================================================
--- Dev/branches/jos-branch/data/users/respondents.rdf	(revision 143)
+++ Dev/branches/jos-branch/data/users/respondents.rdf	(revision 143)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!-- Generated by RdfSerializer.php from RDF RAP.
+# http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !-->
+
+<rdf:RDF
+   xml:base="data/users/respondents.rdf#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:ns1="http://tbm.tudelft.nl/researchtool/predicates/">
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/predicates/respondent/ed75e5ef3c0c73a82593acc590a97262">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/predicates/respondent"/>
+   <ns1:uid>ed75e5ef3c0c73a82593acc590a97262</ns1:uid>
+   <ns1:name>Jos</ns1:name>
+   <ns1:password>test</ns1:password>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/predicates/respondent/67e911ea2f86ac11378d9460184cbc78">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/predicates/respondent"/>
+   <ns1:uid>67e911ea2f86ac11378d9460184cbc78</ns1:uid>
+   <ns1:name>Jos</ns1:name>
+   <ns1:password>test</ns1:password>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/predicates/respondent/a6e4e3ddeb2f8669a682d5b4879f68ce">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/predicates/respondent"/>
+   <ns1:uid>a6e4e3ddeb2f8669a682d5b4879f68ce</ns1:uid>
+   <ns1:name>Jos</ns1:name>
+   <ns1:password>test</ns1:password>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/predicates/respondent/6ca29d44ef05ba5367261d36f4ff767c">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/predicates/respondent"/>
+   <ns1:uid>6ca29d44ef05ba5367261d36f4ff767c</ns1:uid>
+   <ns1:name>Jos</ns1:name>
+   <ns1:password>test</ns1:password>
+</rdf:Description>
+
+<rdf:Description rdf:about="http://tbm.tudelft.nl/researchtool/resources/respondent/0e3f8fec2bd4773ab951ac8606850ebf">
+   <ns1:resource_type rdf:resource="http://tbm.tudelft.nl/researchtool/resources/respondent"/>
+   <ns1:uid>0e3f8fec2bd4773ab951ac8606850ebf</ns1:uid>
+   <ns1:name>Jos</ns1:name>
+   <ns1:password>qwerty</ns1:password>
+</rdf:Description>
+
+
+</rdf:RDF>
Index: Dev/branches/jos-branch/rdfConstants.php
===================================================================
--- Dev/branches/jos-branch/rdfConstants.php	(revision 141)
+++ Dev/branches/jos-branch/rdfConstants.php	(revision 143)
@@ -14,8 +14,11 @@
 define('QUESTION',SURVEYTOOL_RESOURCES_NAMESPACE . 'question');
 define('APPLICATION',SURVEYTOOL_RESOURCES_NAMESPACE . 'application');
+define('ANSWER', SURVEYTOOL_RESOURCES_NAMESPACE . 'answer');
+define('ANSWERSET', SURVEYTOOL_RESOURCES_NAMESPACE . 'answerset');
 define('SESSION',SURVEYTOOL_RESOURCES_NAMESPACE . 'session');
 define('DASHBOARD',SURVEYTOOL_RESOURCES_NAMESPACE . 'dashboard');
 define('GRAPH',SURVEYTOOL_RESOURCES_NAMESPACE . 'graph');
 define('DATA',SURVEYTOOL_RESOURCES_NAMESPACE . 'data');
+define('RESPONDENT',SURVEYTOOL_RESOURCES_NAMESPACE . 'respondent');
 define('APPDATA',SURVEYTOOL_RESOURCES_NAMESPACE . 'graph');
 
@@ -27,4 +30,5 @@
 define('TITLE',SURVEYTOOL_PREDICATES_NAMESPACE . 'title');
 define('DESCRIPTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'description');
+define('DATETIME',SURVEYTOOL_PREDICATES_NAMESPACE . 'datetime');
 define('PART_OF',SURVEYTOOL_PREDICATES_NAMESPACE . 'part_of');
 define('STYLE',SURVEYTOOL_PREDICATES_NAMESPACE . 'style');
@@ -33,5 +37,4 @@
 define('QCODE',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_code');
 define('ANSWERED',SURVEYTOOL_PREDICATES_NAMESPACE . 'answered');
-define('RESPONDENT',SURVEYTOOL_PREDICATES_NAMESPACE . 'respondent');
 define('QCATEGORY',SURVEYTOOL_PREDICATES_NAMESPACE . 'question_category');
 define('HAS_QUESTION',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_question');
@@ -43,4 +46,10 @@
 define('HAS_DATA',SURVEYTOOL_PREDICATES_NAMESPACE . 'has_data');
 define('DATA_TYPE',SURVEYTOOL_PREDICATES_NAMESPACE . 'data_type');
+define('FOR_SURVEY',SURVEYTOOL_PREDICATES_NAMESPACE . 'for_survey');
+define('BY_RESPONDENT',SURVEYTOOL_PREDICATES_NAMESPACE . 'by_respondent');
+define('GIVEN_ANSWER',SURVEYTOOL_PREDICATES_NAMESPACE . 'given_answer');
+define('HAS_APPLICATION', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_application');
+define('HAS_SURVEY', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_survey');
+define('HAS_ANSWERSET', SURVEYTOOL_PREDICATES_NAMESPACE . 'has_answerset');
 
 ?>
Index: Dev/branches/jos-branch/testpage.php
===================================================================
--- Dev/branches/jos-branch/testpage.php	(revision 141)
+++ Dev/branches/jos-branch/testpage.php	(revision 143)
@@ -2,6 +2,6 @@
     require 'classes/master.php';
 
-    $db = new DatabaseInterface();
-    $result = $db->get("survey", array("questions" => array("q4")));
-    print_r($result);
+	$db = new DatabaseInterface();
+	$results = $db->get("session", array());
+
 ?>
