Fix WITH select criteria on upserts
upsert query corrected to insert only when the
{parent,relationship,child} does not already exist.