Islandora Scholar: author not appearing in citation when using roleTerm marcrelator codes

96 views
Skip to first unread message

Jeffery Antoniuk

unread,
Oct 6, 2016, 1:07:16 PM10/6/16
to islandora
Hello,

We are using the Islandora Scholar module with MODS records containing marcrelator codes within the author roleTerm element and finding that the author is not displaying as part of the MLA citation in the object view .

We've tried updating to the 7.x branch, php 5.4.

A bit more detail of our testing. Testing reveals that the citation string is missing author names if a "code" type is used with the "roleTerm" element even if the "text" type is also present:

Ok - author appears in CSL citation
--
<role>
<roleTerm authority="marcrelator" type="text">Author</roleTerm>
</role>


Broken - no author in CSL citation
--
<role>
<roleTerm type="code" authority="marcrelator">aut</roleTerm>
</role>


Broken - no author in CSL citation
--
<role>
<roleTerm type="code" authority="marcrelator">aut</roleTerm>
<roleTerm authority="marcrelator" type="text">Author</roleTerm>
</role>


Further digging into the module appears that the "marcrelator_code_to_term" function in "marcrelator_conversion.inc" might be related (https://github.com/Islandora/islandora_scholar/blob/7.x/modules/citeproc/includes/marcrelator_conversion.inc#L236-L243). Debugging is showing that within the function "marcrelator_code_to_term", the global "$_ir_citation_marcrelator_codes" is empty leading to the conversion skipping the author name in function "convert_mods_to_citeproc_json_names".  I'm not a Drupal expert so I'm unsure as to why.


I don't know if this is a good approach.

Any thoughts or advice would b greatly appreciated.

Cheers,
Jeffery

Bryan Brown

unread,
Oct 7, 2016, 12:46:28 PM10/7/16
to islandora
Hi Jefferey,

Did your workaround (making $_ir_citation_marcrelator_codes global in https://github.com/jefferya/islandora_scholar/commit/d2983f00f86dbb0adc47ff82304e89ab69252e87) work for you? I'm not very sharp when it comes to PHP scoping rules, but it looks like you've made a lot of progress in tracking down where the error is occurring. Does anybody else with more scoping knowledge have time to take a peek at this?

To further flesh things out, I noticed that the convert_mods_to_citeproc_json_name_role function is actually only reading the first <roleTerm> it finds, so its not necessarily a matter of a roleTerm with @type="code" being present, but actually whether it occurs first or not (https://github.com/Islandora/islandora_scholar/blob/7.x/modules/citeproc/includes/converter.inc#L680-L683 shows that it is handling the first element in the array returned from the xpath query). This has nothing to do with $_ir_citation_marcrelator_codes being empty, but adds another layer of complexity on top of the problem.

-Bryan

Diego Pino

unread,
Oct 12, 2016, 2:12:19 PM10/12/16
to islandora
Jefferey and Bryan,

Good catch, looking at that piece of code i see a BUG there(or a misunderstanding on php scopes and drupal way of including external files of whoever did write that piece)
By including marcrelator_conversion.inc using a 'module_load_include("...")' function basically you are not allowing any normal Global scope behaviour of php to happen.(which does work if you go for an straight php "include")

All that happens inside that function function convert_mods_to_citeproc_json_name_rol
Means, scope is ocal to that function and that makes internally called functions behave as they where inline to that function and not global to the php file 

Also, according to PHP documentation, "Using global keyword outside a function is not an error. It can be used if the file is included from inside a function." == this case
So, that fix Jefferey (adding global to $_ir_citation_marcrelator_codes) is legal and actually fine!

I feel you should open a ticket (JIRA) and pull

Best

Diego Pino Navarro
Metro.org

Note: link to thread that explains this a lot better than me

Alex Kent

unread,
Jul 27, 2017, 8:21:40 AM7/27/17
to islandora
Hi everyone, 

We are running into a problem with the citation generator as well in our testing.  We have tried making various changes in the MODS record but can't get the author to appear in a citation.   Has their been progress in fixing this?  We are on Islandora 1.7.   

Thanks very much in advance.  We would greatly appreciate any advice on this.  
Message has been deleted

Alex Kent

unread,
Aug 7, 2017, 10:26:12 AM8/7/17
to islandora
Diego, are you going to be able to work on this? 

Thanks! 

Alex

On Thursday, July 27, 2017 at 12:01:09 PM UTC-5, dp...@metro.org wrote:
I guess nobody made a Jira Ticket and pulled the fix. I could, not sure if i should, would be good if someone else, like the reporter maybe, could step up on this and share the fix. If not, let's give this 48hrs and I can go for that of course.

Best

Diego Pino 
Metro.org

dp...@metro.org

unread,
Aug 7, 2017, 11:58:20 AM8/7/17
to islandora
Alex, i checked and this was merged and fixed last year, Nov 2016!!! https://jira.duraspace.org/browse/ISLANDORA-1829. I had forgotten about this completely so my last statement
made no sense (removed the post to avoid further confusion)! Jeffery Antoniuk made the ticket (thanks, Jeffery) and i (i was!) merged it.. 

What version are you running? This is has been around for some time already.

best

Diego Pino N

Linda Richter

unread,
Aug 11, 2017, 10:15:02 AM8/11/17
to islandora
I am also not seeing the author in the citation. Is there a specific way that the author field needs to be coded in MODS in order for it to appear in a citation? For example, should the following work?

<name>
  <namePart>Prinsco</namePart>
  <role>
    <roleTerm type="text">author</roleTerm>
  </role>
</name>

Thanks,
Linda
Reply all
Reply to author
Forward
0 new messages