  The James Webb Space Telescope (JWST) will enable the detection of optical
emission lines in galaxies spanning a broad range of luminosities out to
redshifts z>10. Measurements of key galaxy properties, such as star formation
rate and metallicity, through these observations will provide unique insight
into, e.g., the role of feedback from stars and active galactic nuclei (AGNs)
in regulating galaxy evolution, the co-evolution of AGNs and host galaxies, the
physical origin of the 'main sequence' of star-forming galaxies and the
contribution by star-forming galaxies to cosmic reionization. We present an
original framework to simulate and analyse observations performed with the Near
Infrared Spectrograph (NIRSpec) on board JWST. We use the BEAGLE tool (BayEsian
Analysis of GaLaxy sEds) to build a semi-empirical catalogue of galaxy spectra
based on photometric spectral energy distributions (SEDs) of dropout galaxies
in the Hubble Ultra Deep Field (HUDF). We demonstrate that the resulting
catalogue of galaxy spectra satisfies different types of observational
constraints on high redshift galaxies, and use it as input to simulate
NIRSpec/prism (R~100) observations. We show that a single 'deep' (~100 ks)
NIRSpec/prism pointing in the HUDF will enable S/N>3 detections of multiple
optical emission lines in ~30 (~60) galaxies at z>6 (z~4-6) down to m_F160W<30
AB mag. Such observations will allow measurements of galaxy star formation
rates, ionization parameters and gas-phase metallicities within factors of 1.5,
mass-to-light ratios within a factor of 2, galaxy ages within a factor of 3 and
V-band attenuation optical depths with a precision of 0.3.
