FR 2761 then FR 997 at Madrid
Bari → Madrid → Wroclaw
Timetable, Madrid time
15:30FR 2761 from Bari at the gate
14:15FR 997 to Wroclaw leaves the gate
22 h 45 apart on the timetable, overnight
FR 997 leaves 22 h 45 after FR 2761 arrives on the timetable: more than half a day, so not a connection we count.