Add an example SFX target parser for Evergreen catalogues
authorDan Scott <dscott@laurentian.ca>
Mon, 16 Jan 2012 16:30:13 +0000 (11:30 -0500)
committerDan Scott <dscott@laurentian.ca>
Mon, 16 Jan 2012 16:32:22 +0000 (11:32 -0500)
The target parser is based on the JSPAC and serves up reasonable results
for ISSN and ISBN-based searches, using the appropriate identifier
indexes.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/examples/sfx_target_parser/JSPAC.hlp [new file with mode: 0644]
Open-ILS/examples/sfx_target_parser/JSPAC.pm [new file with mode: 0644]
Open-ILS/examples/sfx_target_parser/README [new file with mode: 0644]

diff --git a/Open-ILS/examples/sfx_target_parser/JSPAC.hlp b/Open-ILS/examples/sfx_target_parser/JSPAC.hlp
new file mode 100644 (file)
index 0000000..d1d7107
--- /dev/null
@@ -0,0 +1,100 @@
+<html>
+<head>
+<!--
+#
+# SFXCTRL              GUI for sfxctrl
+#
+# Version:             $Id: Evergreen.hlp,v 1.1 2012/01/16 19:08:51 am_3 Exp $
+#
+# Authors:             Patrick Hochstenbach, <Patrick.Hochstenbach@rug.ac.be>
+# Authors:             Dan Scott, <dscott@laurentian.ca>
+#
+# Copyright:           (c) 2000, SFX by Ex Libris (USA) Inc.
+#
+-->
+<title>sfxctrl</title>
+
+</head>
+<body 
+       bgcolor="#E6E6CE" 
+       background="/sfxctrl/pix.1.0/sfx_admin_dbManager_bg2.gif" 
+>
+
+<html>
+<head>
+<title>sfxctrl</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<!--
+#
+# SFXCTRL              GUI for sfxctrl
+#
+# Version:             $Id: Evergreen.hlp,v 1.1 2012/01/16 19:08:51 am_3 Exp $
+#
+# Authors:             Patrick Hochstenbach, <Patrick.Hochstenbach@rug.ac.be>
+# Authors:             Dan Scott, <dscott@laurentian.ca>
+#
+# Copyright:           (c) 2000, SFX by Ex Libris (USA) Inc.
+#
+--> 
+</head>
+
+<body bgcolor="#E6E6CE" background="/sfxctrl/pix.1.0/sfx_admin_dbManager_bg2.gif"><head> 
+<style type="text/css">
+<!--
+.regular {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; 
+
+line-height: normal; font-weight: normal; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.title {  font-family: Arial, Helvetica, sans-serif; font-size: 12pt; font-style: bold; 
+
+line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.bold {  font-family: Arial, Helvetica, sans-serif; font-size: 10pt; font-style: normal; 
+
+line-height: normal; font-weight: bold; font-variant: normal; text-transform: none; color: 
+
+#333399}
+.code {  font-family: Courier; font-size: 9pt; font-style: normal; line-height: normal; 
+
+font-weight: bold; font-variant: normal; text-transform: none; color: #333399}
+-->
+</style></HEAD>
+<span class="title"> 
+<p>PARSE_PARAM help for Evergreen JavaScript OPAC</p>
+</span>
+<p><span class="regular"><i>This help file describes Target Parser information 
+  for the Evergreen JavaScript OPAC. You will need this information only when editing this Target Service.<br>
+  <br>
+  </i><span class="bold">About PARSE_PARAM fields</span><i><br>
+  </i>PARSE_PARAM fields contain Target Parser information that is specific to 
+  a particular Target Service or Object Portfolio. Two PARSE_PARAM fields exist 
+  in the database: <br>
+  1. in the Target Service table : parameters that apply to the whole Target Service 
+  (eg. base URL) <br>
+  2. in the Object Portfolio table : parameters that apply to one particular Object 
+  Portfolio. (eg. jkey)<br>
+  This file will show you which PARSE_PARAM fields to fill in for both the Target 
+  Service level and the Object Portfolio level. More information on Target Parsers 
+  can be found in the SFX User Guide.</span></p>
+<span class="regular"> 
+<p><span class="bold"> General Information</span><br>
+  Target - LOCAL_CATALOGUE_EVERGREEN_JSPAC<br>
+  Service - getHolding<br>
+  Parser - Evergreen::JSPAC</p>
+</span> 
+<p><span class="regular"><span class="bold">Information needed in the Target Service:</span><br>
+In the PARSE_PARAM field, replace the following information: 
+<br>
+<span class="code">eg_host = $$LOCAL_CATALOGUE_SERVER<br>
+ eg_locale = Locale (en-US, en-CA, fr-CA, etc)
+ eg_skin = algoma, default, lul, nohin, uwin
+ eg_org_unit = 103, 1, etc
+ eg_depth = 0, 1, 2, 3, etc
+</span><br> 
+<p>
+</p>
+</body>
+</html>
+
diff --git a/Open-ILS/examples/sfx_target_parser/JSPAC.pm b/Open-ILS/examples/sfx_target_parser/JSPAC.pm
new file mode 100644 (file)
index 0000000..1015e02
--- /dev/null
@@ -0,0 +1,85 @@
+package Parsers::TargetParser::Evergreen::JSPAC;
+use Parsers::TargetParser;
+use base qw(Parsers::TargetParser);
+use strict;
+
+sub getHolding {
+  my ($this,$genRequestObj) = @_;
+  
+  my $objectType = $genRequestObj->{'objectType'};
+  my $ISBN = $genRequestObj->{'ISBN'};
+  my $eISBN = $genRequestObj->{'eISBN'};
+  my $ISSN = $genRequestObj->{'ISSN'};
+  my $eISSN = $genRequestObj->{'eISSN'};
+
+  my $CODEN = $genRequestObj->{'CODEN'};
+  my $bookTitle = $genRequestObj->{'bookTitle'};
+  my $journalTitle = $genRequestObj->{'journalTitle'};
+  my $articleTitle = $genRequestObj->{'articleTitle'};
+  my $confTitle = $genRequestObj->{'confTitle'};
+
+  my $abbrevTitle = $genRequestObj->{'@abbrevTitle'};
+  my $volume = $genRequestObj->{'volume'};
+  my $issue = $genRequestObj->{'issue'};
+  my $startPage = $genRequestObj->{'startPage'};
+  my $endPage = $genRequestObj->{'endPage'};
+
+  my $year = $genRequestObj->{'year'};
+  my $month = $genRequestObj->{'month'};
+  my $day = $genRequestObj->{'day'};
+  my $SICI = $genRequestObj->{'SICI'};
+  my $BICI = $genRequestObj->{'BICI'};
+
+  my $doi = $genRequestObj->{'doi'};
+  my $archive = $genRequestObj->{'archive'};
+  my $archiveId = $genRequestObj->{'archiveId'};
+  my $authLast = $genRequestObj->{'@authLast'};
+  my $authFirst = $genRequestObj->{'@authFirst'};
+
+  my $authInit = $genRequestObj->{'@authInit'};
+  my $medUID = $genRequestObj->{'medUID'};
+  my $tickUID = $genRequestObj->{'tickUID'};
+  my $subject = $genRequestObj->{'subject'};
+  my $attribute = $genRequestObj->{'@attribute'};
+
+  my $user = $genRequestObj->{'user'};
+  my $quarter = $genRequestObj->{'quarter'};
+  my $part = $genRequestObj->{'part'};
+  my $patent = $genRequestObj->{'patent'};
+  my $ssn = $genRequestObj->{'ssn'};
+
+  # Canonical search results URL for simple searches:
+  # http://hostname/opac/en-US/skin/lul/xml/rresult.xml?rt=keyword&tp=keyword&t=0895-2779&l=105&d=2&f=&av=
+
+  my $svc = $this->{svc};
+  my $egHost = $svc->parse_param('eg_host');
+  my $egLocale = $svc->parse_param('eg_locale');
+  my $egSkin = $svc->parse_param('eg_skin');
+  my $egOrgUnit = $svc->parse_param('eg_org_unit');
+  my $egDepth = $svc->parse_param('eg_depth');
+
+  my $path = "http://${egHost}/opac/${egLocale}/skin/${egSkin}/xml/rresult.xml?l=${egOrgUnit}&d=${egDepth}";
+
+  my $searchString = '&rt=keyword&tp=keyword&t=';
+
+  if (defined($ISSN)) {
+    $searchString .= "identifier|issn: $ISSN";
+  } 
+  elsif (defined($ISBN)) {
+    # Strip hyphens
+    $ISBN =~ s/-//g;
+    $searchString .= "dentifier|isbn: $ISBN";
+  }
+  elsif (defined($journalTitle)) {
+    $searchString .= "ti:${journalTitle}&bl=s";
+  }
+  elsif (defined($bookTitle)) {
+    $searchString .= "ti:${bookTitle}&bl=m";
+  }
+
+  return ($path . $searchString);
+
+}
+
+1;
diff --git a/Open-ILS/examples/sfx_target_parser/README b/Open-ILS/examples/sfx_target_parser/README
new file mode 100644 (file)
index 0000000..df6edc1
--- /dev/null
@@ -0,0 +1,31 @@
+README for SFX target parser for Evergreen
+==========================================
+Dan Scott <dscott@laurentian.ca>
+
+This directory includes an example SFX target parser for Evergreen that uses
+the JavaScript-based OPAC (JSPAC) as its target. It assumes the existence of
+identifier|issn and identifier|isbn indexes (available by default as of
+Evergreen 2.0). The code was based on my work as documented at 
+http://coffeecode.net/archives/194-SFX-target-parser-for-Evergreen-and-some-thoughts-about-searching-identifiers.html
+but updated for Evergreen 2.0, made more generic for an Evergreen audience,
+and targeted at the JSPAC in the knowledge that TPAC is coming.
+
+1. Create a SFX target parser Evergreen directory, adjusting the SFX path and
+   instance name according to your needs:
++
+[source,bash]
+------------------------------------------------------------------------------
+mkdir /exlibris/sfx_ver/sfx4_1/<instance>/lib/Parsers/TargetParser/Evergreen
+------------------------------------------------------------------------------
++
+2. Copy the JSPAC.hlp and JSPAC.pm files into your SFX target parser Evergreen
+   directory:
++
+[source,bash]
+------------------------------------------------------------------------------
+cp JSPAC* /exlibris/sfx_ver/sfx4_1/<instance>/lib/Parsers/TargetParser/Evergreen
+------------------------------------------------------------------------------
++
+3. Restart SFX to enable it to recognize the new target parser.
+4. Add and configure the new target parser in the SFX Administration, passing
+   in the variables such as locale, target search library, and search depth.