Bug 28639

Summary: Embed see-from headings (from authorities) into bibliographic records at OAI repository level
Product: Koha Reporter: Julien Sicot (Univ. Rennes 2) <julien.sicot>
Component: Web servicesAssignee: Thibaud Guillot <thibaud.guillot>
Status: Patch doesn't apply --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: ere.maijala, fridolin.somers, julien.sicot, lucas, mathsabypro, thibaud.guillot
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31286
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 28639 - Embed see-from headings (from authorities) into bibliographic records at OAI repository level
Bug 28639: Embed see-from headings (from authorities) into bibliographic records at OAI repository level
Bug 28639: Embed see-from headings (from authorities) into bibliographic records at OAI repository level
Bug 28639: Embed see-from headings (from authorities) into bibliographic records at OAI repository level
Bug 28639: (follow_up) changing syspref name on atomic update file
Bug 28639: (follow-up) Changes method to embed see-from headings

Description Julien Sicot (Univ. Rennes 2) 2021-06-30 09:43:33 UTC
Hi,

It could be interesting to enrich the bibliographic records exposed in OAI with see-from headings, this would allow users who use koha with a discovery tool to be able to manage, normalize and index some authorities data ?

This is something that could be done directly in C4::Biblio::GetMarcBiblio following the same method used for embedding items.
We could use an optional parameter like embed_items (embed_seefromheading) and a function similar to C4::Biblio::EmbedItemsInMarcBiblio by reusing what was made for zebra with EmbedSeeFromHeadings (bug #7417).

Thanks for feedback,
Best
Julien Sicot
Systems Librarian,
Université Rennes 2
Comment 1 Julien Sicot (Univ. Rennes 2) 2021-06-30 10:04:10 UTC
Created attachment 122500 [details] [review]
Bug 28639 - Embed see-from headings (from authorities) into  bibliographic records at OAI repository level

Test plan:
1. Create an authority with at least a 1XX$a and a 4XX$a, for instance:
    100 $a Foo
    400 $a Bar
2. Create a biblio and add a link to this authority using the
   cataloguing plugin
3. Enable OAI-PMH syspref and fill OAI-PMH:archiveID syspref with "oai:sandbox"
4. Go to OAI repository and display the previously created record (at /cgi-bin/koha/oai.pl?verb=GetRecord&metadataPrefix=marcxml&identifier=oai:sandbox:{biblionumber}
5. The record should not contain see-from headings
6. Enable OAI-PMH:EmbedSeeFromInBibRecord
7. Go again to the OAI record, you should see alternative forms at the end of the record
Comment 2 Ere Maijala 2021-07-08 19:29:21 UTC
I think the setting should be in the oai.conf file instead of a syspref. The conf file would allow you to make it format-specific instead of a global setting. You could e.g. setup a new metadataPrefix marc21_with_auth that would include the see-from headings while keeping the normal marc21 format intact.
Comment 3 Fridolin Somers 2021-08-10 23:11:16 UTC
Nice.

But why not using like rebuild_zebra.pl Koha::RecordProcessor and Koha::Filter::MARC::EmbedSeeFromHeadings ?
Code looks the same no ?
Comment 4 Thibaud Guillot 2022-10-21 07:29:53 UTC Comment hidden (obsolete)
Comment 5 Thibaud Guillot 2022-10-21 07:34:24 UTC
Created attachment 142297 [details] [review]
Bug 28639: Embed see-from headings (from authorities) into  bibliographic records at OAI repository level

Test plan:
1. Create an authority with at least a 1XX$a and a 4XX$a, for instance:
    100 $a Foo
    400 $a Bar
2. Create a biblio and add a link to this authority using the
   cataloguing plugin
3. Enable OAI-PMH syspref and fill OAI-PMH:archiveID syspref with "oai:sandbox"
4. Go to OAI repository and display the previously created record (at /cgi-bin/koha/oai.pl?verb=GetRecord&metadataPrefix=marcxml&identifier=oai:sandbox:{biblionumber}
5. The record should not contain see-from headings
6. Run perl installer/data/mysql/atomicupdate/bug_28639-add_EmbedSeeFromInBibRecord_syspref.pl
7. Enable OAI-PMH:EmbedSeeFromInBibRecord
8. Go again to the OAI record, you should see alternative forms at the end of the record
Comment 6 Thibaud Guillot 2022-10-21 07:39:11 UTC
(In reply to Julien Sicot (Univ. Rennes 2) from comment #0)
> Hi,
> 
> It could be interesting to enrich the bibliographic records exposed in OAI
> with see-from headings, this would allow users who use koha with a discovery
> tool to be able to manage, normalize and index some authorities data ?
> 
> This is something that could be done directly in C4::Biblio::GetMarcBiblio
> following the same method used for embedding items.
> We could use an optional parameter like embed_items (embed_seefromheading)
> and a function similar to C4::Biblio::EmbedItemsInMarcBiblio by reusing what
> was made for zebra with EmbedSeeFromHeadings (bug #7417).
> 
> Thanks for feedback,
> Best
> Julien Sicot
> Systems Librarian,
> Université Rennes 2

Thanks to you, I just rebase your proposal on master updated and add a atomic update file.

I just call Koha::Filter::MARC::EmbedSeeFromHeadings on OAI server side to show or hide embed see-from headings. 

I could not test your development due to an error so I hope that the intended behaviour remains the same. Please let me know if not.
Comment 7 Fridolin Somers 2022-12-20 18:52:14 UTC
Hi,

Atomic update is incorrect :
+            INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) 
+            VALUES (
+                'EmbedSeeFromInBibRecord', '0', NULL, 'Add embed see-from headings for OAI', 'YesNo'

Value should be OAI-PMH:EmbedSeeFromInBibRecord

Also :

+    Koha::Filter::MARC::EmbedSeeFromHeadings->filter($record);

Does this work ?
Other call use the RecordProcessor :

https://git.koha-community.org/Koha-community/Koha/src/commit/a57278f39b8c5b7a82b21671f266dbf32e2d41a0/t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t#L60

Best regards,
Comment 8 Thibaud Guillot 2022-12-23 13:30:27 UTC
Created attachment 144821 [details] [review]
Bug 28639: Embed see-from headings (from authorities) into  bibliographic records at OAI repository level

Test plan:
1. Create an authority with at least a 1XX$a and a 4XX$a, for instance:
    100 $a Foo
    400 $a Bar
2. Create a biblio and add a link to this authority using the
   cataloguing plugin
3. Enable OAI-PMH syspref and fill OAI-PMH:archiveID syspref with "oai:sandbox"
4. Go to OAI repository and display the previously created record (at /cgi-bin/koha/oai.pl?verb=GetRecord&metadataPrefix=marcxml&identifier=oai:sandbox:{biblionumber}
5. The record should not contain see-from headings
6. Run perl installer/data/mysql/atomicupdate/bug_28639-add_EmbedSeeFromInBibRecord_syspref.pl
7. Enable OAI-PMH:EmbedSeeFromInBibRecord
8. Go again to the OAI record, you should see alternative forms at the end of the record
Comment 9 Thibaud Guillot 2022-12-23 13:30:32 UTC
Created attachment 144822 [details] [review]
Bug 28639: (follow_up) changing syspref name on atomic update file
Comment 10 Thibaud Guillot 2022-12-23 13:34:05 UTC
(In reply to Fridolin Somers from comment #7)
> Hi,
> 
> Atomic update is incorrect :
> +            INSERT IGNORE INTO systempreferences
> (variable,value,options,explanation,type) 
> +            VALUES (
> +                'EmbedSeeFromInBibRecord', '0', NULL, 'Add embed see-from
> headings for OAI', 'YesNo'
> 
> Value should be OAI-PMH:EmbedSeeFromInBibRecord
> 
> Also :
> 
> +    Koha::Filter::MARC::EmbedSeeFromHeadings->filter($record);
> 
> Does this work ?
> Other call use the RecordProcessor :
> 
> https://git.koha-community.org/Koha-community/Koha/src/commit/
> a57278f39b8c5b7a82b21671f266dbf32e2d41a0/t/db_dependent/
> RecordProcessor_EmbedSeeFromHeadings.t#L60
> 
> Best regards,

Hi Fridolin :)

Thanks for your reply ! Yes I miss this thing, I fix that by follow-up. And I also rebased on 'fresh' master ^^ 

For this :

+ Koha::Filter::MARC::EmbedSeeFromHeadings->filter($record);

It works as intended apparently but you put me in doubt.. did you test it ? Maybe I miss something
Comment 11 Fridolin Somers 2022-12-23 19:20:19 UTC
(In reply to Thibaud Guillot from comment #10)
> (In reply to Fridolin Somers from comment #7)
> 
> For this :
> 
> + Koha::Filter::MARC::EmbedSeeFromHeadings->filter($record);
> 
> It works as intended apparently but you put me in doubt.. did you test it ?
> Maybe I miss something

I did not test it but since other calls are different.
We try to have same code syntax for clarity.

Great job btw ;)
Comment 12 Thibaud Guillot 2022-12-28 09:05:28 UTC
Created attachment 144857 [details] [review]
Bug 28639: (follow-up) Changes method to embed see-from headings

To have same code syntax call of Koha::RecordProcessor class
Comment 13 Thibaud Guillot 2022-12-28 09:06:36 UTC
(In reply to Fridolin Somers from comment #11)
> (In reply to Thibaud Guillot from comment #10)
> > (In reply to Fridolin Somers from comment #7)
> > 
> > For this :
> > 
> > + Koha::Filter::MARC::EmbedSeeFromHeadings->filter($record);
> > 
> > It works as intended apparently but you put me in doubt.. did you test it ?
> > Maybe I miss something
> 
> I did not test it but since other calls are different.
> We try to have same code syntax for clarity.
> 
> Great job btw ;)

Oh okay, thanks, you're right, I replace it :)
Comment 14 Lucas Gass 2023-11-06 23:27:30 UTC
This no longer applies cleanly to current master.