Resource::getParent

Returns the parent Resource of a child resource.

resource.getParent()

If the resource does not have a parent because it is already a top-level resource, the result will be null.