The function restoreRelationships is throwing an InvalidSPDXAnalysisException if an element for the given elementId cannot be found within the addedElements, i.e. the elements of the current SPDX file.
Due to the definition of the SPDX we have a lot relationship types where the order is reversed like CONTAINED_BY, GENERATED_FROM, etc. In this cases I would expect that addedFiles contains the relatedSpdxElement.