From 8bb2c1f16447ceb189c1091246dce9cda9961ec8 Mon Sep 17 00:00:00 2001 From: asajedi Date: Thu, 7 Oct 2021 03:08:01 +0200 Subject: [PATCH 1/3] Implement sic annotation This implements annotations related to TEI sic element. For that purpose the emo-bundle had to be extended accordingly to be able to provide the annotations via text API. Changes to emo-bundle could be found on: https://github.com/subugoe/EMOBundle/pull/34/commits/8e3b009bb5c1da74c15c041e448719a31484db8d --- solr/gfl/conf/schema.xml | 4 +++- solr/gfloffline/conf/schema.xml | 2 ++ src/Controller/Tei2SolrController.php | 29 +++++++++++++++++++++++++++ src/Model/SolrDocument.php | 13 ++++++++++++ 4 files changed, 47 insertions(+), 1 deletion(-) diff --git a/solr/gfl/conf/schema.xml b/solr/gfl/conf/schema.xml index c9c6b33..3aac27b 100755 --- a/solr/gfl/conf/schema.xml +++ b/solr/gfl/conf/schema.xml @@ -110,8 +110,10 @@ + + - + diff --git a/solr/gfloffline/conf/schema.xml b/solr/gfloffline/conf/schema.xml index d7a689d..00e8f15 100755 --- a/solr/gfloffline/conf/schema.xml +++ b/solr/gfloffline/conf/schema.xml @@ -109,6 +109,8 @@ + + diff --git a/src/Controller/Tei2SolrController.php b/src/Controller/Tei2SolrController.php index 455faf8..9d468dd 100755 --- a/src/Controller/Tei2SolrController.php +++ b/src/Controller/Tei2SolrController.php @@ -635,6 +635,8 @@ class Tei2SolrController extends AbstractController $pagesNotesUuids = $solrDocument->getPagesNotesUuids(); $pagesSegs = $solrDocument->getPagesSegs(); + $pagesSics = $solrDocument->getPagesSics(); + $update = $this->client->createUpdate(); $doc = $update->createDocument(); @@ -775,6 +777,11 @@ class Tei2SolrController extends AbstractController $childDoc->page_segs = array_values($pagesSegs[$i - 1]); } + if (isset($pagesSics[$i - 1]) && !empty(($pagesSics[$i - 1]))) { + $childDoc->page_sics = array_values($pagesSics[$i - 1]); + $childDoc->page_sics_ids = array_keys($pagesSics[$i - 1]); + } + $update->addDocument($childDoc); } } @@ -931,6 +938,7 @@ class Tei2SolrController extends AbstractController $pagesSegs = []; $pagesNotesUuids = []; $notesUuids = []; + $pagesSics = []; foreach ($allElements as $k => $elements) { $renditions = []; @@ -1001,6 +1009,10 @@ class Tei2SolrController extends AbstractController $eText .= ' ' . $childElement->data; $tText .= ' ' . $childElement->data; $note = false; + } elseif (isset($sic) && true === $sic) { + $eText .= ' '; + $tText .= ' '; + $sic = false; } elseif (isset($abbr) && !empty($abbr)) { $tText .= $abbr; $abbr = ''; @@ -1210,6 +1222,13 @@ class Tei2SolrController extends AbstractController $tText .= $entityName; } $gnd = true; + } elseif ($childElement->nodeName === "sic") { + $sicText = $this->getElementText($childElement); + $sicUuid = $this->getUuid(); + $eText .= $this->getSpan($sicUuid, $sicText); + $tText .= $sicText; + $pagesSics[$k][$sicUuid] = trim($sicText); + $sic = true; } } @@ -1250,9 +1269,19 @@ class Tei2SolrController extends AbstractController $solrDocument->setPagesNotesUuids($pagesNotesUuids); $solrDocument->setPagesSegs($pagesSegs); + $solrDocument->setPagesSics($pagesSics); + return $solrDocument; } + private function getSpan(string $uuid, string $spanText): string + { + $span = ''.$spanText; + + return $span; + } + + private function getSegBiblTarget(\DOMElement $childElement): ?string { $elementChildsArr = []; diff --git a/src/Model/SolrDocument.php b/src/Model/SolrDocument.php index 5cdff0b..98fd842 100755 --- a/src/Model/SolrDocument.php +++ b/src/Model/SolrDocument.php @@ -12,6 +12,7 @@ class SolrDocument private array $pagesGndsUuids; private array $pagesNotesUuids; private array $pagesSegs; + private array $pagesSics; public function getTranscriptedText(): string { @@ -108,4 +109,16 @@ class SolrDocument return $this; } + + public function getPagesSics(): ?array + { + return $this->pagesSics; + } + + public function setPagesSics(?array $pagesSics): SolrDocument + { + $this->pagesSics = $pagesSics; + + return $this; + } } -- GitLab From 950a3647893a6b8fc6bf47cc8ef2bb1e3d8b26f0 Mon Sep 17 00:00:00 2001 From: asajedi Date: Thu, 7 Oct 2021 03:12:54 +0200 Subject: [PATCH 2/3] Update dependencies --- composer.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/composer.lock b/composer.lock index 21d953d..6650883 100755 --- a/composer.lock +++ b/composer.lock @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.197.0", + "version": "3.197.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c5391ef7c979473b97d81329100bfa5fb018fa62" + "reference": "e3353c1d908295b4a804e13da6b2d6bfeec2732b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c5391ef7c979473b97d81329100bfa5fb018fa62", - "reference": "c5391ef7c979473b97d81329100bfa5fb018fa62", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/e3353c1d908295b4a804e13da6b2d6bfeec2732b", + "reference": "e3353c1d908295b4a804e13da6b2d6bfeec2732b", "shasum": "" }, "require": { @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.197.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.197.1" }, - "time": "2021-10-05T18:14:34+00:00" + "time": "2021-10-06T18:26:50+00:00" }, { "name": "doctrine/annotations", @@ -963,12 +963,12 @@ "source": { "type": "git", "url": "https://github.com/schmittjoh/metadata.git", - "reference": "a995e6cef6d6f56a6226e1616a519630e2ef0aeb" + "reference": "3e1dc95fa59863b98a2639c045b6ba43232716a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/a995e6cef6d6f56a6226e1616a519630e2ef0aeb", - "reference": "a995e6cef6d6f56a6226e1616a519630e2ef0aeb", + "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/3e1dc95fa59863b98a2639c045b6ba43232716a6", + "reference": "3e1dc95fa59863b98a2639c045b6ba43232716a6", "shasum": "" }, "require": { @@ -1018,9 +1018,9 @@ ], "support": { "issues": "https://github.com/schmittjoh/metadata/issues", - "source": "https://github.com/schmittjoh/metadata/tree/2.5.1" + "source": "https://github.com/schmittjoh/metadata/tree/master" }, - "time": "2021-08-04T19:32:08+00:00" + "time": "2021-10-06T11:25:39+00:00" }, { "name": "jms/serializer", @@ -2890,12 +2890,12 @@ "source": { "type": "git", "url": "https://github.com/subugoe/EMOBundle.git", - "reference": "474c377f8f1426673499c823256f5aecddec7254" + "reference": "93375d0aad58bfd818b813f47cf74f723e759a2f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/subugoe/EMOBundle/zipball/474c377f8f1426673499c823256f5aecddec7254", - "reference": "474c377f8f1426673499c823256f5aecddec7254", + "url": "https://api.github.com/repos/subugoe/EMOBundle/zipball/93375d0aad58bfd818b813f47cf74f723e759a2f", + "reference": "93375d0aad58bfd818b813f47cf74f723e759a2f", "shasum": "" }, "require": { @@ -2927,7 +2927,7 @@ "issues": "https://github.com/subugoe/EMOBundle/issues", "source": "https://github.com/subugoe/EMOBundle/tree/master" }, - "time": "2021-10-05T23:53:03+00:00" + "time": "2021-10-07T01:01:19+00:00" }, { "name": "symfony/asset", @@ -3004,12 +3004,12 @@ "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "84a39ad8e9f9e4b807e7087f3924fc2c3030af7c" + "reference": "8810b1addbd271245af891f5ffca90a5ab5eb8f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/84a39ad8e9f9e4b807e7087f3924fc2c3030af7c", - "reference": "84a39ad8e9f9e4b807e7087f3924fc2c3030af7c", + "url": "https://api.github.com/repos/symfony/cache/zipball/8810b1addbd271245af891f5ffca90a5ab5eb8f2", + "reference": "8810b1addbd271245af891f5ffca90a5ab5eb8f2", "shasum": "" }, "require": { @@ -3091,7 +3091,7 @@ "type": "tidelift" } ], - "time": "2021-10-05T20:27:01+00:00" + "time": "2021-10-06T08:50:56+00:00" }, { "name": "symfony/cache-contracts", -- GitLab From ed1befcfd4a28a9c1889e76942ebe821b2f57b14 Mon Sep 17 00:00:00 2001 From: asajedi Date: Thu, 7 Oct 2021 14:25:07 +0200 Subject: [PATCH 3/3] Add css class name to createSpan method --- src/Controller/Tei2SolrController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Controller/Tei2SolrController.php b/src/Controller/Tei2SolrController.php index 9d468dd..55d7fe3 100755 --- a/src/Controller/Tei2SolrController.php +++ b/src/Controller/Tei2SolrController.php @@ -1225,7 +1225,7 @@ class Tei2SolrController extends AbstractController } elseif ($childElement->nodeName === "sic") { $sicText = $this->getElementText($childElement); $sicUuid = $this->getUuid(); - $eText .= $this->getSpan($sicUuid, $sicText); + $eText .= $this->createSpan($sicUuid, $sicText, $childElement->nodeName); $tText .= $sicText; $pagesSics[$k][$sicUuid] = trim($sicText); $sic = true; @@ -1274,9 +1274,9 @@ class Tei2SolrController extends AbstractController return $solrDocument; } - private function getSpan(string $uuid, string $spanText): string + private function createSpan(string $uuid, string $spanText, string $cssClassName): string { - $span = ''.$spanText; + $span = ''.$spanText; return $span; } -- GitLab