Heat the olive oil in a large saucepan. Add the garlic, celery and onion and cook over low heat, stirring, until softened, about 8 minutes. Add the beans and stock and bring to a boil. Reduce the heat to low, cover partially and simmer until the beans are almost tender, 45 minutes to 1 hour. Stir in the tomatoes, ketchup, brown sugar, vinegar, mustard, basil, rosemary, cumin and paprika. Simmer over moderately low heat until the beans are very tender and the sauce is thick, about 30 minutes longer. Season with salt and pepper.