/**
  * Normalizes a relation as an URI if is a Link or as a JSON-LD object.
  *
  * @param AttributeMetadataInterface $attribute
  * @param mixed                      $relatedObject
  * @param ResourceInterface          $resource
  * @param array                      $context
  *
  * @return string|array
  */
 private function normalizeRelation(AttributeMetadataInterface $attribute, $relatedObject, ResourceInterface $resource, array $context)
 {
     if ($attribute->isNormalizationLink()) {
         return $this->iriConverter->getIriFromItem($relatedObject);
     } else {
         return $this->serializer->normalize($relatedObject, self::FORMAT, $this->createRelationContext($resource, $context));
     }
 }
 /**
  * Normalizes a relation as an URI if is a Link or as a JSON-LD object.
  *
  * @param ResourceInterface          $currentResource
  * @param AttributeMetadataInterface $attribute
  * @param mixed                      $relatedObject
  * @param string                     $class
  *
  * @return string|array
  */
 private function normalizeRelation(ResourceInterface $currentResource, AttributeMetadataInterface $attribute, $relatedObject, $class)
 {
     if ($attribute->isNormalizationLink()) {
         return $this->iriConverter->getIriFromItem($relatedObject);
     } else {
         $context = $this->contextBuilder->bootstrapRelation($currentResource, $class);
         return $this->serializer->normalize($relatedObject, 'json-ld', $context);
     }
 }