Changeset 82 for Dev/trunk/classes/SurveyRDFReader.php
- Timestamp:
- 08/24/11 17:52:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/classes/SurveyRDFReader.php
r78 r82 25 25 public function getSurveyInfo() 26 26 { 27 SurveyRDFReader::loadSurvey();27 $this->loadSurvey(); 28 28 29 29 $result = array(); 30 $result[ ] = $this->readSurveyInfo();31 $result[ ] = $this->readSurveyQuestions();30 $result['info'] = $this->readSurveyInfo(); 31 $result['questionIDs'] = $this->readSurveyQuestionIDs(); 32 32 33 33 return $result; … … 53 53 return $result; 54 54 } 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() 119 57 { 120 58 $querystring = ' … … 124 62 WHERE 125 63 { 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 147 66 }'; 148 67
Note: See TracChangeset
for help on using the changeset viewer.