  We derive expressions for the zeroth and the first three spectral moment sum
rules for the retarded Green's function and for the zeroth and the first
spectral moment sum rules for the retarded self-energy of the inhomogeneous
Bose-Hubbard model in nonequilibrium, when the local on-site repulsion and the
chemical potential are time-dependent, and in the presence of an external
time-dependent electromagnetic field. We also evaluate these moments for
equilibrium, where all time dependence and external fields vanish. Unlike
similar sum rules for the Fermi-Hubbard model, in the Bose-Hubbard model case,
the sum rules often depend on expectation values that cannot be determined
simply from parameters in the Hamiltonian like the interaction strength and
chemical potential, but require knowledge of equal time many-body expectation
values from some other source. We show how one can approximately evaluate these
expectation values for the Mott-insulating phase in a systematic
strong-coupling expansion in powers of the hopping divided by the interaction.
We compare the exact moments to moments of spectral functions calculated from a
variety of different approximations and use them to benchmark their accuracy.
