- Timestamp:
- 03/03/12 19:09:19 (13 years ago)
- Location:
- Dev/branches/rest-dojo-ui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/branches/rest-dojo-ui
- Property svn:mergeinfo changed
/Dev/branches/jos-branch merged: 298
- Property svn:mergeinfo changed
-
Dev/branches/rest-dojo-ui/server/classes/models/Answer.php
r274 r302 50 50 if(is_string($this->question)) 51 51 { 52 $result = Question::get(array("uid" => $this->question)); 52 $ans = ResearchToolObject::stripUri($this->question); 53 $result = Question::get(array("uid" => $ans["uid"])); 53 54 if(!isset($result[0])) 54 55 return false; … … 71 72 PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '> 72 73 PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '> 73 SELECT DISTINCT ?uid, ? question_code74 SELECT DISTINCT ?uid, ?to_question 74 75 WHERE 75 76 { … … 77 78 78 79 predicates:uid ?uid ; 79 predicates: question_code ?question_code;80 predicates:to_question ?to_question ; 80 81 ' . ResearchToolObject::createArguments($arguments) . ' 81 82 }'; … … 83 84 //Query the model 84 85 $results = $model->sparqlQuery($querystring); 85 //An answer can have multiple values, get all these values for the answer instances found.86 //An answer can have multiple values, get all these values for the answer instances found. 86 87 $answers = array(); 87 88 if(!empty($results)) … … 89 90 foreach($results as $result) 90 91 { 91 $answers[] = new Answer($result['?uid']->label, $result['? question_code']->label, Answer::getValues($model, $result['?uid']->label));92 $answers[] = new Answer($result['?uid']->label, $result['?to_question']->uri, Answer::getValues($model, $result['?uid']->label)); 92 93 } 93 94 } … … 142 143 $model->add(new Statement($resourceAnswer, $predicateId, $answerId)); 143 144 144 $questionId = new Literal($this->question->uid);145 $predicateQId = new Resource( QCODE);145 $questionId = new Resource(QUESTION . '/' . $this->question->uid); 146 $predicateQId = new Resource(TO_QUESTION); 146 147 $model->add(new Statement($resourceAnswer, $predicateQId, $questionId)); 147 148
Note: See TracChangeset
for help on using the changeset viewer.