Check if $ctx is a resource.