Source:
<code>private ConnectionContainer upsertObjects(Environment context) { if (context.ids.isPresent()) { throw new BadRequestException("UPSERT must not include ids"); } if (!context.data.isPresent()) { throw new BadRequestException("UPSERT must include data argument"); } Class<?> entityClass; EntityDictionary dictionary = context.requestScope.getDictionary(); if (context.isRoot()) { entityClass = dictionary.getEntityClass(context.field.getName()); } else { entityClass = dictionary.getParameterizedType(context.parentResource.getResourceClass(), context.field.getName()); } Optional<Entity> parentEntity; if (!context.isRoot()) { parentEntity = Optional.of(new Entity(Optional.empty(), null, context.parentResource.getResourceClass(), context.requestScope)); } else { parentEntity = Optional.empty(); } LinkedHashSet<Entity> entitySet = new LinkedHashSet<>(); for (Map<String, Object> input : context.data.get()) { entitySet.add(new Entity(parentEntity, input, entityClass, context.requestScope)); } for (Entity entity : entitySet) { <START> graphWalker(entity, (e) -> upsertObject(context, e)); <END> } for (Entity entity : entitySet) { graphWalker(entity, this::updateRelationship); if (!context.isRoot()) { context.parentResource.addRelation(context.field.getName(), entity.toPersistentResource()); } } String entityName = dictionary.getJsonAliasFor(entityClass); Set<PersistentResource> resources = entitySet.stream() .map(Entity::toPersistentResource) .collect(Collectors.toCollection(LinkedHashSet::new)); return new ConnectionContainer(resources, Optional.empty(), entityName); }</code><technical_language>words instead of letters for variable names</technical_language>

Target:
private ConnectionContainer upsertObjects(Environment context) { if (context.ids.isPresent()) { throw new BadRequestException("UPSERT must not include ids"); } if (!context.data.isPresent()) { throw new BadRequestException("UPSERT must include data argument"); } Class<?> entityClass; EntityDictionary dictionary = context.requestScope.getDictionary(); if (context.isRoot()) { entityClass = dictionary.getEntityClass(context.field.getName()); } else { entityClass = dictionary.getParameterizedType(context.parentResource.getResourceClass(), context.field.getName()); } Optional<Entity> parentEntity; if (!context.isRoot()) { parentEntity = Optional.of(new Entity(Optional.empty(), null, context.parentResource.getResourceClass(), context.requestScope)); } else { parentEntity = Optional.empty(); } LinkedHashSet<Entity> entitySet = new LinkedHashSet<>(); for (Map<String, Object> input : context.data.get()) { entitySet.add(new Entity(parentEntity, input, entityClass, context.requestScope)); } for (Entity entity : entitySet) { graphWalker(entity, (entityObject) -> upsertObject(context, entityObject)); } for (Entity entity : entitySet) { graphWalker(entity, this::updateRelationship); if (!context.isRoot()) { context.parentResource.addRelation(context.field.getName(), entity.toPersistentResource()); } } String entityName = dictionary.getJsonAliasFor(entityClass); Set<PersistentResource> resources = entitySet.stream() .map(Entity::toPersistentResource) .collect(Collectors.toCollection(LinkedHashSet::new)); return new ConnectionContainer(resources, Optional.empty(), entityName); }