Gram Matrix Characterisation of Sums of Squares