diff --git a/core/modules/rdf/rdf.module b/core/modules/rdf/rdf.module
index c48e683..f84af03 100644
--- a/core/modules/rdf/rdf.module
+++ b/core/modules/rdf/rdf.module
@@ -106,17 +106,28 @@ function rdf_rdf_namespaces() {
  * Invokes hook_rdf_namespaces() and collects RDF namespaces from modules that
  * implement it.
  */
+
 function rdf_get_namespaces() {
-  $namespaces = array();
+  $merged_namespaces = array();
   // In order to resolve duplicate namespaces by using the earliest defined
   // namespace, do not use \Drupal::moduleHandler()->invokeAll().
   foreach (\Drupal::moduleHandler()->getImplementations('rdf_namespaces') as $module) {
     $function = $module . '_rdf_namespaces';
     if (function_exists($function)) {
-      $namespaces = NestedArray::mergeDeep($function(), $namespaces);
+      foreach($function() as $prefix => $namespace){
+        // Throw exception if there are namespace conflicts.
+        if (array_key_exists($prefix, $merged_namespaces) && ($merged_namespaces[$prefix] !== $namespace) ){
+          throw new Exception("RDF prefix mapping '$prefix => $namespace'" .
+            " in module '$module' conflicts with existing mapping" .
+            " '$prefix => $merged_namespaces[$prefix]'");
+        }
+        else{
+          $merged_namespaces[$prefix] = $namespace;
+        }
+      }
     }
   }
-  return $namespaces;
+  return $merged_namespaces;
 }
 
 /**
