From d2a4fe2170bb702317de691f3e63fc0bebd48342 Mon Sep 17 00:00:00 2001
From: Claudiu Cristea <clau.cristea@gmail.com>
Date: Sat, 17 Aug 2024 18:45:54 +0300
Subject: [PATCH] ISAICP-9013: Remove applied updates.

---
 tests/features/update/ISAICP-8569.feature     |  73 ----
 tests/features/update/ISAICP-8964.feature     |  57 ---
 tests/src/Context/JoinupContext.php           |  51 +--
 .../custom/joinup_core/joinup_core.deploy.php |  71 ----
 .../custom/joinup_core/joinup_core.install    |  10 -
 .../custom/joinup_rdf/joinup_rdf.deploy.php   | 336 ------------------
 .../custom/joinup_rdf/joinup_rdf.install      |  20 --
 7 files changed, 1 insertion(+), 617 deletions(-)
 delete mode 100644 tests/features/update/ISAICP-8569.feature
 delete mode 100644 tests/features/update/ISAICP-8964.feature

diff --git a/tests/features/update/ISAICP-8569.feature b/tests/features/update/ISAICP-8569.feature
deleted file mode 100644
index 8041b1af52..0000000000
--- a/tests/features/update/ISAICP-8569.feature
+++ /dev/null
@@ -1,73 +0,0 @@
-@api @group-clone
-Feature: Test the releases update.
-
-  @update:joinup_rdf_deploy_111101
-  Scenario: Releases with their fields have migrated correctly.
-    And I visit "/collection/common-assessment-method-standards-and-specifications-camss/solution/camss-assessment-prov-family-eif-scenario/release/100"
-    Then I should see the text "CAMSS Assessment of PROV Family of documents 1.0.0"
-    # Published at field.
-    And I should see the text "Published on: 19/07/2023"
-    # Modification field is not the date of the migration.
-    And I should see the text "Last update: 07/08/2023"
-    # Release notes field.
-    And I should see the text "About the Common Assessment Method for Standards and Specifications"
-
-    # Assert that the distributions appear as tiles.
-    And I should see the "CAMSS Assessment Summary of  PROV 1.0.0 EIF Scenario v1.0.0" tile
-
-    # Draft releases are migrated too.
-    Given I visit "/collection/common-assessment-method-standards-and-specifications-camss/solution/camss-assessment-dns-eif-scenario/release/300"
-    Then I should see the heading "Sign in to continue"
-    When I am logged in as a moderator
-    And I visit "/collection/common-assessment-method-standards-and-specifications-camss/solution/camss-assessment-dns-eif-scenario/release/300"
-    Then I should see the text "CAMSS Assessment of DNS - EIF Scenario 3.0.0"
-    And I should see the link "Switch to the latest release"
-
-  @update:joinup_rdf_deploy_111102
-  Scenario: Forward revisions of releases are created correctly.
-    When I am logged in as a moderator
-    And I visit "/collection/common-assessment-method-standards-and-specifications-camss/solution/camss-assessment-prov-family-eif-scenario/release/100"
-    And I click "Revisions" in the "Entity actions" region
-    Then I should see the text "Current revision"
-    And I should see the link "Set as current revision"
-
-  @update:joinup_rdf_update_111101
-  @update:joinup_rdf_update_111102
-  @update:joinup_rdf_deploy_111100
-  @update:joinup_rdf_deploy_111101
-  @update:joinup_rdf_deploy_111102
-  @update:joinup_rdf_deploy_111103
-  @update:joinup_rdf_deploy_111104
-  Scenario: Test RDF sync
-    Then the following "http://data" graph triples should exist in the RDF backend:
-      | subject                                                        | predicate                                       | object                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
-      # Release own data.
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/1999/02/22-rdf-syntax-ns#type | http://www.w3.org/ns/dcat#Dataset                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/title                  | MyGNUHealth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/issued                 | 2024-07-17T09:52:44Z                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/modified               | 2024-07-17T10:14:12Z                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/adms#versionNotes          | <p>Dear community</p><p>I am happy to announce patchset 2.2.1 for MYGNUHealth, the GNU Health Personal Health Record.</p><p>This patchset fixes the following issues:</p><p>* MyGH crashes when clicking 'Network': &nbsp;https://codeberg.org/gnuhealth/mygnuhealth/issues/34<br>* Include icons of type gif on MANIFEST.in : https://codeberg.org/gnuhealth/mygnuhealth/issues/36</p><p>You can download MyGNUHealth source code from the official GNU Savannah (https://ftp.gnu.org/gnu/health/mygnuhealth/). You can also install MyGH from the Python Package Index (PyPI) or from your operating system distribution.</p><p>Happy hacking<br>Luis</p> |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/dcat#keyword               | Personal Health Record                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/dcat#keyword               | GNU Health                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/dcat#keyword               | MyGNUHealth                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/language               | http://publications.europa.eu/resource/authority/language/ENG                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/language               | http://publications.europa.eu/resource/authority/language/SPA                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/language               | http://publications.europa.eu/resource/authority/language/ZHO                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/adms#status                | http://purl.org/adms/status/Completed                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/2002/07/owl#versionInfo       | 2.2.1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/spatial                | http://publications.europa.eu/resource/authority/country/EUR                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/isVersionOf            | http://data.europa.eu/w21/9e55e065-371c-44ca-af46-ee4db2ab1931                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
-      # Data synchronized from solution.
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/publisher              | http://data.europa.eu/w21/2dcd2930-e5cd-4a27-a482-a2358fc1c617                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://www.w3.org/ns/dcat#contactPoint          | http://data.europa.eu/w21/1eba30d7-ab43-462f-bb91-413a8e52d888                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/description            | <p>MyGNUHealth uses the latest mobile and desktop technology, such as Kivy framework. MyGNUHealth Personal Health Record is a privacy-oriented PHR, that will put the citizen and the patient in control of her health and medical information. MyGNUHealth enhances and improves the interaction between citizens and healthcare professionals, with updated information on demographics and medical information.</p>                                                                                                                                                                                                                                      |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/type                   | http://data.europa.eu/dr8/DataManagementApplicationComponent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/type                   | http://data.europa.eu/dr8/DesktopAppBusinessInterface                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/type                   | http://data.europa.eu/dr8/MobileAppBusinessInterface                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
-      | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 | http://purl.org/dc/terms/type                   | http://data.europa.eu/dr8/PrivacyApplicationComponent                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
-
-    # Test that the reverse reference hasVersion is also added in the correct
-    # graph.
-    Then the following "http://joinup.eu/solution/published" graph triples should exist in the RDF backend:
-      | subject                                                        | predicate                            | object                                                         |
-      | http://data.europa.eu/w21/9e55e065-371c-44ca-af46-ee4db2ab1931 | http://purl.org/dc/terms/hasVersion | http://data.europa.eu/w21/91ac24d8-c935-4a7f-971e-ca49795f3256 |
diff --git a/tests/features/update/ISAICP-8964.feature b/tests/features/update/ISAICP-8964.feature
deleted file mode 100644
index 279c0b5b6e..0000000000
--- a/tests/features/update/ISAICP-8964.feature
+++ /dev/null
@@ -1,57 +0,0 @@
-@api @group-clone
-Feature: Tests topic meta entity bugfix
-
-  @update:joinup_core_deploy_111101
-  Scenario: Topic meta entity admin page can be accessed by moderators
-    Given I am logged in as a moderator
-    And I visit "/admin/homepage-topics"
-    Then the response status code should be 200
-    And I should see the heading "Topics"
-    And I should see the following links:
-      | Advanced data analytics          |
-      | AI Chatbot                       |
-      | AI Facial recognition            |
-      | AI Image generation              |
-      | AI Machine translation           |
-      | AI Named entity recognition      |
-      | AI Speech recognition            |
-      | AI Video analytics               |
-      | Air and space transport          |
-      | Artificial intelligence          |
-      | Banking and financial services   |
-      | Blockchain                       |
-      | Business and competition         |
-      | Collaboration                    |
-      | Content and knowledge management |
-      | Culture and education            |
-      | Demography and population        |
-      | Digital government               |
-      | Digital innovation               |
-      | Digital-ready policymaking       |
-      | Economics                        |
-      | eDelivery and eInvoicing         |
-      | Education                        |
-      | eGovernment                      |
-      | eHealth                          |
-      | eIdentity and eSignature         |
-      | eInclusion                       |
-      | Employment                       |
-      | Energy and environment           |
-      | eParticipation and eVoting       |
-      | eProcurement                     |
-      | European Policies                |
-      | Extended reality                 |
-      | Food                             |
-      | Geospatial                       |
-      | Health                           |
-      | High performance computing       |
-      | Human resources                  |
-      | ICT                              |
-      | ICT security                     |
-      | Indoor position systems          |
-      | Industry and production          |
-      | Innovation                       |
-      | Integrated logistics             |
-      | Internet of Things               |
-      | Land transport                   |
-      | Languages and translation        |
diff --git a/tests/src/Context/JoinupContext.php b/tests/src/Context/JoinupContext.php
index 6fdf59d578..8a009e654b 100644
--- a/tests/src/Context/JoinupContext.php
+++ b/tests/src/Context/JoinupContext.php
@@ -68,55 +68,6 @@ class JoinupContext extends RawDrupalContext {
   use UtilityTrait;
   use WorkflowTrait;
 
-  /**
-   * Asserts that a list of triples exists in a certain graph.
-   *
-   * Each row is a triple serialized as NTriples:
-   * | subject         | predicate         | object            |
-   * | http://subject1 | http://predicate1 | http://reference1 |
-   * | http://subject1 | http://predicate2 | value1            |
-   * | http://subject2 | http://predicate3 | value2            |
-   *
-   * @param string $graph
-   *   The graph to be queried.
-   * @param \Behat\Gherkin\Node\TableNode $triples
-   *   The user data.
-   *
-   * @todo Remove after ISAICP-8569 is deployed.
-   *
-   * @Then the following :graph graph triples should exist in the RDF backend:
-   */
-  public function assertTriples(string $graph, TableNode $triples): void {
-    /** @var \Drupal\rdf_sync\RdfSyncConnectionInterface $connection */
-    $connection = \Drupal::service('rdf_sync.connection');
-
-    $subjects = $rows = [];
-    foreach ($triples->getHash() as $triple) {
-      $subjects[$triple['subject']][] = $rows[implode(' ', $triple)] = $triple;
-    }
-
-    foreach (array_keys($subjects) as $subject) {
-      $query = "SELECT ?p ?o WHERE { GRAPH <$graph> { <$subject> ?p ?o }}";
-      $results = $connection->query($query);
-      /** @var \EasyRdf\Sparql\Result $result */
-      foreach ($results as $result) {
-        $triple = [
-          'subject' => $subject,
-          'predicate' => (string) $result->p,
-          'object' => trim((string) $result->o),
-        ];
-        if (in_array($triple, $rows)) {
-          unset($rows[implode(' ', $triple)]);
-        }
-      }
-    }
-
-    if (!empty($rows)) {
-      throw new ExpectationFailedException(sprintf("Triple(s) %s doesn't exists in the RDF backend", implode(PHP_EOL, array_keys($rows))));
-    }
-
-  }
-
   /**
    * Asserts that a list of triples exists in a certain graph.
    *
@@ -136,7 +87,7 @@ public function assertTriples(string $graph, TableNode $triples): void {
    *
    * @Then the following :graph graph triples exist in the RDF backend:
    */
-  public function assertOnlyTheseTriples(string $graph, TableNode $triples): void {
+  public function assertTriples(string $graph, TableNode $triples): void {
     /** @var \Drupal\rdf_sync\RdfSyncConnectionInterface $connection */
     $connection = \Drupal::service('rdf_sync.connection');
 
diff --git a/web/modules/custom/joinup_core/joinup_core.deploy.php b/web/modules/custom/joinup_core/joinup_core.deploy.php
index ae4a24c21e..33814e44ab 100644
--- a/web/modules/custom/joinup_core/joinup_core.deploy.php
+++ b/web/modules/custom/joinup_core/joinup_core.deploy.php
@@ -13,74 +13,3 @@
  */
 
 declare(strict_types=1);
-
-use Drupal\Core\Utility\UpdateException;
-use Drupal\rdf_sync\RdfSyncMapper;
-use Drupal\topic\Entity\TopicMetaEntityInterface;
-
-/**
- * Fixes broken topic meta entities and deletes the duplications.
- */
-function joinup_core_deploy_111101(): string {
-  $metaEntityStorage = \Drupal::entityTypeManager()->getStorage('meta_entity');
-  $topicMetas = $metaEntityStorage->loadByProperties(['type' => 'topic']);
-  // Currently, there are 8 published topic meta entities, all of them are
-  // displayed on the home page, populated with user-provided content in their
-  // layout paragraph field.
-  // So, we fix these 'preexisting' metas and delete the ones created
-  // accidentally, during the SPARQL -> SQL storage switch.
-  $oldButBrokenMetas = array_filter(
-    $topicMetas,
-    function (TopicMetaEntityInterface $meta): bool {
-      return !is_numeric($meta->target?->get(0)?->getValue()['target_id'] ?? NULL);
-    }
-  );
-
-  // Before we delete the unnecessary metas, make sure we can find the right
-  // target for all the old ones.
-  $rdfSyncMapper = \Drupal::service('rdf_sync.mapper');
-  assert($rdfSyncMapper instanceof RdfSyncMapper);
-  $topicMetaTargetMapping = array_reduce(
-    $oldButBrokenMetas,
-    function (array $carry, TopicMetaEntityInterface $topicMeta) use ($rdfSyncMapper): array {
-      $targetIdUriOriginal = $topicMeta->get('target')->get(0)?->getValue()['target_id'] ?? NULL;
-      $targetIdUri = match($targetIdUriOriginal) {
-        'http://joinup.eu/ontology/topic#statistics-and-informatino' => 'http://joinup.eu/ontology/topic#statistics-and-information',
-        default => $targetIdUriOriginal,
-      };
-      $carry[$topicMeta->id()] = $rdfSyncMapper->getEntityByUri($targetIdUri)->id();
-      return $carry;
-    },
-    [],
-  );
-  if (count($oldButBrokenMetas) !== count(array_filter($topicMetaTargetMapping))) {
-    throw new UpdateException('It is not possible to restore the relationship of all broken topic meta entities, aborting deploy hook');
-  }
-
-  // Delete new, unnecessary topic meta entities.
-  $deleted = 0;
-  foreach (array_diff_key($topicMetas, $oldButBrokenMetas) as $potentialDuplicate) {
-    assert($potentialDuplicate instanceof TopicMetaEntityInterface);
-    if (!in_array($potentialDuplicate->getTargetEntity()->id(), $topicMetaTargetMapping, TRUE)) {
-      // We don't have a preexisting, broken (but fixable) meta entity which can
-      // replace this one, so skip deletion.
-      continue;
-    }
-    $potentialDuplicate->delete();
-    $deleted++;
-  }
-
-  // Fix the broken topic term metas.
-  foreach ($oldButBrokenMetas as $brokenMeta) {
-    assert($brokenMeta instanceof TopicMetaEntityInterface);
-    $brokenMeta->get('target')->get(0)
-      ->set('target_id', $topicMetaTargetMapping[$brokenMeta->id()]);
-    $brokenMeta->save();
-  }
-
-  return sprintf(
-    "Fixed %s broken topic meta entities and deleted %s duplication.",
-    count($oldButBrokenMetas),
-    $deleted,
-  );
-}
diff --git a/web/modules/custom/joinup_core/joinup_core.install b/web/modules/custom/joinup_core/joinup_core.install
index 6500da8466..823aea261c 100644
--- a/web/modules/custom/joinup_core/joinup_core.install
+++ b/web/modules/custom/joinup_core/joinup_core.install
@@ -92,13 +92,3 @@ function joinup_core_requirements($phase): array {
 
   return $requirements;
 }
-
-/**
- * Fix UUID for field.field.media.video.og_audience.
- */
-function joinup_core_update_111100(): void {
-  \Drupal::configFactory()
-    ->getEditable('field.field.media.video.og_audience')
-    ->set('uuid', '484ea427-ead5-4958-8f09-f2dc88642003')
-    ->save();
-}
diff --git a/web/modules/custom/joinup_rdf/joinup_rdf.deploy.php b/web/modules/custom/joinup_rdf/joinup_rdf.deploy.php
index ceb7de5c9d..fac8699635 100644
--- a/web/modules/custom/joinup_rdf/joinup_rdf.deploy.php
+++ b/web/modules/custom/joinup_rdf/joinup_rdf.deploy.php
@@ -6,339 +6,3 @@
  */
 
 declare(strict_types=1);
-
-use Drupal\joinup_taxonomy\Entity\MappedTerm;
-use Drupal\node\Entity\Node;
-use Drupal\pathauto\PathautoState;
-use Drupal\search_api\Entity\Index;
-use Drupal\sparql_entity_storage\UriEncoder;
-
-/**
- * Disable RDF Sync for the deployment.
- */
-function joinup_rdf_deploy_111100(): void {
-  \Drupal::getContainer()->get('rdf_sync.synchronizer')->disableSynchronization();
-}
-
-/**
- * Flatten RDF values.
- *
- * @param \stdClass[] $data
- *   The RDF data.
- *
- * @return array
- *   The flattened values.
- */
-function _joinup_rdf_deploy_flatten_rdf_values(array $data): array {
-  $values = [];
-  foreach ($data as $row) {
-    $property = $row->property->getUri();
-    $value = method_exists($row->value, 'getUri') ? $row->value->getUri() : $row->value->getValue();
-    $values[$property][] = $value;
-  }
-  return $values;
-}
-
-/**
- * Migrates published releases and their solutions.
- */
-function joinup_rdf_deploy_111101(array &$sandbox): string {
-  $endpoint = \Drupal::getContainer()->get('sparql.endpoint');
-  if (empty($sandbox['releases'])) {
-    $query = <<<SPARQL
-      SELECT DISTINCT ?id
-      FROM <http://joinup.eu/asset_release/published>
-      WHERE {
-        ?id a ?type .
-      }
-      SPARQL;
-    $results = $endpoint->query($query)->getArrayCopy();
-    $sandbox['releases']['published'] = array_map(fn(\stdClass $result) => $result->id->getUri(), $results);
-    // Also fetch releases from the draft graph, that do not exist in the
-    // published graph too - the new releases.
-    $query = <<<SPARQL
-      SELECT DISTINCT ?id
-      FROM <http://joinup.eu/asset_release/published>
-      FROM <http://joinup.eu/asset_release/draft>
-      WHERE {
-        GRAPH <http://joinup.eu/asset_release/draft> { ?id a ?type } .
-        FILTER NOT EXISTS {
-          GRAPH <http://joinup.eu/asset_release/published> {
-            ?id a ?type .
-          }
-        }
-      }
-      SPARQL;
-    $results = $endpoint->query($query)->getArrayCopy();
-    $sandbox['releases']['draft'] = array_map(fn(\stdClass $result) => $result->id->getUri(), $results);
-
-    $sandbox['progress'] = 0;
-    $sandbox['total'] = count($sandbox['releases']['published']) + count($sandbox['releases']['draft']);
-    $sandbox['solution_stubs'] = [];
-    $sandbox['swapped_aliases'] = 0;
-  }
-  $alias_repository = \Drupal::getContainer()->get('path_alias.repository');
-  $connection = \Drupal::database();
-  $rdf_storage = \Drupal::entityTypeManager()->getStorage('rdf_entity');
-  // Use this was to first create the published versions and then the new ones.
-  $source = empty($sandbox['releases']['published']) ? 'draft' : 'published';
-  $uris = array_splice($sandbox['releases'][$source], 0, 50);
-  $start = microtime(TRUE);
-  foreach ($uris as $uri) {
-    $query = <<<SPARQL
-      SELECT *
-      FROM <http://joinup.eu/asset_release/$source>
-      WHERE {
-        <$uri> ?property ?value .
-      }
-      SPARQL;
-    $results = $endpoint->query($query)->getArrayCopy();
-    $values = _joinup_rdf_deploy_flatten_rdf_values($results);
-
-    if (empty($values['http://purl.org/dc/terms/isVersionOf'][0]) || !($solution = $rdf_storage->load($values['http://purl.org/dc/terms/isVersionOf'][0]))) {
-      throw new Exception('Release ' . $uri . ' has no solution.');
-    }
-
-    $solution_uri = $solution->id();
-
-    if (!isset($sandbox['solution_stubs'][$solution_uri])) {
-      $solution_stub = Node::create([
-        'type' => 'solution',
-        'title' => strlen($solution->label()) > 255 ? substr($solution->label(), 0, 255) : $solution->label(),
-        'uri' => $solution_uri,
-      ]);
-      // @todo On the UI, we need to handle this when displaying values - link to
-      //   the original solution.
-      $solution_stub->save();
-      $sandbox['solution_stubs'][$solution_uri] = [
-        'target_id' => $solution_stub->id(),
-        'target_revision_id' => $solution_stub->getRevisionId(),
-      ];
-    }
-
-    $release_node = Node::create([
-      'type' => 'release',
-      'title' => strlen($values['http://purl.org/dc/terms/title'][0]) > 255
-        ? substr($values['http://purl.org/dc/terms/title'][0], 0, 255)
-        : $values['http://purl.org/dc/terms/title'][0],
-      'uri' => $uri,
-      'og_audience' => $solution->id(),
-      'created' => $values['http://purl.org/dc/terms/issued'][0]->getTimestamp(),
-      'changed' => $values['http://purl.org/dc/terms/modified'][0]->getTimestamp(),
-      'published_at' => $values['http://purl.org/dc/terms/issued'][0]->getTimestamp(),
-      'description' => [
-        'value' => $values['http://www.w3.org/ns/adms#versionNotes'][0] ?? '',
-        'format' => 'content_editor',
-      ],
-      'release_number' => $values['http://www.w3.org/2002/07/owl#versionInfo'][0] ?? '',
-      'field_state' => $values['http://joinup.eu/isr/workflow_status'][0],
-      'field_keywords' => $values['http://www.w3.org/ns/dcat#keyword'] ?? [],
-      'documentation' => $values['http://xmlns.com/foaf/0.1/page'][0] ?? NULL,
-      'langcode' => $values['http://joinup.eu/language'][0] ?? 'en',
-    ]);
-    $release_node->set('solution_data', $sandbox['solution_stubs'][$solution_uri]);
-
-    foreach ([
-      'http://purl.org/dc/terms/language' => 'language',
-      'http://www.w3.org/ns/adms#status' => 'process_status',
-      'http://purl.org/dc/terms/spatial' => 'spatial_coverage',
-      // @todo Create a follow up to merge the spatial_coverage fields in nodes.
-    ] as $predicate => $target_field) {
-      $mapped_values = [];
-      if (empty($values[$predicate])) {
-        continue;
-      }
-
-      foreach ($values[$predicate] as $value) {
-        if ($term = MappedTerm::loadByUri($value)) {
-          $mapped_values[] = [
-            'target_id' => $term->id(),
-          ];
-        }
-      }
-      $release_node->set($target_field, $mapped_values);
-    }
-    $pathauto_old_path = '/rdf_entity/' . UriEncoder::encodeUrl($uri);
-    $has_alias = $alias_repository->lookupBySystemPath($pathauto_old_path, 'en');
-    if ($has_alias) {
-      $release_node->get('path')->pathauto = PathautoState::SKIP;
-    }
-
-    $release_node->set('uri', $uri);
-    $release_node->setRevisionCreationTime($values['http://purl.org/dc/terms/modified'][0]->getTimestamp());
-    $release_node->save();
-
-    _joinup_rdf_deploy_update_field_target_id('node', 'isaicp_8569', 'distribution_parent_target_id', $uri, $release_node->id());
-
-    if ($has_alias) {
-      $internal_url = '/' . $release_node->toUrl()->getInternalPath();
-      $connection->update('path_alias')
-        ->fields(['path' => $internal_url])
-        ->condition('path', $pathauto_old_path)
-        ->execute();
-
-      $connection->update('path_alias_revision')
-        ->fields(['path' => $internal_url])
-        ->condition('path', $pathauto_old_path)
-        ->execute();
-      $sandbox['swapped_aliases']++;
-    }
-    $sandbox['progress']++;
-  }
-
-  $finish = microtime(TRUE);
-  $sandbox['#finished'] = $sandbox['progress'] / $sandbox['total'];
-  return "Progress: {$sandbox['progress']}/{$sandbox['total']} ({$sandbox['swapped_aliases']} aliases swapped) in " . round($finish - $start, 2) . 's';
-}
-
-/**
- * Migrates forward release revisions and unpublished ones, and their solutions.
- */
-function joinup_rdf_deploy_111102(array &$sandbox): string {
-  $endpoint = \Drupal::getContainer()->get('sparql.endpoint');
-  if (empty($sandbox['releases'])) {
-    $query = <<<SPARQL
-      SELECT DISTINCT ?id
-      FROM <http://joinup.eu/asset_release/draft>
-      WHERE {
-        GRAPH <http://joinup.eu/asset_release/draft> { ?id a ?type } .
-        FILTER EXISTS {
-          GRAPH <http://joinup.eu/asset_release/published> {
-            ?id a ?type .
-          }
-        }
-      }
-      SPARQL;
-
-    $results = $endpoint->query($query)->getArrayCopy();
-    $sandbox['releases'] = array_map(fn(\stdClass $result) => $result->id->getUri(), $results);
-    $sandbox['progress'] = 0;
-    $sandbox['total'] = count($sandbox['releases']);
-    $sandbox['solution_stubs'] = [];
-    $sandbox['swapped_aliases'] = 0;
-  }
-
-  $rdf_sync = \Drupal::getContainer()->get('rdf_sync.mapper');
-  $uris = array_splice($sandbox['releases'], 0, 50);
-  $start = microtime(TRUE);
-  foreach ($uris as $uri) {
-    $query = <<<SPARQL
-      SELECT *
-      FROM <http://joinup.eu/asset_release/draft>
-      WHERE {
-        <$uri> ?property ?value .
-      }
-      SPARQL;
-    $results = $endpoint->query($query)->getArrayCopy();
-    $values = _joinup_rdf_deploy_flatten_rdf_values($results);
-
-    if ($release_node = $rdf_sync->getEntityByUri($uri)) {
-      // We need to do the same process but create a new revision instead.
-      foreach ([
-        'http://purl.org/dc/terms/language' => 'language',
-        'http://www.w3.org/ns/adms#status' => 'process_status',
-        'http://purl.org/dc/terms/spatial' => 'spatial_coverage',
-      ] as $predicate => $target_field) {
-        $mapped_values = [];
-        if (empty($values[$predicate])) {
-          continue;
-        }
-
-        foreach ($values[$predicate] as $value) {
-          if ($term = MappedTerm::loadByUri($value)) {
-            $mapped_values[] = [
-              'target_id' => $term->id(),
-            ];
-          }
-        }
-        $release_node->set($target_field, $mapped_values);
-      }
-
-      $release_node->set('title', strlen($values['http://purl.org/dc/terms/title'][0]) > 255
-        ? substr($values['http://purl.org/dc/terms/title'][0], 0, 255)
-        : $values['http://purl.org/dc/terms/title'][0]);
-      $release_node->set('created', $values['http://purl.org/dc/terms/issued'][0]->getTimestamp());
-      $release_node->set('changed', $values['http://purl.org/dc/terms/modified'][0]->getTimestamp());
-      $release_node->set('published_at', $values['http://purl.org/dc/terms/issued'][0]->getTimestamp());
-      $release_node->set('description', [
-        'value' => $values['http://www.w3.org/ns/adms#versionNotes'][0] ?? '',
-        'format' => 'content_editor',
-      ]);
-      $release_node->set('release_number', $values['http://www.w3.org/2002/07/owl#versionInfo'][0] ?? '');
-      $release_node->set('field_state', $values['http://joinup.eu/isr/workflow_status'][0]);
-      $release_node->set('field_keywords', $values['http://www.w3.org/ns/dcat#keyword'] ?? []);
-      $release_node->set('documentation', $values['http://xmlns.com/foaf/0.1/page'][0] ?? NULL);
-      $release_node->set('langcode', $values['http://joinup.eu/language'][0] ?? 'en');
-
-      $release_node->setNewRevision();
-      $release_node->setRevisionCreationTime($values['http://purl.org/dc/terms/modified'][0]->getTimestamp());
-      $release_node->save();
-      _joinup_rdf_deploy_update_field_target_id('node', 'isaicp_8569', 'distribution_parent_target_id', $uri, $release_node->id());
-    }
-    $sandbox['progress']++;
-  }
-
-  $finish = microtime(TRUE);
-  $sandbox['#finished'] = $sandbox['progress'] / $sandbox['total'];
-  return "Progress: {$sandbox['progress']}/{$sandbox['total']} ({$sandbox['swapped_aliases']} aliases swapped) in " . round($finish - $start, 2) . 's';
-}
-
-/**
- * Clean up the search index.
- */
-function joinup_rdf_deploy_111103(): string {
-  /** @var \Drupal\search_api\Entity\Index $index */
-  $index = Index::load('published');
-  $results = $index->query()->addCondition('entity_bundle', 'asset_release')->execute();
-  $ids = array_keys($results->getResultItems());
-  // ::trackItems{action} re-constructs the IDs so we need to remove the prefix
-  // `entity:rdf_entity:` from the IDs.
-  $ids = array_map(function (string $id): string {
-    return str_replace('entity:rdf_entity/', '', $id);
-  }, $ids);
-  $index->trackItemsDeleted('entity:rdf_entity', $ids);
-
-  return 'Releases have been removed from the search index.';
-}
-
-/**
- * Clean the asset release graph.
- */
-function joinup_rdf_deploy_111104(): void {
-  $endpoint = \Drupal::getContainer()->get('sparql.endpoint');
-  $endpoint->query('CLEAR GRAPH <http://joinup.eu/asset_release/published>');
-  $endpoint->query('CLEAR GRAPH <http://joinup.eu/asset_release/draft>');
-}
-
-/**
- * Update the field target ID.
- *
- * @param string $base_table_prefix
- *   The base table prefix without the trailing underscores.
- * @param string $table
- *   The table name.
- * @param string $field
- *   The field name.
- * @param string $old_target_id
- *   The old target ID.
- * @param string $new_target_id
- *   The new target ID.
- * @param bool $include_revisions
- *   Whether to include revisions.
- *
- * @todo Remove this only after the RDF2Node is complete.
- */
-function _joinup_rdf_deploy_update_field_target_id(string $base_table_prefix, string $table, string $field, string $old_target_id, string $new_target_id, bool $include_revisions = TRUE): void {
-  $connection = \Drupal::database();
-  $connection->update($base_table_prefix . '__' . $table)
-    ->fields([$field => $new_target_id])
-    ->condition($field, $old_target_id)
-    ->execute();
-
-  if ($include_revisions) {
-    $connection->update($base_table_prefix . '_revision__' . $table)
-      ->fields([$field => $new_target_id])
-      ->condition($field, $old_target_id)
-      ->execute();
-  }
-}
diff --git a/web/modules/custom/joinup_rdf/joinup_rdf.install b/web/modules/custom/joinup_rdf/joinup_rdf.install
index 5522b296b9..51ff821c2e 100644
--- a/web/modules/custom/joinup_rdf/joinup_rdf.install
+++ b/web/modules/custom/joinup_rdf/joinup_rdf.install
@@ -39,26 +39,6 @@ function joinup_rdf_requirements(string $phase): array {
   return $requirements;
 }
 
-/**
- * Delete the asset_release RDF bundle. Enable joinup_release, joinup_solution.
- */
-function joinup_rdf_update_111101(): void {
-  // Delete the asset_release RDF bundle.
-  \Drupal::entityTypeManager()->getStorage('rdf_type')->load('asset_release')->delete();
-
-  // Install the joinup_release module because the joinup_distribution services
-  // have some dependency on the services provided by the joinup_release module.
-  \Drupal::service('module_installer')->install(['joinup_release', 'joinup_solution']);
-}
-
-/**
- * Re-run user_update_10000.
- */
-function joinup_rdf_update_111102(): void {
-  require_once DRUPAL_ROOT . '/core/modules/user/user.install';
-  user_update_10000();
-}
-
 /**
  * Fix releases not referring a solution stub.
  */
-- 
GitLab