Index: Dev/branches/jos-branch/classes/ApplicationConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/ApplicationConnector.php	(revision 123)
+++ Dev/branches/jos-branch/classes/ApplicationConnector.php	(revision 123)
@@ -0,0 +1,111 @@
+<?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 ApplicationConnector
+ *
+ * @author jkraaijeveld
+ */
+class ApplicationConnector implements IConnector{
+    
+    protected $model;
+    protected $fileName = 'data/applications/applications.rdf';
+
+    /**
+     * Constructor for ApplicationConnector.
+     */
+    public function __construct()
+    {
+        //Ensure the required folder for this connector exists
+        if (!is_dir('data/applications/'))
+            mkdir('data/applications/');	
+    }
+    
+    /**
+     * 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'); 
+    }
+    
+    /**
+     * function get($arguments)
+     * Gets the array of Application objects belonging to arguments supplied.
+     * @param type $arguments : An array containing zero or more of the following keys:
+     *                          'id', 'title', 'description', 'style'
+     */
+    public function get($arguments) {
+        $this->load();
+        //Determine which arguments are supplied
+        $keys = array_keys($arguments);
+        //Set default values for arguments
+        $id = "?uid"; $title = "?title"; $description = "?description"; $style = "?style";
+        //Set the arguments if they are supplied
+        if(in_array("id", $keys))
+            $id = "\"".$arguments["id"]."\"";
+        if(in_array("title", $keys))
+            $title = '\''.$arguments["title"].'\'';
+        if(in_array("description", $keys))
+            $description = "\"".$arguments["description"]."\"";
+        if(in_array("style", $keys))
+            $style = "\"".$arguments["style"]."\"";    
+
+        //Create the querystring 
+        $querystring = '
+            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
+            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
+            SELECT ?uid, ?title, ?description, ?style
+            WHERE 	
+            {
+                    _application	predicates:resource_type	resources:application ;
+                                        predicates:uid			'. $id . ';
+                                        predicates:title 		'. $title . ';
+                                        predicates:description		'. $description . ';
+                                        predicates:style		'. $style .'
+            }';
+        //Query the model
+        echo $querystring;
+        $results = $this->model->sparqlQuery($querystring);
+        $applications = array();
+        echo count($results);
+        //Run over all results and create appropriate Application objets
+        foreach($results as $result)
+        {
+            
+            $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
+        }
+        //Return the list of application objects
+        return $applications;
+    }
+    
+    /**
+     * function set()
+     * Finds the required databaseentry matching the given objects and removes
+     * it from the rdf file.
+     * @param type $rToolObject 
+     */
+    public function set($rToolObject)
+    {
+        //TODO
+    }
+}
+
+?>
Index: Dev/branches/jos-branch/classes/DatabaseInterface.php
===================================================================
--- Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 123)
+++ Dev/branches/jos-branch/classes/DatabaseInterface.php	(revision 123)
@@ -0,0 +1,36 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of DatabaseInterface
+ * Initializes all the connectors, serves as only entrance and exit point
+ * for the frontend
+ * @author jkraaijeveld
+ */
+class DatabaseInterface {
+    
+    /**
+     * Constructor for the DatabaseInterface class
+     */
+    protected $applicationConnector;
+    
+    public function __construct() {
+        $this->applicationConnector = new ApplicationConnector();
+    }
+    
+    public function get($type, $arguments)
+    {
+        switch($type)
+        {
+            case "application":
+                return $this->applicationConnector->get($arguments);
+            
+        }
+    }
+}
+
+?>
Index: Dev/branches/jos-branch/classes/IConnector.php
===================================================================
--- Dev/branches/jos-branch/classes/IConnector.php	(revision 123)
+++ Dev/branches/jos-branch/classes/IConnector.php	(revision 123)
@@ -0,0 +1,21 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of Connector
+ *
+ * @author jkraaijeveld
+ */
+interface IConnector {
+    //This class will outline everything a Connector needs to operate within the system
+    public function get($arguments);
+    public function set($rToolObject);
+    public function load();
+    public function save();
+}
+
+?>
Index: Dev/branches/jos-branch/classes/ResearchToolObject.php
===================================================================
--- Dev/branches/jos-branch/classes/ResearchToolObject.php	(revision 123)
+++ Dev/branches/jos-branch/classes/ResearchToolObject.php	(revision 123)
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Description of ResearchToolObject
+ *
+ * @author jkraaijeveld
+ */
+class ResearchToolObject {
+    public $id;
+}
+
+?>
