Changeset 45 for Dev


Ignore:
Timestamp:
07/25/11 15:11:23 (14 years ago)
Author:
basvannuland
Message:

new file structure. surveys/users/application DBs in data folder

Location:
Dev/trunk
Files:
2 added
2 deleted
11 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/ApplicationDatabaseInterface.php

    r40 r45  
    22
    33// Survey database interface class as intermediate for storing data from the site to the RDF database
    4 require 'rdfConstants.php';
     4require_once 'rdfConstants.php';
    55
    66// Include RAP Library to write RDF files
    7 define("RDFAPI_INCLUDE_DIR", "rdfapi/");
    87include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
    98
  • Dev/trunk/classes/ApplicationRDFReader.php

    r40 r45  
    1111                $this->model = $factory->getDefaultModel();
    1212               
    13                 $fileName = 'applications/applications.rdf';
     13                $fileName = 'data/applications/applications.rdf';
    1414               
    1515                if(file_exists($fileName))
  • Dev/trunk/classes/ApplicationRDFWriter.php

    r40 r45  
    44{
    55        protected $model;
    6         protected $fileName = 'applications/applications.rdf';
     6        protected $fileName = 'data/applications/applications.rdf';
    77
    88        public function __construct($applicationID)
  • Dev/trunk/classes/SurveyAnswerDatabaseInterface.php

    r40 r45  
    22
    33// Survey class as intermediate for storing data from the site to the RDF database
    4 require 'rdfConstants.php';
     4require_once 'rdfConstants.php';
    55
    66// Include RAP Library to write RDF files
    7 define("RDFAPI_INCLUDE_DIR", "rdfapi/");
    87include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
    98
  • Dev/trunk/classes/SurveyAnswerRDFReader.php

    r40 r45  
    44{       
    55        protected $tempModel;
     6        protected $answerPath
    67       
    78    public function __construct($surveyUID)
     
    1213                $factory = new ModelFactory();
    1314                $this->tempModel = $factory->getDefaultModel();
     15                $this->answerPath = 'data/surveys/answers_'.$this->surveyUID;
    1416        }
    1517       
     
    2426                $this->tempModel->loadModel($this->model);
    2527               
    26                 $answerPath = 'surveys/answers_'.$this->surveyUID;
    2728                $answers = array();
    2829               
    29                 if($handle = opendir('$answerPath'))
     30                if($handle = opendir($this->answerPath))
    3031                {
    3132                        while (false !== ($file = readdir($handle))) {
     
    3738                foreach($answers as $answer)
    3839                {
    39                         $this->tempModel->load($answerPath.'/'.$answer);
     40                        $this->tempModel->load($this->answerPath.'/'.$answer);
    4041                }
    4142               
     
    6667                $this->tempModel->loadModel($this->model);
    6768               
    68                 $answerPath = 'surveys/answers_'.$this->surveyUID;
    69                
    70                 $this->tempModel->load($answerPath . '/$answer_' . $respondentID);
     69                $this->tempModel->load($this->answerPath . '/$answer_' . $respondentID);
    7170               
    7271                $this->tempModel->visualize();
     
    9493        {
    9594                $this->tempModel->loadModel($this->model);
    96                
    97                 $answerPath = 'surveys/answers_'.$this->surveyUID;
    98                
    99                 $this->tempModel->load($answerPath . '/$answer_' . $respondentID);
     95                               
     96                $this->tempModel->load($this->answerPath . '/$answer_' . $respondentID);
    10097               
    10198                $this->tempModel->visualize();
  • Dev/trunk/classes/SurveyAnswerRDFWriter.php

    r40 r45  
    44{
    55        protected $userUID;
     6        protected $answerPath
    67
    78        public function __construct($surveyUID,$userUID)
     
    1011               
    1112                $this->userUID = $userUID;
     13                $this->answerPath = 'data/surveys/answers_'.$this->surveyUID;
    1214    }
    1315       
    1416        public function saveSurvey()
    1517        {       
    16                 $answerPath = 'surveys/answers_'.$this->surveyUID;
    17                 if (!is_dir($answerPath))
    18                         mkdir($answerPath);             
    19                 $this->model->saveAs($answerPath.'/answer_'.$this->userUID.'.rdf','rdf');
     18                if (!is_dir($this->answerPath))
     19                        mkdir($this->answerPath);               
     20                $this->model->saveAs($this->answerPath.'/answer_'.$this->userUID.'.rdf','rdf');
    2021        }
    2122       
    2223        public function setRespondentData($name)
    2324        {                               
    24                 $resourceUser = new Resource(USER);
     25                $resourceUser = new Resource(USER . '/' . $userID);             
     26               
     27                $resourceUserType = new Resource(USER);
     28                $predicateRType = new Resource(RTYPE);
     29                $this->model->add(new Statement($resourceUser,$predicateRType,$resourceUserType));
    2530               
    2631                $LiteralUserName = new Literal($name);
  • Dev/trunk/classes/SurveyDatabaseInterface.php

    r44 r45  
    9999                $surveys = array();
    100100       
    101                 if($handle = opendir('surveys/'))
     101                if($handle = opendir('data/surveys/'))
    102102                {
    103103                        while (false !== ($file = readdir($handle))) {
  • Dev/trunk/classes/SurveyRDFReader.php

    r44 r45  
    66       
    77        protected $surveyUID;
     8        protected $filePath;
    89       
    910    public function __construct($surveyUID)
     
    1415               
    1516                $this->surveyUID = $surveyUID;
     17                $this->filePath = 'data/surveys/survey_'.$this->surveyUID.'.rdf';
    1618        }
    1719       
    1820        public function loadSurvey()
    1921        {
    20                 $this->model->load('surveys/survey_'.$this->surveyUID.'.rdf');
     22                $this->model->load($this->filePath);
    2123        }
    2224       
     
    155157                $factory = new ModelFactory();
    156158                $tempmodel= $factory->getDefaultModel();
    157                 $tempmodel->load('surveys/survey_'.$surveyID.'.rdf');
     159                $tempmodel->load('data/surveys/survey_'.$surveyID.'.rdf');
    158160               
    159161                $querystring = '
  • Dev/trunk/classes/SurveyRDFWriter.php

    r44 r45  
    77        protected $resourceSurvey;
    88        protected $surveyUID;
     9        protected $filePath;
    910       
    1011    public function __construct($surveyUID)
     
    1516               
    1617                $this->surveyUID = $surveyUID;
     18                $this->filePath = 'data/surveys/survey_'.$this->surveyUID.'.rdf';
    1719               
    1820    }   
     
    2022        public function saveSurvey()
    2123        {       
    22                 $this->model->saveAs('surveys/survey_'.$this->surveyUID.'.rdf','rdf');
     24                $this->model->saveAs($this->filePath);
    2325        }
    2426       
  • Dev/trunk/classes/UserRDFReader.php

    r44 r45  
    44{
    55        protected $model;
     6        protected $fileName = 'data/users/users.rdf';
    67                       
    78    public function __construct()
     
    1112                $this->model = $factory->getDefaultModel();
    1213               
    13                 $fileName = 'users/users.rdf';
    1414               
    15                 if(file_exists($fileName))
    16                         $this->model->load($fileName);
     15                if(file_exists($this->fileName))
     16                        $this->model->load($this->fileName);
    1717    }
    1818       
  • Dev/trunk/classes/UserRDFWriter.php

    r44 r45  
    55
    66        protected $model;
    7         protected $fileName = 'users/users.rdf';
     7        protected $fileName = 'data/users/users.rdf';
    88                       
    99    public function __construct()
Note: See TracChangeset for help on using the changeset viewer.