Working on new grounding.
Ground factor graph using pure sql