Heat 1 tablespoon olive oil in a large saucepan, add the onion and celery and cook for 5 minutes until softened. Add the garlic and tomato purée and cook for 1 minute more. Tip in the tomatoes, top up with a little water and leave to simmer for 5 minutes.
Meanwhile, heat half the remaining oil in a frying pan, add half the aubergine and cook for 5 minutes, turning occasionally, until browned. Remove from the pan with a slotted spoon and leave to drain on kitchen paper. Repeat with the remaining oil and aubergine.
Stir the vinegar and sugar into the tomato sauce, and add the cooked aubergine, capers and olives. Season to taste and leave to simmer for 7–10 minutes. Spoon into serving bowls, dollop over the ricotta and pine nuts and sprinkle with basil before serving.