Ah, that makes things a little more complicated! If you have not already made the cables safe then please shut off the power to the lighting circuit back at your consumer unit or fuse box.
I had a quick google and found
this page which explains about loop-in lighting circuits. I is reasonably detailed and has some useful diagrams so take a look through and make sure you are familiar with the process before continuing.
First things first I would get some suitably rated choc-block type connector strip and safely terminate the cables into individual blocks - you might want to separate each block of 3 connectors so each cable can hang freely from the ceiling. That makes sure everything is safe for now.
Do you have a multimeter with a continuity setting? If so AND WITH THE POWER STILL OFF, put the light switch on and test for continuity between the Brown/Blue or Red/Black cores on each cable. When you find the cable that shows continuity then that will be your switch cable and can be labelled accordingly. The other 2 cables will be the lighting ring so again label these for ease of identification.
You can then source a suitable junction box, terminals and some earth sleeving if you need it and the cables should be connected as follows:
- the Live, Neutral & Earth for the lighting ring cables need to be connected together: Live to Live, Neutral to Neutral, Earth to Earth.
- the Red or Brown core on the switch cable need to be connected to the Live terminal of the lighting ring. This is the live feed to the switch.
- the Black or Blue core needs a red sleeve and should be connected into a separate terminal, this is the live feed back from the switch.
- your new length of flex of cable for the light fitting needs to have the Live connection in the fitting connected to the live feed back from the switch (Black or Blue core sleeved red), Neutral in the fitting connected to the Neutrals for the lighting ring, Earth in the fitting connected to the Earths for the lighting ring. This assumes that the switch cable does not have an earth fitted currently.
Have a last check of the wiring to make sure the cabling is as it should be and all connections are secure. You can now put the power back on and test the new fitting turns on & off at the switch.