/**
  * Since it's difficult to determine if a GET request was a FETCH or
  * QUERY, this does the right thing (hopefully)
  *
  * @param  string $path
  * @param  array  $args
  * @return array  $response
  */
 public function query_or_fetch($path, $args = array())
 {
     $rsc = $this->parser->resource($path);
     // if not found, it shouldn't matter which we call
     if (!$rsc) {
         $rsc = new Rframe_StaticResource($this->parser);
         $rsc->code = Rframe::BAD_PATH;
         $rsc->message = "Invalid path: '{$path}'";
         return $rsc->query($args);
     }
     // more info about resource
     $uuid = $this->parser->uuid($path);
     $cls = get_class($rsc);
     $is_one = $rsc->get_rel_type($cls) == Rframe_Resource::ONE_TO_ONE;
     // determine if this is likely a query or fetch path
     if (!$is_one && $uuid || $is_one && !$uuid) {
         return $rsc->fetch($uuid, $args);
     } else {
         return $rsc->query($args);
     }
 }
 /**
  * Public function to query a resource
  *
  * @param string  $path
  * @param array   $args (optional)
  * @return array $response
  */
 public function query($path, $args = array())
 {
     $rsc = $this->parser->resource($path);
     $found = $rsc;
     if (!$found) {
         $rsc = new Rframe_StaticResource($this->parser);
         $rsc->code = Rframe::BAD_PATH;
         $rsc->message = "Invalid path: '{$path}'";
     }
     $uuid = $this->parser->uuid($path);
     if ($found && $uuid) {
         $rsc = new Rframe_StaticResource($this->parser);
         $rsc->code = Rframe::BAD_PATHMETHOD;
         $rsc->message = "Invalid path for query: '{$path}'";
     }
     return $rsc->query($args);
 }