[OPEN-ILS-GENERAL] unAPI from getAttribute in WWW/SuperCat.pm?

John Merriam jmerriam at biblio.org
Tue Jan 2 10:37:22 EST 2018


Hi Dan.

Yes, 'copy_id' is what I was looking for.  Thank you so much for that!

We need to have the id from the asset.copy table in the 852 subfield f 
of our Z39.50 output for our holdings.  I'm not sure exactly why but it 
is my understanding that certain vendors that we work with need it there.

If there is some other place we should be doing this I would like to 
know.  It seems to me WWW/SuperCat.pm is the only place to do it.

Thanks again!


On 1/2/2018 10:23 AM, Daniel Wells wrote:
> Hello John,
> 
> This part of the code is pulling data from the unapi.bre() function in 
> the DB, so in this case, you want 'copy_id', i.e.:
> 
> ...
> f => $copy->getAttribute('copy_id'),
> ...
> 
> This said, I think we'd all be interested to know exactly what you are 
> trying to accomplish, as there are other existing APIs for getting copy 
> IDs, so I am not sure if adding it into this SRU function is the easiest 
> way to go.
> 
> Sincerely,
> Dan
> 
> 
> On Tue, Jan 2, 2018 at 9:50 AM, John Merriam <jmerriam at biblio.org 
> <mailto:jmerriam at biblio.org>> wrote:
> 
>     Hello.  I am working in the perl module WWW/SuperCat.pm and trying
>     to get the id of a row in asset.copy.  For some reason I am getting
>     back what looks like an unAPI URI instead of just the id of the
>     row.  I've been staring at this for a while and not sure why this is
>     happening or the best way to fix it.  This is around line 2030 in my
>     WWW/SuperCat.pm in EG 2.12.8.  The basic code flow in
>     WWW/SuperCat.pm is:
> 
>     results retrieved from cstore
>     my $marcxml = XML::LibXML->load_xml(...);
>     my @copies;
>     for my $node ($marcxml->getElementsByTagName('holdings')) {
>        for my $volume ($node->getElementsByTagName('volume')) {
>          for my $copy ($volume->getElementsByTagName('copy')) {
>            push @copies, {
>              f => $copy->getAttribute('id'),
>            };
> 
>     f ends up with unAPI stuff in it instead of just the row id that I
>     am looking for.  It looks like:
> 
>     ftag:open-ils.org:U2 at acp/5826234
> 
>     The part that I want is after the /   I put in a hack to manipulate
>     the unAPI string and strip out the / and everything in front of it
>     but I don't want to leave it that way.  I would like to do this the
>     correct way.
> 
>     I'm not sure if it really is supposed to behave this way or not.
>     Assuming it is, I was thinking maybe a function exists that can
>     extract the row id from the unAPI URI?  I wasn’t able to find one.
> 
>     Any ideas how to correctly get just the real row id from the
>     database without the unAPI stuff?
> 
>     Thanks in advance!

-- 

John Merriam
Evergreen System Specialist
Bibliomation, Inc.
24 Wooster Ave.
Waterbury, CT 06708
203-577-4070 x108


More information about the Open-ils-general mailing list