Ignore:
Timestamp:
10/24/11 13:47:23 (14 years ago)
Author:
jkraaijeveld
Message:

Added support for questions and users

File:
1 edited

Legend:

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

    r128 r130  
    6161        //Set the arguments if they are supplied
    6262        if(in_array("uid", $keys))
    63             $uid = "\"".$arguments["id"]."\"";
     63            $uid = "\"".$arguments["uid"]."\"";
    6464        if(in_array("title", $keys))
    6565            $title = '\''.$arguments["title"].'\'';
     
    8181                                        predicates:description ?description ;
    8282                                        predicates:style ?style ;
    83                                         predicates:uid ' . $uid . '
     83                                        predicates:uid ' . $uid . '
    8484                                        predicates:title ' . $title . '
    8585                                        predicates:description ' . $description . '
    86                                         predicates:style ' . $style . ' 
     86                                        predicates:style ' . $style . '
    8787            }';
    8888
    8989        //Query the model
    9090        $results = $this->model->sparqlQuery($querystring);
    91                 if(!empty($results))
    92                         {
    93                         $applications = array();
    94                         //Run over all results and create appropriate Application objets
    95                         foreach($results as $result)
    96                         {
    97                                 $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
    98                         }
    99                         //Return the list of application objects
    100                         return $applications;
    101                 }
    102                 else
    103                 {
    104                         return array();
    105                 }
     91        $applications = array();
     92        if(!empty($results))
     93        {
     94            //Run over all results and create appropriate Application objets
     95            foreach($results as $result)
     96            {
     97                    $applications[] = new Application($result['?uid']->label, $result['?title']->label, $result['?description']->label, $result['?style']->label);
     98            }
     99        }
     100        return $applications;
    106101    }
    107102   
     
    114109    public function set($rToolObject)
    115110    {
     111        $this->load();
    116112        $resourceApplication = new Resource(APPLICATION.'/'.$rToolObject->uid);
    117                 //Remove the old value stored with the given id
    118                 $this->model->subtract($this->model->find($resourceApplication, null, null));
    119                
    120                 //Add the new statements to the model
     113        //Remove the old value stored with the given id
     114        $this->model->subtract($this->model->find($resourceApplication, null, null));
     115
     116        //Add the new statements to the model
    121117        $resourceApplicationType = new Resource(APPLICATION);
    122118        $predicateRType = new Resource(RTYPE);
     
    139135        $this->model->add(new Statement($resourceApplication,$predicateStyle,$applicationStyle));
    140136               
    141                 $this->save();
     137        $this->save();
    142138    }
    143139}
Note: See TracChangeset for help on using the changeset viewer.