code: private function getTypeReferenceIri($type)
      {
          if (null === $type) {
              return null;
          }
  
          if (array_key_exists($type, self::$typeMap)) {
              return self::$typeMap[$type];
          }
  
          if ($this->hasNormalizer($type)) {
              return $this->getNormalizer($type)->getTypeIri();
          }
  
          $metadata = $this->metadata->getMetadataFor($type);
  
          if (null === $metadata) {
              // TODO Improve this
              throw new \Exception('Found invalid type: ' . $type);
          }
  
          if ($metadata->isExternalReference()) {
              return $metadata->getIri();
          } else {
              return 'vocab:' . $metadata->getIri();
          }
      }
docs: Get the (compact) IRI to reference the specified type
  
  @param string|null $type The type to reference.
  
  @return string|null The IRI corresponding to the type.