public function resolve()
    {
        if (isset($this->resolved)) {
            return $this->resolved;
        }

        $pointer = new Pointer($this->schema);
        if (is_internal_ref($this->ref) && $pointer->has($this->ref)) {
            return $this->resolved = $pointer->get($this->ref);
        }

        return $this->dereferencer()->dereference(resolve_uri($this->ref, $this->scope));
    }