refactor to use cachedSqlEntity for subentities; use regex transformer
for metadata; simplify script transformer function