final private static function getObjectQuery($properties, $vtable = '?property_values', $objectId = NULL, $objectType = NULL, $objectURI = NULL)
    {
        //Join Query
        $query = "SELECT o.object_id, o.object_uri, o.object_type, o.object_created_on, o.object_updated_on, o.object_status";

        if (!empty($properties)):
            //Loop through the attributes you need
            $i = 0;
            $count = \sizeof($properties);
            //echo $count;
            $query .= ",";
            foreach ($properties as $alias => $attribute):
                $alias = (is_int($alias)) ? $attribute : $alias;
                $query .= "\nMAX(IF(p.property_name = '{$attribute}', v.value_data, null)) AS {$alias}";
                if ($i + 1 < $count):
                    $query .= ",";
                    $i++;
                endif;
            endforeach;

            //The data Joins
            $query .= "\nFROM {$vtable} v"
                . "\nLEFT JOIN ?properties p ON p.property_id = v.property_id"
                . "\nLEFT JOIN ?objects o ON o.object_id=v.object_id";
        else:
            $query .= "\nFROM ?objects o";
        endif;

        static::$withConditions = false;
        if (!empty($objectId) || !empty($objectURI) || !empty($objectType)):
            $query .= "\nWHERE";
            if (!empty($objectType)):
                $query .= "\to.object_type='{$objectType}'";
                static::$withConditions = TRUE;
            endif;
            if (!empty($objectURI)):
                $query .= (static::$withConditions) ? "\t AND" : "";
                $query .= "\to.object_uri='{$objectURI}'";
                static::$withConditions = TRUE;
            endif;
            if (!empty($objectId)):
                $query .= (static::$withConditions) ? "\t AND \t" : "";
                $query .= "\to.object_id='{$objectId}'";
                static::$withConditions = TRUE;
            endif;
        endif;

        return $query;
    }