How would a test confirm sexual intercourse by analysing vaginal swab?

The vagina is analysed for the presence of fructose. It is not produced anywhere in the human body except semen (contributed by seminal vesicles). Therefore, its presence in the vagina indicates coitus/sexual intercourse.