Bug 5262

Summary: authority plugin doesn't copy indicators
Product: Koha Reporter: Janusz Kaczmarek <januszop>
Component: MARC Authority data supportAssignee: Janusz Kaczmarek <januszop>
Status: CLOSED FIXED QA Contact: Katrin Fischer <katrin.fischer>
Severity: enhancement    
Priority: P5 - low CC: bargioni, bgkriegel, chris, gmcharlt, joao.pinto, jonathan.druart, katrin.fischer, koha.sekjal, magnus, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Proposed patch
Improved patch
Improved patch - v. 0.3
[SIGNED-OFF] Bug 5262 - authority plugin doesn't copy indicators -- ver. 0.3
[PASSED QA] Bug 5262 - authority plugin doesn't copy indicators -- ver. 0.3
[PASSED QA] Bug 5262 - authority plugin doesn't copy indicators -- ver. 0.3

Description Janusz Kaczmarek 2010-09-29 06:17:32 UTC
While adding/editing a bibliographic record, the authority plugin inserts the content of an authority record (subfields) into a bibliographic record (e.g. PERSO_NAME --> bibliographic 100/700/800 field), BUT the indicators doesn't copy (i.e. ind1=1 for surname in authority 100 field doesn't appear in bibliographic).

At first sight changes in (at least) following files are needed:
intranet/cgi-bin/authorities/blinddetail-biblio-search.pl
intranet/htdocs/intranet-tmpl/prog/en/modules/authorities/blinddetail-biblio-search.tmpl

Regards!

Janusz
Comment 1 Galen Charlton 2010-12-29 16:01:03 UTC
Marking this as an enhancement.  A review of the MARC21 and authority specs shows the following:

- in many cases, one or both indicator values in the bib heading could in fact be set from the authority record's main heading field.
- there are two main cases:
  1. Directly copying an indicator value over, e.g., for the form of name or for non-filing characters.  However, the indicator position in the authority record doesn't necessary correspond to the value used in the bib field; a good example of this is the nonfiling characters indicator for uniform title headings.  Consequently, the indicator mapping should be configured somewhere.
  2. Setting the thesaurus type (or source of term) based on the thesaurus specified in the authority record.  For MARC21 subject headings, this could entail setting the 6xx indicator 2 *and* a subfield $2; for UNIMARC headings, setting $2 appears to be sufficient.

The two cases could be treated as separate enhancements, of course.
Comment 2 Chris Cormack 2013-04-07 07:16:29 UTC
Is this still desired?
Comment 3 Janusz Kaczmarek 2013-04-07 08:14:51 UTC
Yes.  According to my experience, for librarians it would be great to have this.  (I was asked about it several times in different places.)

I perfectly agree to what Galen wrote -- it's not as straightforward as it seemed to me 2,5 years ago.  But seems not to be impossible (for instance, VTLS's Virtua does this). 

As to the subject headings in MARC-21, an association could be done between 008/11 from authority record and 2nd ind. in 6xx, i.e. 'a' -> 0, 'b' -> 1, 'c' -> 3 (cf. http://www.loc.gov/marc/authority/ad008.html vs. http://www.loc.gov/marc/bibliographic/bd600.html etc.) 

Indicators in UNIMARC bibliographics 6xx seem to be the same as the ones of authorities 2xx. (Subject heading system/thesaurus is defined elsewhere: in $2.)
Comment 4 Chris Cormack 2013-04-07 08:17:19 UTC
Awesome, I look forward to seeing a patch
Comment 5 Janusz Kaczmarek 2013-04-22 19:05:46 UTC Comment hidden (obsolete)
Comment 6 Janusz Kaczmarek 2013-04-30 18:20:21 UTC Comment hidden (obsolete)
Comment 7 Bernardo Gonzalez Kriegel 2013-04-30 21:56:43 UTC
Janusz,
could you add a test plan?
For example what need to have an auth record, and what to check in the linked biblio record.
Comment 8 Janusz Kaczmarek 2013-05-01 08:56:34 UTC
Test plan
=========

The story with indicators, especially in MARC-21, is not straightforward, but one can point four main cases:
1. MARC-21 formal heading -- other than unified title
2. MARC-21 formal heading -- unified title
3. MARC-21 subject heading
4. UNIMARC

1. MARC-21 formal heading -- other than unified title
1st indicator from field 1XX (100/110/111) in the authority record should be copied to 1st indicator of controlled field in the bibliographic record, 2nd indicator is not defined (hence no action is taken)

2. MARC-21 formal heading -- unified title
1st indicator in authority record is not defined (hence no action is taken)
2nd indicator from field 130 in the authority record should be copied to 1st indicator of controlled field in the bibliographic record if it is 130 or 730 (or 630 – se bellow), or to 2nd indicator of controlled field in the bibliographic record, if it is 830

3. MARC-21 subject heading (6XX in bibliographic record)

a) 1st indicator:
600, 610, 611: 1st indicator from field 1XX (100/110/111) in the authority record should be copied to 1st indicator of controlled field in the bibliographic record
630: 2nd indicator from field 130 in the authority record should be copied to 1st indicator of controlled field in the bibliographic record

b) 2nd indicator – the thesaurus
a mapping should be made from 008/11 in authority record (http://www.loc.gov/marc/authority/ad008.html) to the 2nd indictor (http://www.loc.gov/marc/bibliographic/bd600.html), e.g. 008/11=a  --> 2nd. ind. = 0
In case when 008/11=~/[rsz]/ 2nd ind. should be set to 7, and subfield $2 should be added (for r --> aat, for s --> sears, for z the cataloger has to put a value by himself)


4. UNIMARC
Indicators from the authority record should be copied directly to the controlled field in the bibliographic record.


References:
http://www.loc.gov/marc/bibliographic/
http://www.loc.gov/marc/authority/
http://archive.ifla.org/VI/3/p1996-1/sec-uni.htm
http://www.ifla.org/files/assets/uca/unimarc-authorities-format.pdf
Comment 9 Bernardo Gonzalez Kriegel 2013-05-01 22:32:18 UTC
Janusz,
I don't know much about catalographic rules,
but I can check if values verify expected behaviour.
I tested every combination suggested by current
mapping in Koha, could you check if those are
the expected values?

Test - Bug 5262 - MARC21

1) Add one authority for each kind, 
with values in both indicators (ind1=1, ind2=2)
PERSO_NAME 100a 
CORPO_NAME 110a 
MEETI_NAME 111a
UNIF_TITLE 130a
CHRON_TERM 148a
TOPIC_TERM 150a
GENRE/FORM 155a
GEOGR_NAME 151a

2) New biblio record, default framework
all indicators clean

3) Use cases, mapping from default MARC21 framework,
for each auth kind, results ( 1, 2, 7, - for empty)
008/11 = a and r (results separated by |)

a) PERSO_NAME 100
BIB IND1 IND2
100 1    -|-
600 1    0|7
696 1    0|7
700 1    -|-
796 1    -|-
800 1    -|-
896 1    -|-

b) CORPO_NAME 110
BIB IND1 IND2
110 1    -|-
610 1    0|7
697 1    0|7
710 1    -|-
797 1    -|-
810 1    -|-
897 1    -|-

c) MEETI_NAME 111
BIB IND1 IND2
111 1    -|-
611 1    0|7
698 1    0|7
711 1    -|-
798 1    -|-
811 1    -|-
898 1    -|-

d) CHRON_TERM 148
BIB IND1 IND2
648 1    0|7

e) GENRE/FOMR 155
BIB IND1 IND2
655 -    0|7

f) GEOGR_NAME 151
BIB IND1 IND2
651 1    0|7
662 1    0|7
691 1    0|7

h) UNIF_TITLE 130
BIB IND1 IND2
130 2    -|-
440 2    -|-
490 2    -|-
630 2    0|7
699 2    0|7
730 2    -|-
799 2    -|-
830 -    2|2
899 2    -|-

i) TOPIC_TERM 150
BIB IND1 IND2
650 1    0|7
654 1    0|7
656 1    0|7
657 1    0|7
658 1    0|7
690 1    0|7
Comment 10 Janusz Kaczmarek 2013-05-03 12:29:46 UTC Comment hidden (obsolete)
Comment 11 Janusz Kaczmarek 2013-05-03 12:32:21 UTC
Bernardo,

Thank you for your efforts in testing this patch.  In general, the results are correct, i.e. it is what I would expect—with one exception:

e) GENRE/FOMR 155
BIB IND1 IND2
655 -    0|7

With your data set (GENRE/FORM 155a, ind1=1, ind2=2), according to my code and to my tests results, the 1st indicator should become 1.  So, please, could you check it again.

BUT in fact the 1st indicator in authority records 148, 150, 151, 158 is undefined by definition (and should be your records), so I do not pay attention on it (precisely speaking, a default action is taken, i.e. to copy). 

Now, I have omitted one case: it could be, that UNIF_TITLE authority will used to control bibliographic 240. In this case 2nd indicator from UNIF_TITLE authority should be copied to 2nd indicator of bibliographic 240.  A modified patch has been provided.
Comment 12 Bernardo Gonzalez Kriegel 2013-05-04 18:23:28 UTC
> e) GENRE/FOMR 155
> BIB IND1 IND2
> 655 -    0|7
Tested again, good result. Also tested 240, so
using similar notation of comment 9

GENRE/FOMR 155
BIB IND1 IND2
655 1    0|7

UNIF_TITLE 130
BIB IND1 IND2
240 -    2|2

All ok then.
Comment 13 Bernardo Gonzalez Kriegel 2013-05-04 18:26:52 UTC Comment hidden (obsolete)
Comment 14 Jonathan Druart 2013-06-19 10:05:46 UTC
Looks good to me but I prefer a MARC21 user does QA on this patch.
Comment 15 Katrin Fischer 2013-08-03 18:26:43 UTC
Comment on attachment 17951 [details] [review]
[SIGNED-OFF] Bug 5262 - authority plugin doesn't copy indicators -- ver. 0.3

Review of attachment 17951 [details] [review]:
-----------------------------------------------------------------

::: authorities/blinddetail-biblio-search.pl
@@ +102,5 @@
>      push( @subfield_loop, { marc_subfield => 'w', marc_values => $relationship } ) if ( $relationship );
> +    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
> +        $indicator1 = $field->indicator('1');
> +        $indicator2 = $field->indicator('2');
> +    } elsif (C4::Context->preference('marcflavour') eq 'MARC21') {

I wonder if we could add something for NORMARC here too?
Comment 16 Janusz Kaczmarek 2013-08-03 18:42:49 UTC
(In reply to Katrin Fischer from comment #15)
> I wonder if we could add something for NORMARC here too?

Katrin, thank you very much for your comment.  

If you know any resources concerning NORMARC in a generally comprehensible language, let me know, I could try to add some lines. (What I have found is only http://www.nb.no/Bibliotekutvikling/Kunnskapsorganisering/Den-norske-katalogkomite/NORMARC -- I regret but I cannot read Norwegian :( )

Or feel free to add your insertion if you feel competent about NORMARC. 

Or maybe somebody else could add his contribution...
Comment 17 Katrin Fischer 2013-08-03 19:01:26 UTC Comment hidden (obsolete)
Comment 18 Katrin Fischer 2013-08-03 19:01:53 UTC
Created attachment 20091 [details] [review]
[PASSED QA] Bug 5262 - authority plugin doesn't copy indicators -- ver. 0.3

With this patch Koha should Koha should correctly copy indicators
(and create $2 subfield in MARC-21 if need) from the chosen authority
record to the edited bibliographic record (according to discussion in
bugzilla). UNIMARC and MARC-21 flavors are covered.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: work as described, testing in comments 9 and 12.
No errors.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Passes QA script and tests. Tested functionality repeating
some of the tests noted by Bernardo - checking mostly 1xx, 490,
and 7xx.
Comment 19 Katrin Fischer 2013-08-03 19:32:12 UTC
Hi Janusz, just seeing your comment - I have added Magnus to the cc list, he will know :)
Comment 20 Magnus Enger 2013-08-09 12:55:03 UTC
(In reply to Katrin Fischer from comment #19)
> Hi Janusz, just seeing your comment - I have added Magnus to the cc list, he
> will know :)

NORMARC does not support authorities at all at the moment. But thanks for thinking about us! :-)
Comment 21 Galen Charlton 2013-08-14 17:18:44 UTC
Pushed to master.  Thanks, Janusz!
Comment 22 Tomás Cohen Arazi 2013-09-10 19:27:59 UTC
This patch has been pushed to 3.12.x, will be in 3.12.5.

Thanks Janusz!
Comment 23 Bernardo Gonzalez Kriegel 2013-09-14 19:14:19 UTC
Pushed to 3.10.x, will be in 3.10.11