Index: Dev/trunk/classes/QuestionConnector.php
===================================================================
--- Dev/trunk/classes/QuestionConnector.php	(revision 158)
+++ Dev/trunk/classes/QuestionConnector.php	(revision 171)
@@ -12,8 +12,6 @@
  * @author jkraaijeveld
  */
-class QuestionConnector implements IConnector {
+class QuestionConnector extends Connector {
     
-    protected $model;
-    protected $fileName = 'data/questions/questions.rdf';
     
     /**
@@ -22,4 +20,5 @@
     public function __construct()
     {
+		$this->fileName = 'data/questions/questions.rdf';
         //Ensure the required folder for this connector exists
         if (!is_dir('data/questions/'))
@@ -28,54 +27,11 @@
     
     /**
-     * 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 questions corresponding to the arguments.
 	 * @param type $arguments : An array having one ore more of the following elements:
-	 * 'uid', 'title', 'type', 'description', 'category', 'has_answer'.
+	 * 'code', 'title', 'type', 'description', 'category', 'definedanswers'.
      */
     public function get($arguments)
     {
         $this->load();
-        
-        $keys = array_keys($arguments);
-        //Set default values for arguments
-        $uid = ""; $title = ""; $type = ""; $description = ""; $category = ""; $has_answer = "";
-        //Set the arguments if they are supplied
-        if(in_array("uid", $keys))
-            $uid = 'predicates:question_code \''.$arguments["uid"].'\'';
-        if(in_array("title", $keys))
-            $title = 'predicates:title \''.$arguments["title"].'\'';
-        if(in_array("type", $keys))
-            $type = 'predicates:type \''.$arguments["type"].'\'';
-        if(in_array("description", $keys))
-            $description = "predicates:description \"".$arguments["description"]."\"";
-        if(in_array("category", $keys))
-			$style = "predicates:category \"".$arguments["category"]."\"";
-		if(in_array("answers", $keys))
-		{
-			foreach($arguments["answers"] as $answer)
-			{
-				$has_answer = $has_answer . 'predicates:has_answer \'' . $answer . '\' ';
-			}
-		}
            
         $querystring = '
@@ -91,6 +47,8 @@
                 predicates:description ?description ;
                 predicates:question_category ?category ;
-				'. $uid . $title . $type . $description . $category . $has_answer . '
-            }';
+				'. $this->createArguments($arguments) . '
+	}';
+
+		
         //Create the querystring 
         $results = $this->model->sparqlQuery($querystring);
@@ -115,27 +73,15 @@
     private function getAnswers($uid)
     {
-        $querystring = '
-            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
-            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
-            SELECT DISTINCT ?has_answer
-            WHERE
-            {
-                 _question	predicates:resource_type	resources:question ;
-                predicates:has_answer ?has_answer ; 
-                predicates:question_code \'' . $uid . '\'
-            }';
+		$result = $this->model->findRegex("[(".$uid.")]", "[(has_answer)]", null);
+		$iterator = $result->getStatementIterator();
+		$answers = array();
+		while($iterator->hasNext())
+		{
+			$element = $iterator->next();
+			$answers[] = $element->getLabelObject();
+		}
+		return $answers;
 
-        $answers = $this->model->sparqlQuery($querystring);
-        $returnArray = array();
-        if(!empty($answers))
-        {
-            foreach($answers as $answer)
-            {
-                $returnArray[] = $answer['?has_answer']->label;
-            }
-        }
-        return $returnArray;
-    }
-
+	}
     
     /**
