To make the sauce, drizzle abundant olive oil in a pan and fry lightly the chopped onion, carrot and celery. Add the wine and let it evaporate, then add the tomatoes.
Season with salt, black pepper and rosemary and add the bay leaf. Turn the heat to low and let it simmer for at least 30 minutes stirring it once in while and breaking the tomatoes with a wooden spoon. If necessary, add a little bit of vegetable stock or water.
Make the Gnocchi
Meanwhile prepare the gnocchi mixing together the drained Ricotta cheese, the beaten egg and the Parmigiano cheese. Add the sifted flour a little bit at a time while mixing with a fork and season with nutmeg, salt and black pepper.
When it becomes thicker, mix with your hands and add more flour until the mixture gets a dough consistency and it's not sticky anymore. (It could be more or less flour than indicated in the ingredient list. It depends on the amount of liquid in the Ricotta and on the dimension of the egg).
Divide the dough in equal parts and with your hands roll it on a wooden cutting board dusted with flour until you get a thick roll (about 2cm thick). With a sharp knife chop the roll into cubes and roll them in your palms to get small balls or ovals (you can choose the dimension of your gnocchi although they should not be much bigger than 2.5cm/1 inch).
Dust the gnocchi with flour if they stick again and set them aside to rest on a clean cloth.
Bring to boil a large pan of salted water and add in the gnocchi one by one so they don't stick together. As soon as they float on the surface they're ready; pick them up with a skimmer and add them to the sauce.
Add the basil leaves to the sauce and cook for another 2-3 minutes, then serve.