  Among the hundreds of known hot Jupiters (HJs), only five have been found to
have companions on short-period orbits. Within this rare class of multiple
planetary systems, the architecture of WASP-47 is unique, hosting an HJ (planet
-b) with both an inner and an outer sub-Neptunian mass companion (-e and -d,
respectively) as well as an additional non-transiting, long-period giant (-c).
The small period ratio between planets -b and -d boosts the transit time
variation (TTV) signal, making it possible to reliably measure the masses of
these planets in synergy with the radial velocity (RV) technique. In this
paper, we present new space- and ground-based photometric data of WASP-47b and
WASP-47-d, including 11 unpublished light curves from the ESA mission CHEOPS.
We analyzed the light curves in a homogeneous way together with all the
publicly available data to carry out a global $N$-body dynamical modeling of
the TTV and RV signals. We retrieved, among other parameters, a mass and
density for planet -d of $M_\mathrm{d}=15.5\pm 0.8$ $M_\oplus$ and
$\rho_\mathrm{d}=1.69\pm 0.22$ g\,cm$^{-3}$, which is in good agreement with
the literature and consistent with a Neptune-like composition. For the inner
planet (-e), we found a mass and density of $M_\mathrm{e}=9.0\pm 0.5$
$M_\oplus$ and $\rho_\mathrm{e}=8.1\pm 0.5$ g\,cm$^{-3}$, suggesting an
Earth-like composition close to other ultra-hot planets at similar irradiation
levels. Though this result is in agreement with previous RV+TTV studies, it is
not in agreement with the most recent RV analysis (at 2.8$\sigma$), which
yielded a lower density compatible with a pure silicate composition. This
discrepancy highlights the still unresolved issue of suspected systematic
offsets between RV and TTV measurements. In this paper, we also significantly
improve the orbital ephemerides of all transiting planets, which will be
crucial for any future follow-up.
