Ignore:
Timestamp:
08/24/11 17:52:20 (14 years ago)
Author:
basvannuland
Message:

Start with new separate question db

File:
1 edited

Legend:

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

    r78 r82  
    2525    public function getSurveyInfo()
    2626    {           
    27         SurveyRDFReader::loadSurvey();
     27        $this->loadSurvey();
    2828
    2929        $result = array();
    30         $result[] = $this->readSurveyInfo();                           
    31         $result[] = $this->readSurveyQuestions();
     30        $result['info'] = $this->readSurveyInfo();                             
     31        $result['questionIDs'] = $this->readSurveyQuestionIDs();
    3232
    3333        return $result;
     
    5353        return $result;
    5454    }
    55 
    56     public function readSurveyQuestions()
    57     {
    58         $result = array();
    59         $result[] = $this->readSurveyQuestionsTitle();                         
    60         $result[] = $this->readSurveyQuestionsDescription();
    61         $result[] = $this->readSurveyQuestionsType();
    62         $result[] = $this->readSurveyQuestionsID();             
    63 
    64         return $result;
    65     }
    66 
    67     public function readSurveyQuestionsTitle()
    68     {
    69         $querystring = '
    70             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    71             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    72             SELECT  ?questionTitle
    73             WHERE
    74             {   
    75                     _question   predicates:resource_type        resources:question ;
    76                                 predicates:title                ?questionTitle         
    77             }';
    78 
    79         $result = $this->model->sparqlQuery($querystring);
    80 
    81         return $result;
    82     }
    83 
    84     public function readSurveyQuestionsDescription()
    85     {
    86         $querystring = '
    87             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    88             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    89             SELECT  ?questionDescription
    90             WHERE
    91             {   
    92                     _question   predicates:resource_type        resources:question ;
    93                                 predicates:description          ?questionDescription           
    94             }';
    95 
    96         $result = $this->model->sparqlQuery($querystring);
    97 
    98         return $result;
    99     }
    100 
    101     public function readSurveyQuestionsType()
    102     {
    103         $querystring = '
    104             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    105             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    106             SELECT  ?questionType
    107             WHERE
    108             {   
    109                     _question   predicates:resource_type        resources:question ;
    110                                 predicates:question_type        ?questionType                           
    111             }';
    112 
    113         $result = $this->model->sparqlQuery($querystring);
    114 
    115         return $result;
    116     }
    117 
    118     public function readSurveyQuestionsID()
     55   
     56    public function readSurveyQuestionIDs()
    11957    {
    12058        $querystring = '
     
    12462            WHERE
    12563            {   
    126                     _question   predicates:resource_type        resources:question ;
    127                                 predicates:uid                  ?questionID                             
    128             }';
    129 
    130         $result = $this->model->sparqlQuery($querystring);
    131 
    132         return $result;
    133     }
    134 
    135     public function readSurveyAnswers($questionID)
    136     {
    137         $querystring = '
    138             PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    139             PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    140             SELECT  ?answerDescription
    141             WHERE
    142             {
    143                     _question   predicates:resource_type        resources:question ;
    144                                 predicates:uid                  "' . $questionID . '"  ;
    145                                 predicates:has_answer           _answer .
    146                     _answer     predicates:description          ?answerDescription
     64                    _survey     predicates:resource_type        resources:survey ;
     65                                predicates:has_question         ?questionID                             
    14766            }';
    14867
Note: See TracChangeset for help on using the changeset viewer.