Ignore:
Timestamp:
01/13/12 13:57:41 (13 years ago)
Author:
fpvanagthoven
Message:
 
Location:
Dev/branches/jos-branch/classes/models
Files:
2 edited

Legend:

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

    r217 r233  
    1212        private static $filename = 'data/questions/questions.rdf';
    1313
     14    public $code;
    1415    public $title;
    1516    public $type;
     
    2728     * @param type $answers
    2829     */
    29     public function __construct($uid, $title = null, $type = null, $description = null, $category = null, $answers = null)
     30    public function __construct($uid, $code = null, $title = null, $type = null, $description = null, $category = null, $answers = null)
    3031    {
    3132                if(!isset($uid))
     
    3334                        $uid = md5(uniqid(rand(), true));
    3435                }
     36        $this->code = $code;
    3537        $this->uid = $uid;
    3638        $this->title = $title;
     
    6163        $predicateRType = new Resource(RTYPE);
    6264        $model->add(new Statement($resourceQuestion,$predicateRType,$resourceQuestionType));
     65       
     66        $questionUid = new Literal($this->uid);
     67        $predicateUid = new Resource(UID);
     68        $model->add(new Statement($resourceQuestion,$predicateUid,$questionUid));
    6369       
    6470        $questionQCode = new Literal($this->uid);
     
    98104     * Get the questions corresponding to the arguments.
    99105         * @param type $arguments : An array having one ore more of the following elements:
    100          * 'code', 'title', 'type', 'description', 'category', 'definedanswers'.
     106         * 'uid', 'code', 'title', 'type', 'description', 'category', 'definedanswers'.
    101107     */
    102108    public static function get($arguments)
     
    107113            PREFIX  predicates: <' . SURVEYTOOL_PREDICATES_NAMESPACE . '>
    108114            PREFIX  resources: <' . SURVEYTOOL_RESOURCES_NAMESPACE . '>
    109             SELECT DISTINCT ?uid, ?title, ?type, ?description, ?category
     115            SELECT DISTINCT ?uid, ?code, ?title, ?type, ?description, ?category
    110116            WHERE       
    111117            {
    112118                _question       predicates:resource_type        resources:question ;               
    113                 predicates:question_code ?uid ;
     119                predicates:uid ?uid ;
     120                predicates:question_code ?code ;
    114121                predicates:title ?title ;
    115122                predicates:question_type ?type ;
     
    130137            {
    131138                                $answers = Question::getAnswers($model, $result['?uid']->label);
    132                 $questions[] = new Question($result['?uid']->label, $result['?title']->label, $result['?type']->label, $result['?description']->label, $result['?category']->label, $answers);
     139                $questions[] = new Question($result['?uid']->label, $result['?code']->label, $result['?title']->label, $result['?type']->label, $result['?description']->label, $result['?category']->label, $answers);
    133140            }
    134141        }
  • Dev/branches/jos-branch/classes/models/ResearchToolObject.php

    r212 r233  
    55 * @author jkraaijeveld
    66 */
     7// Survey database interface class as intermediate for storing data from the site to the RDF database
     8require_once 'rdfConstants.php';
     9// Include RAP Library to write RDF files
     10include(RDFAPI_INCLUDE_DIR . "RDFAPI.php");
     11
     12
    713abstract class ResearchToolObject {
    814
Note: See TracChangeset for help on using the changeset viewer.