So metaphysics is the branch of philosophy concerned with the ultimate nature of existence.
Ontology is the study of what exists.
Cosmology and philosophical theology are its main branches. Some cosmologists believe that the existence and order of the cosmos can be accounted for scientifically. Others think that mass-bearing material things exist because we are located in a particular part of the world where they appear to exist. Scientists gain information about what exists by interacting with and observing different features of the world, and searching for the best explanations of the information they gain that way. This method of studying what exists is empirical and largely pragmatic.