Ignore:
Timestamp:
11/18/11 11:07:07 (13 years ago)
Author:
jkraaijeveld
Message:

Refactored queries / cleaned up some code.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/classes/ApplicationConnector.php

    r149 r158  
    4949    /**
    5050     * function get($arguments)
    51      * Gets the array of Application objects belonging to arguments supplied.
    5251     * @param type $arguments : An array containing zero or more of the following keys:
    53      *                          'uid', 'title', 'description', 'style'
     52     * 'uid', 'title', 'description', 'style'
    5453     */
    5554    public function get($arguments) {
     
    5857        $keys = array_keys($arguments);
    5958        //Set default values for arguments
    60         $uid = "?uid"; $title = "?title"; $description = "?description"; $style = "?style";
     59        $uid = ""; $title = ""; $description = ""; $style = "";
    6160        //Set the arguments if they are supplied
    6261        if(in_array("uid", $keys))
    63             $uid = "\"".$arguments["uid"]."\"";
     62            $uid = "predicates:uid \"".$arguments["uid"]."\"";
    6463        if(in_array("title", $keys))
    65             $title = '\''.$arguments["title"].'\'';
     64            $title = 'predicates:title \''.$arguments["title"].'\'';
    6665        if(in_array("description", $keys))
    67             $description = "\"".$arguments["description"]."\"";
     66            $description = "predicates:description \"".$arguments["description"]."\"";
    6867        if(in_array("style", $keys))
    69             $style = "\"".$arguments["style"]."\"";   
     68            $style = "predicates:style \"".$arguments["style"]."\"";   
    7069
    7170        //Create the querystring
     
    8079                                        predicates:title ?title ;
    8180                                        predicates:description ?description ;
    82                                         predicates:style ?style ;
    83                                         predicates:uid ' . $uid . '
    84                                         predicates:title ' . $title . '
    85                                         predicates:description ' . $description . '
    86                                         predicates:style ' . $style . '
     81                                        predicates:style ?style ; '
     82                    . $uid . $title . $description . $style . '
    8783            }';
    8884
     
    135131        $this->model->add(new Statement($resourceApplication,$predicateStyle,$applicationStyle));
    136132               
    137         $this->save();
     133                $this->save();
    138134    }
    139135}
Note: See TracChangeset for help on using the changeset viewer.