public function RdfMappingManager::getTypedDataIdsFromTypeUris

Convert an array of RDF type URIs to the corresponding TypedData IDs.

Parameters

array $input_rdf_types: An array of URIs for the type.

Return value

array An array containing entity_type and bundle.

Throws

\Drupal\rdf\RdfMappingException

File

drupal/core/modules/rdf/lib/Drupal/rdf/RdfMappingManager.php, line 62
Contains RdfMappingManager.

Class

RdfMappingManager
Manager for mapping internal and external schema terms.

Namespace

Drupal\rdf

Code

public function getTypedDataIdsFromTypeUris($input_rdf_types) {

  // Get the cache of site schema types.
  $site_schema_types = $this->siteSchemaManager
    ->getTypes();

  // Map the RDF type from the incoming data to an RDF type defined in the
  // internal site schema.
  $type_uri = $this
    ->mapTypesFromInput($input_rdf_types);

  // If no site schema URI has been determined, then it's impossible to know
  // what entity type to create. Throw an exception.
  if ($type_uri == FALSE) {
    throw new RdfMappingException(sprintf('No mapping to a site schema type URI found for incoming types (%s).', implode(',', $input_rdf_types)));
  }

  // Use the mapped RDF type URI to get the TypedData API ids the rest of the
  // system uses (entity type and bundle).
  return $site_schema_types[$type_uri];
}