I have this use case where: 
I have a list of destination polygons and a source polygon (destination and source are just used to denote polygons).
What I want to do is find area of intersection of the source polygon with each of the destination polygons
Then select the one with the maximum area of intersection.
Polygon here is list of Points, of course.
For instance, in the image shown below: 

I have destination polygons D1 to D4

Source polygon → S
 Return D4 since it has max area of intersection with S
I could not find an example to calculate area of intersection, let alone iterating and finding the maximum. Could you please help me with this in DQL
We are exploring this to evaluate the possibility of spatially linking two nodes based on the geometry which has maximum intersection.
Also a reference of it could be done in POSTGIS
sql  Calculate the percentage of polygon inside the buffer in postgresql  Stack Overflow