Index: Dev/branches/jos-branch/classes/DatabaseInterface.php
===================================================================
--- Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 143)
+++ Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 148)
@@ -47,5 +47,5 @@
      * @return type 
      */
-    public function get($type, $arguments)
+    public function get($type, $arguments = array())
     {
         switch(strtolower($type))
@@ -71,7 +71,8 @@
 			case "answerset":
 				return $this->answerSetConnector->get($arguments);
+				break;
 			case "session":
 				return $this->sessionConnector->get($arguments);
-
+				break;
         }
     }
@@ -109,5 +110,4 @@
 				$this->sessionConnector->set($rToolObject);
 				break;
-
         }
     }
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 148)
@@ -1,3 +1,8 @@
 <?php
+// Survey database interface class as intermediate for storing data from the site to the RDF database 
+require_once 'rdfConstants.php';
+// Include RAP Library to write RDF files
+include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
+
 /**
  * Description of SessionConnector
@@ -103,4 +108,5 @@
 			foreach($results as $result)
 			{
+				//Create a session object out of every result, get all required fields as well.
 				$pipeline = $this->getPipeline($result['?uid']->label);
 				$answersets = $this->getAnswerSets($result['?uid']->label);
@@ -118,20 +124,22 @@
 	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);
+		$result = $this->model->findRegex("[(".$uid.")]", "[(has_application)|(has_survey)]" ,null);
+		$iterator = $result->getStatementIterator();
+		$pipeline = array();
+		while($iterator->hasNext())
+		{
+			$element = $iterator->next();
+			if(strpos($element->getLabelPredicate(), "has_application") != false)
+			{
+				$applications = $this->db->get("application", array("uid" => $element->getLabelObject()));
+				$pipeline[] = $applications[0];
+			}
+			else
+			{
+				$surveys = $this->db->get("survey", array("uid" => $element->getLabelObject()));
+				$pipeline[] = $surveys[0];
+			}
+		}
+		return $pipeline;
 	}
 
@@ -142,4 +150,14 @@
 	private function getAnswerSets($uid)
 	{
+		$result = $this->model->findRegex("[(".$uid.")]", "[(has_answerset)]" ,null);
+		$iterator = $result->getStatementIterator();
+		$answersets = array();
+		while($iterator->hasNext())
+		{
+			$element = $iterator->next();
+			$resultsets = $this->db->get("answerset", array("uid" => $element->getLabelObject()));
+			$answersets[] = $resultsets[0];
+		}
+		return $answersets;
 	}
 
@@ -172,4 +190,5 @@
 		$this->model->add(new Statement($resourceSession, $predicateTimestamp, $sessionTimestamp));
 
+		//Create a sequence to store the different applications and surveys.
 		if(isset($rToolObject->pipeline))
 		{
@@ -187,5 +206,5 @@
 		}
 
-		if(isset($rToolObjects->answerSets))
+		if(isset($rToolObject->answersets))
 		{
 			foreach($rToolObject->answersets as $answerset)
@@ -199,7 +218,4 @@
 		$this->save();
 	}
-
-
-
 }
 ?>
Index: Dev/branches/jos-branch/classes/Survey.php
===================================================================
--- Dev/branches/jos-branch/classes/Survey.php	(revision 143)
+++ Dev/branches/jos-branch/classes/Survey.php	(revision 148)
@@ -12,5 +12,5 @@
     public $questions;
     
-    public function __construct($uid = null, $title = null, $description = null, $questions = null) {
+    public function __construct($uid = null, $title = null, $description = null, $creator = null, $questions = null) {
         if(!isset($uid))
         {
@@ -19,5 +19,6 @@
         $this->uid = $uid;
         $this->title = $title;
-        $this->description = $description;
+		$this->description = $description;
+		$this->creator = $creator;
         $this->questions = $questions;
     }
Index: Dev/branches/jos-branch/classes/SurveyConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/SurveyConnector.php	(revision 143)
+++ Dev/branches/jos-branch/classes/SurveyConnector.php	(revision 148)
@@ -55,5 +55,5 @@
         $keys = array_keys($arguments);
         //Set default values for arguments
-        $uid = "?uid"; $title = "?title"; $description = "?description"; $questions = "";
+        $uid = "?uid"; $title = "?title"; $description = "?description"; $creator = "?creator"; $questions = "";
         if(in_array("uid", $keys))
             $uid = '\''.$arguments["uid"].'\'';
@@ -61,5 +61,7 @@
             $title = '\''.$arguments["title"].'\'';
         if(in_array("description", $keys))
-            $description = "\"".$arguments["description"]."\"";
+			$description = "\"".$arguments["description"]."\"";
+		if(in_array("creator", $keys))
+			$creator = "\"".$arguments["creator"]."\"";
         if(in_array("questions", $keys))
         {
@@ -75,5 +77,5 @@
             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-            SELECT DISTINCT ?uid, ?title, ?description
+            SELECT DISTINCT ?uid, ?title, ?description, ?creator
             WHERE
             {
@@ -84,5 +86,6 @@
                 predicates:uid ' . $uid . ' 
                 predicates:title ' . $title . '
-                predicates:description ' . $description . '
+				predicates:description ' . $description . '
+				predicates:creator ' . $creator . '
                 ' . $questions . '
             }';
@@ -95,8 +98,10 @@
         if(!empty($results))
         {
+            $this->db = new DatabaseInterface();
             foreach($results as $result)
             {
-                $questions = $this->getQuestions($result['?uid']->label);
-                $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $questions);
+				$questions = $this->getQuestions($result['?uid']->label);
+				$creator = $this->db->get("user", array("uid" => $result['?creator']->label));
+                $surveys[] = new Survey($result['?uid']->label, $result['?title']->label, $result['?description']->label, $creator[0], $questions);
             }
         }
@@ -127,5 +132,4 @@
         if(!empty($results))
         {
-            $this->db = new DatabaseInterface();
             foreach($results as $questionId)
             {
@@ -165,4 +169,8 @@
         $this->model->add(new Statement($resourceSurvey,$predicateDescription,$surveyDescription));
         
+		$predicateCreator = new Resource(CREATOR);
+		$surveyCreator = new Literal($rToolObject->creator->uid);
+		$this->model->add(new Statement($resourceSurvey, $predicateCreator, $surveyCreator));
+
         if(isset($rToolObject->questions))
         {
Index: Dev/branches/jos-branch/classes/UserConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/UserConnector.php	(revision 143)
+++ Dev/branches/jos-branch/classes/UserConnector.php	(revision 148)
@@ -81,5 +81,4 @@
 					predicates:password ' . $password . ' 
             }';
-        echo $querystring;
         //Query the model
         $results = $this->model->sparqlQuery($querystring);
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 148)
@@ -7,5 +7,5 @@
    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"/>
@@ -20,9 +20,10 @@
    <ns1:uid>6cf683023d644b1794cd8c410134ca91</ns1:uid>
    <ns1:title>Supervet, deze sessie</ns1:title>
-   <ns1:datetime>1320072148</ns1:datetime>
+   <ns1:datetime>0</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>
+   <ns1:has_answerset>52fe4a3e1f42f0f646226e184852dd00</ns1:has_answerset>
 </rdf:Description>
 
Index: Dev/branches/jos-branch/data/surveys/surveys.rdf
===================================================================
--- Dev/branches/jos-branch/data/surveys/surveys.rdf	(revision 143)
+++ Dev/branches/jos-branch/data/surveys/surveys.rdf	(revision 148)
@@ -13,7 +13,8 @@
    <ns1:title>SuperSurvey</ns1:title>
    <ns1:description>Dit is een surveybeschrijving</ns1:description>
+   <ns1:creator>b76cbf38cac7a3f048ca0d64a6c3ef58</ns1:creator>
    <ns1:has_question>q1</ns1:has_question>
-   <ns1:has_question>q2</ns1:has_question>
    <ns1:has_question>q3</ns1:has_question>
+   <ns1:has_question>2807fdaf2fe624323d24a5d85599eb83</ns1:has_question>
 </rdf:Description>
 
@@ -23,8 +24,8 @@
    <ns1:title>TestSurveyDeluxe</ns1:title>
    <ns1:description>Zomaar, jeweetwel</ns1:description>
+   <ns1:creator>b76cbf38cac7a3f048ca0d64a6c3ef58</ns1:creator>
    <ns1:has_question>q2</ns1:has_question>
    <ns1:has_question>2807fdaf2fe624323d24a5d85599eb83</ns1:has_question>
 </rdf:Description>
 
-
 </rdf:RDF>
Index: Dev/branches/jos-branch/testpage.php
===================================================================
--- Dev/branches/jos-branch/testpage.php	(revision 143)
+++ Dev/branches/jos-branch/testpage.php	(revision 148)
@@ -3,5 +3,6 @@
 
 	$db = new DatabaseInterface();
-	$results = $db->get("session", array());
+	$user = $db->get("user", array("name" => "jkraaijeveld"));
+	print_r($user[0]);
 
 ?>
