Web Services & Widgets for the WebOPAC IUG 2009 Annette Bailey Virginia Tech
Motivation Enhancing the WebOPAC display with information from outside web services – Dynamic integration even without WebBridge Integrating real-time bibliographic and circulation information into web pages – Turning Millennium into a web service 2IUG Annette Bailey
Overview 1.Google Book Classes – integrate data from Google Book Search Dynamic Links into web pages 2.tictoclookup – enhance web pages with links to journal RSS feeds 3.MAJAX 2 – use real-time information from the library’s catalog in web pages 3IUG Annette Bailey
Challenges Ease of Integration – should require little or no programming Customizability – should allow for flexible layouts and styling Setup and Hosting – should require minimum effort, exploit either free or already available resources 4IUG Annette Bailey
What’s a web service? Definitions: "a software system designed to support interoperable machine-to-machine interaction over a network." [1] "a computational resource that can be accessed via the world wide web" [2] [1] [2] 5IUG Annette Bailey
Web Service Request: Response: Data encoded in XML or JSON JSON: JavaScript Object Notation Data interchange format that uses JavaScript syntax 6IUG Annette Bailey
GOOGLE BOOK CLASSES Web Services & Widgets IUG Annette Bailey7
Google Book Search Dynamic Links API Programmatic client-side access to small set of Google Book Search information – Provides thumbnails of book covers – Provides link to Google’s book information, preview, or full text pages – Provides information on whether Google has full text, partial preview, or no preview – Indexed by ISBN#, OCLC#, LCCN# Released March 2008 IUG Annette Bailey8
Google Book Search Dynamic Links API Keypoints: – can access it by typing a URL in the browser and see what comes back – response uses JSON IUG Annette Bailey9 process({ "ISBN: ":{ "bib_key": "ISBN: ", "info_url": " "preview_url": " \x26source=gbs_ViewAPI", "thumbnail_url": " \x26img=1\x26zoom=5\x26sig=ACfU3U33uGv6VuVsNAOfq-40BmmP64zdXQ", "preview": "partial", "embeddable": true } });
Widgets Data returned by web services can not be used directly in web pages – Need JavaScript to post-process it Enter Widgets – A snippet of HTML/CSS that controls the post- processing and display of data obtained from a web service – JavaScript remains “under the hood” 10IUG Annette Bailey
Google Book Classes Widget A widget to access Google Book Search Dynamic Links API and integrate results into web pages. Demo 11IUG Annette Bailey
IUG Annette Bailey12
Using Google Book Classes in bib_display.html IUG Annette Bailey13 Preview with Google
Google Book Classes Use or Wrap span in a hyperlink – gbs-link-to-preview – gbs-link-to-info – gbs-link-to-thumbnail Conditionals: only keep span/div if … – gbs-if-noview – gbs-if-partial-or-full – gbs-if-partial – gbs-if-full Thumbnails Image – gbs-thumbnail Embedded viewer – gbs-embed-viewer Remove if Google does not index book – gbs-remove-on-failure Multiple classes can be combined IUG Annette Bailey14 More info at:
Using Google Book Classes in WebBridge Create a new resource in WebBridge IUG Annette Bailey15 <span style="display:none" class="gbs-link-to-preview gbs-if-partial-or-full"> ISBN ISBN: X OCLC OCLC: LCCN LCCN:
GBS Identifiers Alternate syntax: use * as IDENTIFIER ISBN: X IDENTIFIER can refer to ISBN #, OCLC #, or LCCN# IUG Annette Bailey16
Google Book Classes Summary IUG Annette Bailey17 Google Book Classes Web ServiceGoogle Book Search Dynamic Link API books.google.com Hosted ByGoogle, Inc. Data ProvenanceGoogle Additional CostFree, but subject to Google Terms of Service Same Domain RestrictionNo Widgetizationgbsclasses.js: class-based: gbs- Requires JavaScript programmingNo Requires Additional ServerNo Suitable for inclusion on III Bibrecord Display Yes Suitable for WebBridge IntegrationYes
TICTOCLOOKUP SERVICE Web Services & Widgets IUG Annette Bailey18
JISC’s Journal Table of Contents Service JISC released data set for Table of Contents for journals – (ISSN, Journal Title) → RSS Feed URL ticTOC lookup service – Based on JISC data set Lives in Google App Engine (“cloud”) – IUG Annette Bailey19
tictoclookup Service Keypoints: – supports ISSN and optional title – runs on Google servers – stand-alone version available IUG Annette Bailey20 {"lastmod": "Wed Apr 29 05:42: ", "records": [ {"title": "Nature AOP", "rssfeed": " {"title": "Nature", "rssfeed": " ], "issn": " "}
Tictoclookup Widget A widget to access the tictoclookup service and integrate those results into web pages. Demo 21IUG Annette Bailey
IUG Annette Bailey22
Using tictoclookup in bib_display.html IUG Annette Bailey23 ticTOC Click to subscribe to the Table of Contents for this journal.
tictoclookup Classes Use Wrap span in link to RSS Feed – tictoc-link Show tooltip with Table of Contents – tictoc-preview – Uses Google Feeds API – Cluetip JQuery plugin Implemented using JQuery Multiple classes can be combined Append journal title to end of span – tictoc-append-title IUG Annette Bailey24 More info at:
Using tictoclookup Classes in WebBridge Create a new resource in WebBridge IUG Annette Bailey25 <span style="display:none“ class="tictoc-link tictoc-preview tictoc-append-title" Subscribe to Table of Contents for
Summary IUG Annette Bailey26 ticTOC Web ServiceticTOC Cloud Application tictoclookup.appspot.com Hosted ByGoogle, Inc. via Google App Engine Data ProvenanceJISC ( Additional CostGenerous free quota, pay per use beyond that Same Domain RestrictionNo Widgetizationtictoc.js:class-based: tictoc- Requires JavaScript programmingNo Requires Additional ServerNo (if using GAE), else need Apache+mod_wsgi Suitable for inclusion on III Bibrecord DisplayYes Suitable for WebBridge IntegrationYes
MAJAX 2 Web Services & Widgets IUG Annette Bailey27
MAJAX 2 Web Service Millennium Server Request: /isbn/ Response: MARC record in JSON 28IUG Annette Bailey MAJAX Web Service Response: MARC record in HTML Request: /i /1,1,1,E/marc&FF=i
MAJAX 2 Web Service MAJAX 2 is a proxy that connects to the Millennium server – retrieves MARC and up-to-the-minute circulation information and converts it to JSON – written in Python – requires Apache/mod_wsgi – Source code available at: IUG Annette Bailey29
MAJAX 2 Service IUG Annette Bailey30 {"searchterm": "i ", "recordurl": " "results": [ {"holdings": ["DUE "], "locations": ["Newman 2nd Floor"], "marc": … "650": [{"i1": " ", "i2": "0", "sf": {"a": ["African American families."]}}, {"i1": " ", "i2": "0“, "sf": {"a": ["African Americans"], "x": ["Social conditions."]}}, {"i1": " ", "i2": "0", "sf": {"a“: ["Family"], "z": ["United States."]}}] … "245": [{"i1": "0", "i2": "0", "sf": {"a": ["Black families /"], "c": ["Harriette Pipes McAdoo [editor].“]}}] }
MAJAX 2 Widget A widget to access the MAJAX 2 web service and integrate results into web pages. Demo 31IUG Annette Bailey
materials.php?subject=lnl_englit IUG Annette Bailey32
Using MAJAX 2 IUG Annette Bailey33 /* adjust these variables */ var majax2ServiceUrl = " var majax2OpacBase = " ISBN:
MAJAX 2 Classes Use Holdings-related – majax-showholdings – majax-showholdings-brief – majax-showholdings-div – majax-ebook – majax-showholdingslocations Bibliographic Information – majax-marc-???-? – majax-harvard-reference – majax-endnote – majax-endnote-switch – majax-endnote-import Miscellaneous – majax-linktocatalog – majax-space – majax-newline – majax-reportfailure – majax-syndetics-yourclientid Multiple classes can be combined IUG Annette Bailey34 More info at:
MAJAX 1 vs. MAJAX 2 Majax 1Majax 2 Web ServiceScreen Scraping III Record DisplayJSON Proxy for III Record Display Hosted ByExisting Millennium Installation /screens WSGI/Python Script on libx.lib.vt.edu Data ProvenanceYour OPAC Additional CostN/ACan use libx.lib.vt.edu for testing, must run WSGI-enabled web server in production Same Domain RestrictionYesNo Widgetizationmajax.js:class-based: majax- classes Requires JavaScript programming No Requires Additional ServerNoYes (Apache+mod_wsgi) Suitable for inclusion on III Bibrecord Display N/A Suitable for WebBridge Integration Yes IUG Annette Bailey35
Conclusion Presented 3 Web Services and 3 Widgets – Easy to integrate Include tags Place tags where you want the data to display – Customizable Control over where and how data displays through classes – Require minimal resources to setup and host Can use /screens directory, Google or own server IUG Annette Bailey36
Acknowledgments Assistant Professor, Dr. Godmar Back ticTOC is a service from JISC MAJAX user community for inspiration! IUG Annette Bailey37
IUG Annette Bailey38 Majax 1Majax 2Google Book ClassesticTOC Web ServiceScreen Scraping III Record Display JSON Proxy for III Record Display Google Book Search Dynamic Link API books.google.com ticTOC Cloud Application tictoclookup.appspot.c om Hosted ByExisting Millennium Installation /screens WSGI/Python Script on libx.lib.vt.edu Google, Inc.Google, Inc. via Google App Engine Data ProvenanceYour OPAC GoogleJISC ( Additional CostN/ACan use libx.lib.vt.edu for testing, must run WSGI-enabled web server in production Free, but subject to Google Terms of Service Generous free quota, pay per use beyond that Same Domain Restriction YesNo Widgetizationmajax.js: class-based: majax- classesgbsclasses.js:class-based: gbs- tictoc.js:class-based: tictoc- Requires JavaScript programming No Requires Additional Server NoYes (Apache+mod_wsgi) NoNo (if using GAE), else need Apache+mod_wsgi III Bibrecord DisplayN/A Yes WebBridge Integration Yes