only define fromQueryResult if it doesn't already exist