Advertisement
chriskeene

SFX Prism 3 parser

Aug 7th, 2012
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.89 KB | None | 0 0
  1. # Version: $Id: PRISM.pm,v 1.1 2004/09/10 19:08:51 am_3 Exp $
  2. package Parsers::TargetParser::TALIS::PRISM;
  3. use base qw(Parsers::TargetParser);
  4. use     URI;
  5.  
  6.  
  7. sub     getHolding {
  8.         my ($this,$ctx_obj) = @_;
  9.         my $issn         = $ctx_obj->ISSN();
  10.         my $isbn         = $ctx_obj->ISBN();
  11.         my $journalTitle = $ctx_obj->journalTitle();
  12.         my $abbrevTitle  = $ctx_obj->{'@abbrevTitle'}->[0];
  13.         my $bookTitle    = $ctx_obj->bookTitle();
  14.         my $aulast       = $ctx_obj->{'@authLast'}->[0];
  15.         my $base_url     = $ctx_obj->parse_param('url');
  16.  
  17.         $isbn =~ s/-//g;
  18.  
  19.         if (length $issn) {
  20.             #$url=$base_url . "items/?query=$issn";
  21.             $url=$base_url . "items/?query=$issn" . '&facet[0]=displayascollection%3A"Periodicals"';
  22.         }
  23.         elsif (length $isbn) {
  24.             $url=$base_url . "items/?query=isbn%3A$isbn";
  25.         }
  26.         elsif (length $journalTitle) {
  27.             #title search, restricted to periodical.
  28.             $url=$base_url . "items/?query=title%3A$journalTitle" . '&facet[0]=displayascollection%3A"Periodicals"';
  29.         }
  30.         elsif (length $abbrevTitle) {
  31.             $url=$base_url . "items/?query=$abbrevTitle";
  32.         }
  33.         elsif (length $bookTitle) {
  34.             $url=$base_url . "items?query=title:\"$bookTitle\"";
  35.                 if (length ($bookTitle) && length ($aulast)) {
  36.                         # if we have a book title and author last name but no isbn
  37.                         # search for title: foo author:bar restrict to format books
  38.                         my $authortitle = "title%3A\"" . $bookTitle . "\"+author%3A" . $aulast;
  39.                         $url=$base_url . "items/?query=$authortitle";
  40.                         $url=$base_url . "items/?query=$authortitle" . '&facet[0]=displayasrecordtype%3A"bks"';
  41.                 }
  42.         }
  43.         return $url;
  44. }
  45.  
  46. 1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement