Bug 8523 - Authority hierarchies only support UNIMARC
Summary: Authority hierarchies only support UNIMARC
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: MARC Authority data support (show other bugs)
Version: 3.10
Hardware: All All
: P5 - low normal (vote)
Target Milestone: ---
Assignee: Jared Camins-Esakov
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 8207
Blocks: 21128 8870 21807
  Show dependency treegraph
 
Reported: 2012-07-30 14:54 UTC by Jared Camins-Esakov
Modified: 2018-11-11 22:36 UTC (History)
4 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 8523: Display auth hierarchies w/all marcflavours (685.92 KB, patch)
2012-08-04 21:07 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523: Display auth hierarchies w/all marcflavours (687.50 KB, patch)
2012-08-30 01:14 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523 follow-up: support NORMARC, too (1.26 KB, patch)
2012-09-09 16:19 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523: fix translatability (1.65 KB, patch)
2012-09-09 17:03 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523 follow-up: always regenerate non-UNIMARC hierarchies (848 bytes, patch)
2012-09-09 19:03 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523 follow-up: sanitize HTML in template (2.71 KB, patch)
2012-09-09 20:03 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523 follow-up: correctly handle leaves (1.76 KB, patch)
2012-09-09 22:10 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
screenshot (38.68 KB, image/png)
2012-09-10 04:52 UTC, Katrin Fischer
Details
Bug 8523 follow-up: quiet warning (1.03 KB, patch)
2012-09-10 08:05 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 8523 follow-up: always open tree to current node (4.92 KB, patch)
2012-09-10 08:36 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 8523: Display auth hierarchies w/all marcflavours (689.87 KB, patch)
2012-09-11 05:50 UTC, Katrin Fischer
Details | Diff | Splinter Review
looks different (50.48 KB, image/png)
2012-09-27 17:54 UTC, Nicole C. Engard
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-07-30 14:54:44 UTC
As of right now, the authority hierarchy code works only with UNIMARC. There is, however, no reason why it should not also work with MARC21, and we propose to add support for MARC21 to the authority hierarchy code.
Comment 1 Jared Camins-Esakov 2012-08-04 21:07:44 UTC Comment hidden (obsolete)
Comment 2 Frédéric Demians 2012-08-06 13:53:28 UTC
I can't sign-off before the end of August. But I have 2 libraries using the authority hierarchy display with UNIMARC. So I really want to confirm that this patch doesn't imply any regression before it is pushed.
Comment 3 Jared Camins-Esakov 2012-08-06 14:06:00 UTC
(In reply to comment #2)
> I can't sign-off before the end of August. But I have 2 libraries using the
> authority hierarchy display with UNIMARC. So I really want to confirm that
> this patch doesn't imply any regression before it is pushed.

This was one of my major concerns when writing the code, and I believe there are not any. However, I had limited UNIMARC authority data to test with. If you would be willing to send me more examples of hierarchical UNIMARC authorities, I would love to test the code against those, and fix any problems I find.
Comment 4 Katrin Fischer 2012-08-14 19:37:42 UTC
Hi Jared, I really like the new hiearchy view! I found 2 smaller problems testing this: 

1) There is a doubled up )) in the database update message.

2) I created a topical subject B with a wider term A. The hierarchy shows nicely when I am on the lowest level. When I click on the higher level term A the lower hierarchies vanish from the tree view. Hope that is an understandable description :) 

3) Suggestion: It took me a moment to figure out that the tree had clickable links, maybe a hover effect like we have on other links would make it clearer.
Comment 5 Jared Camins-Esakov 2012-08-30 00:24:00 UTC
(In reply to comment #4)
> Hi Jared, I really like the new hiearchy view! I found 2 smaller problems
> testing this: 
> 
> 1) There is a doubled up )) in the database update message.

Fixed.

> 2) I created a topical subject B with a wider term A. The hierarchy shows
> nicely when I am on the lowest level. When I click on the higher level term
> A the lower hierarchies vanish from the tree view. Hope that is an
> understandable description :) 

It is. However, this is the way the feature currently works with UNIMARC (which requires bidirectional links). Rather than make too large a change at once, I propose starting with my revised patch, which will still have this problem, and then, once it's working I'll do a follow-up adding a cron job to generate bidirectional links from the unidirectional links that are endemic to MARC21. Does this sound fair?

> 3) Suggestion: It took me a moment to figure out that the tree had clickable
> links, maybe a hover effect like we have on other links would make it
> clearer.

I changed the way links appear. Let me know what you think.
Comment 6 Jared Camins-Esakov 2012-08-30 01:14:10 UTC Comment hidden (obsolete)
Comment 7 Jared Camins-Esakov 2012-09-09 16:19:14 UTC Comment hidden (obsolete)
Comment 8 Jared Camins-Esakov 2012-09-09 17:03:54 UTC Comment hidden (obsolete)
Comment 9 Jared Camins-Esakov 2012-09-09 19:03:53 UTC Comment hidden (obsolete)
Comment 10 Jared Camins-Esakov 2012-09-09 20:03:56 UTC Comment hidden (obsolete)
Comment 11 Jared Camins-Esakov 2012-09-09 22:10:55 UTC Comment hidden (obsolete)
Comment 12 Katrin Fischer 2012-09-10 04:49:42 UTC
Jared, this works almost perfectly now - one small issue: should the tree show me the authority I am currently looking at? For me the tree always shows the highest level when I open an authority from the result list 'details' link and after a refresh of the page.
Comment 13 Katrin Fischer 2012-09-10 04:52:56 UTC
Created attachment 12097 [details]
screenshot

For better illustration on how this works and looks like, I am adding a screenshot. It looks nice!
Comment 14 Katrin Fischer 2012-09-10 04:57:02 UTC
Frederic and Paul: I am testing this feature and I have created a UNIMARC installation using the sample database from the sandboxes. If you can give me some hints about how to catalogue the authorities correctly, I can try repeating my tests for UNIMARC.
Comment 15 Jared Camins-Esakov 2012-09-10 08:05:21 UTC Comment hidden (obsolete)
Comment 16 Jared Camins-Esakov 2012-09-10 08:08:58 UTC
(In reply to comment #12)
> Jared, this works almost perfectly now - one small issue: should the tree
> show me the authority I am currently looking at? For me the tree always
> shows the highest level when I open an authority from the result list
> 'details' link and after a refresh of the page.

Could you take a screenshot of what you see right when you refresh? When I refresh, the hierarchy is automatically open to the current node.
Comment 17 Jared Camins-Esakov 2012-09-10 08:14:33 UTC
(In reply to comment #16)
> Could you take a screenshot of what you see right when you refresh? When I
> refresh, the hierarchy is automatically open to the current node.

Never mind. Additional information over IRC has clarified the problem. Patch forthcoming.
Comment 18 Jared Camins-Esakov 2012-09-10 08:36:12 UTC Comment hidden (obsolete)
Comment 19 Katrin Fischer 2012-09-11 05:50:35 UTC
Created attachment 12125 [details] [review]
[SIGNED-OFF] Bug 8523: Display auth hierarchies w/all marcflavours

This commit adds support for displaying authority hierarchies for all
flavours of MARC, not just UNIMARC. Display now uses the jQuery
jstree plugin, selected with the help of Owen Leonard, resulting in a
much faster experience for users.

Be aware that the jstree file uses tabs rather than 4-space indentation,
which I left as-is so as to make it easier to integrate upstream
releases in the future.

To test:
1) Enable the AuthDisplayHierarchy syspref
2) Create authority records with a hierarchy of see also fields
   (in MARC21/NORMARC, you'll be using 5xx fields for this, with a
   subfield $w=g for broader terms and subfield $w=h for narrower
   terms)
3) View the authorities in the OPAC, noting the hierarchical view at
   the top of the page.

This initial patch does not create bidirection linkages from
unidirectional links in MARC21 authorities. This means that when moving
up the authority hierarchy, lower levels will disappear. This is
intentional, as the first patch is intended merely to ensure that
AuthDisplayHierarchy functions the same for all marcflavours. A future
patch will add a cron job to generate the bidirectional linkages, once
we are sure that the hierarchy functionality for UNIMARC and
MARC21/NORMARC coexists peaceably.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Resolved conflicts in updatedatabase.pl, sysprefs.sql and in one of
the CSS files.

Test plan:

1) Run t/AuthoritiesMarc.t
New tests complete without any errors.

2) Make sure updatedatabase works correctly.
Update works nicely, new system preference is also added to syspref.sql

3) Make sure new terms are translatable.
Created new po files for de-DE and checked for new terms.
All translations appear correctly.

4) Make sure everything works with AuthDisplayHieararchy OFF
- Add authority
- Edit authority
- Delete authority

5) Test feature with AuthDisplayHieararchy ON
- Add authority
- Edit authority
- Delete authority

6) Add a couple of hierarchically linked authorities
Note: links have to be created in both directions

Example:
151 $aGermany
  551 $a Baden-Württemberg $w h

151 $aBaden-Württemberg
  551 $a Konstanz $w h
  551 $a Germany $w g

151 $aKonstanz
  551 $a Baden-Württemberg $w g
  551 $a Fürstenberg $w h
  551 $a Paradies $w h

151 $a Fürstenberg
  551 $a Konstanz $w g

151 $a Paradies
  551 $a Konstanz $w g

Tree shows up nicely above the authority record
- in staff
- in OPAC
  - on the normal view tab
  - on the MARC view tab

7) Checking the logs for warnings
- no Javascript errors or warnings
- no warnings or errors in log files
Comment 20 Katrin Fischer 2012-09-18 20:13:44 UTC
This is a very cool feature *nudge*
Comment 21 Paul Poulain 2012-09-21 14:34:56 UTC
QA comment:
 * passes koha-qa.pl
 * switch from something UNIMARC specific to MARC agnostic, plus introduce a more modern (& probably robust) way to handle/display hierarchies

2 small glitches, that are not worth failing QA but should be improved later:

my authorities where
250$a Jardinage

250 $aJardinage$xLégumes
550$5b$aJardinage
550$5h$aJardinage bio

The hierarchy is:
Jardinage
  + Jardinage légumes
     + Jardinage bio

BUT, as the "Legumes" is in $x and we display only the $a in the hierarchy, we see:
Jardinage
  + Jardinage
     + Jardinage bio
It's not the most common case in UNIMARC, but it happens.

* the authority-detail still show Broader term & Narrower term when the hierarchy is ON. Maybe we could remove them ? (see screenshot)

Overall = passed QA
Comment 22 Paul Poulain 2012-09-21 14:36:25 UTC
Patch pushed to master with some followup:
 * one for perlcritic C4/AuthoritiesMarc.pm
 * one for adding needed css for ccsr theme
Comment 23 Nicole C. Engard 2012-09-27 17:54:37 UTC
Created attachment 12565 [details]
looks different

I'm trying to document this feature and have an authority with 500s on it (and I have the authorities for those 500s) but I'm not seeing anything but the one heading.  Can you please give me an example of what to enter (a link to a LOC authority is fine) to see this in action on my system in Marc21?

Nicole
Comment 24 Jared Camins-Esakov 2012-10-04 12:22:24 UTC
After conversation with Frédéric, it sounds like this patch really is more of a bugfix than an enhancement, since auth hierarchy support is definitely missing from MARC21/NORMARC, and this also improves the situation for UNIMARC installs (particularly in terms of performance). As such, this could be a candidate for 3.8.x.
Comment 25 Paul Poulain 2012-10-04 12:36:16 UTC
I'm not against pushing this patch in 3.8, but just want to point that it changes some things in the display. This may trouble some users.
Comment 26 Frédéric Demians 2012-10-04 12:54:27 UTC
(En réponse au commentaire 25)
> I'm not against pushing this patch in 3.8, but just want to point that it
> changes some things in the display. This may trouble some users.

It won't change that much for libraries using non-hierarchical authorities. For libraries having a thesaurus (authorities with semantic relations), the authorities are broken in 3.8 (bug 8870), and this bug (8523) is required to fix 8870.
Comment 27 Chris Cormack 2013-04-20 23:16:02 UTC
Released in 3.10.0