Preheat the oven to 180C/160C Fan/Gas 4. Spread the pine nuts on a baking sheet. Bake for 3–4 minutes.
Put the basil, garlic, salt and most of the toasted pine nuts, in a food processor or mortar and grind until a paste. Reserve some of the pine nuts for garnishing.
Tip into a medium-sized bowl and, using a wooden spoon, mix in the Parmesan and pecornio. Pour in the oil very gradually, beating continuously with the spoon. Mix in the ricotta and remaining pine nuts using a fork.