Ignore:
Timestamp:
03/01/12 15:02:59 (13 years ago)
Author:
jkraaijeveld
Message:

[Server] Made the models compliant with the Visio design in terms of ApplicationInstance?, SurveyInstance?, SessionInstance? and all of their fields.
[Server] Now stores references as RDF Resources for all models.
[Server] Changed some possible get() arguments to be more consistent.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/branches/jos-branch/server/classes/models/Answer.php

    r285 r298  
    5050                if(is_string($this->question))
    5151                {
    52                         $result = Question::get(array("uid" => $this->question));
     52                        $ans = ResearchToolObject::stripUri($this->question);
     53                        $result = Question::get(array("uid" => $ans["uid"]));
    5354                        if(!isset($result[0]))
    5455                                return false;
     
    7172                        PREFIX predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    7273                        PREFIX resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    73                         SELECT DISTINCT ?uid, ?question_code
     74                        SELECT DISTINCT ?uid, ?to_question
    7475                        WHERE
    7576                        {
     
    7778
    7879                                predicates:uid ?uid ;
    79                                 predicates:question_code ?question_code ;
     80                                predicates:to_question ?to_question ;
    8081                                ' . ResearchToolObject::createArguments($arguments) . '
    8182                        }';
     
    8384                //Query the model
    8485                $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.
    8687                $answers = array();
    8788                if(!empty($results))
     
    8990                        foreach($results as $result)
    9091                        {
    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));
    9293                        }
    9394                }
     
    142143                $model->add(new Statement($resourceAnswer, $predicateId, $answerId));
    143144
    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);
    146147                $model->add(new Statement($resourceAnswer, $predicateQId, $questionId));
    147148
Note: See TracChangeset for help on using the changeset viewer.