21 auto constants = _constants;
22 auto indexPartConstant = constants.IndexPart;
23 auto sourcePartConstant = constants.SourcePart;
24 auto targetPartConstant = constants.TargetPart;
25 auto nullConstant = constants.Null;
26 auto itselfConstant = constants.Itself;
27 auto existedLink = nullConstant;
28 auto updatedLink = restriction[indexPartConstant];
29 auto newSource = substitution[sourcePartConstant];
30 auto newTarget = substitution[targetPartConstant];
31 if (newSource != itselfConstant && newTarget != itselfConstant)
33 existedLink = storage.SearchOrDefault(newSource, newTarget);
35 if (existedLink == nullConstant)
37 auto before = storage.GetLink(updatedLink);
38 if (before[sourcePartConstant] != newSource || before[targetPartConstant] != newTarget)
40 storage.Update(updatedLink, newSource == itselfConstant ? updatedLink : newSource,
41 newTarget == itselfConstant ? updatedLink : newTarget);
47 return this->facade().TFacade::MergeAndDelete(updatedLink, existedLink);