Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
dev:exposing_metadata:coins [2011/04/15 13:15] – created rmzelledev:exposing_metadata:coins [2020/06/14 13:18] (current) bwiernik
Line 1: Line 1:
-====== OpenURL COinS ======+====== Using Zotero to create COinS metadata ======
  
-===== What OpenURL is ===== 
  
-An OpenURL is a specially formatted URL containing bibliographic information.  It allows you to link to a specialized search engine, called a resolver, at a library.  The resolver gathers information from the OpenURL, then searches the library's resources to find out whether or not the library has a copy of that document available.  The resolver, which is most commonly provided by [[http://www.exlibrisgroup.com/sfx.htm|Ex Libris' SFX]] software, searches not just the catalog, but also the library's proprietary database subscriptions.  Then it presents the user with the results:+===== Introduction =====
  
-  * If the document is available electronicallythey get a link. +Although the [[http://scholar.google.com/intl/en/scholar/inclusion.html|Google/Highwire key-value system]] is generally preferred for embedding bibliographic metadata into a webpageanother possible format is COinSZotero can [[https://www.zotero.org/support/adding_items_to_zotero#via_your_web_browser|automatically import COinS metadata from website]].
-  * If the document is available in the stacks, they get a call number. +
-  * If the document is not available, they get "sorry" message and maybe a link to Inter-Library Loan services.+
  
-OpenURL is also known as Z39.88 after the name of [[http://www.niso.org/kst/reports/standards?step=2&gid=&project_key=d5320409c5160be4697dc046613f71b9a773cd9e +COinS is an abbreviation for "[[http://ocoins.info/|ContextObjects in Spans]]". Spans in this context refers to the html tag <span></span>. Spans allow you to add the bibliographic metadata to your webpage without it being visible to people browsing the page.
-|the formal standard]] established by the National Information Standards Organization.+
  
-OpenURL systems are fairly expensive to create and maintainand so they are not very widespread yet.  Many universities have them, and few large public libraries.+The format of COinS is relatively simplebut creating them by hand is difficult because certain characters need to be converted to URL format. For example, a space character needs to be represented by '%20'.
  
-===== What COinS are ====+Example COinS code is shown below: 
- +<code html> 
-"COinS" stands for "ContextObject in Span. "ContextObject" is OpenURL jargon for the part of an OpenURL carrying the bibliographic information basically, it's a query string, everything that would follow the ? in a regular URL And "span" refers here to the HTML tag <span> It's the ContextObject that carries the bibliographic information. +<span class='Z3988' title='url_ver=Z39.88-2004&amp;ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=article&amp;rft.atitle=Thelymitra%20epipactoides%20F.%20Muell.%20(Orchidaceae)%3A%20The%20morphology%2C%20biology%20and%20conservation%20of%20an%20endangered%20species&amp;rft.jtitle=Proceedings%20of%20the%20Royal%20Society%20of%20Victoria&amp;rft.volume=101&amp;rft.aufirst=S.%20C.&amp;rft.aulast=Cropper&amp;rft.au=S.%20C.%20Cropper&amp;rft.au=D.%20M.%20Calder&amp;rft.au=D.%20Tonkinson&amp;rft.date=1989&amp;rft.pages=89-101&amp;rft.spage=89&amp;rft.epage=101'></span> 
- +<span class='Z3988title='url_ver=Z39.88-2004&amp;ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;rft_id=urn%3Aisbn%3A0%207306%202243%206&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=A%20census%20of%20Victorian%20bryophytes&amp;rft.place=East%20Melbourne&amp;rft.publisher=The%20Department%20of%20Conservation%20and%20Environment&amp;rft.aufirst=S.%20C.&amp;rft.aulast=Cropper&amp;rft.au=S.%20C.%20Cropper&amp;rft.au=D.%20A.%20Tonkinson&amp;rft.au=G.%20A.%20M.%20Scott&amp;rft.date=1991&amp;rft.tpages=56&amp;rft.isbn=0%207306%202243%206'></span> 
-The ContextObject is very flexible, and can carry everything from a simple title and author to more obscure things like a Serial Item and Contribution Identifier (SICI). +<span class='Z3988title='url_ver=Z39.88-2004&amp;ctx_ver=Z39.88-2004&amp;rfr_id=info%3Asid%2Fzotero.org%3A2&amp;rft_id=urn%3Aisbn%3A0%20643%2005533%209&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=Management%20of%20endangered%20plants&amp;rft.place=East%20Melbourne&amp;rft.publisher=CSIRO%20Publishing&amp;rft.aufirst=S.%20C.&amp;rft.aulast=Cropper&amp;rft.au=S.%20C.%20Cropper&amp;rft.date=1993&amp;rft.tpages=182&amp;rft.isbn=0%20643%2005533%209'></span>
- +
-The upshot of which is that if you stick COinS in your web page, Zotero can pull all that data out again. +
- +
-===== Constructing COinS ====+
- +
-The basic structure of a COinS reference consists of a span tag of the class "Z3988" and a title attribute with the ContextObject in it Here's what a simple one looks like: +
- +
-<span class="Z3988title="__**ContextObject goes here**__"></span> +
- +
-Let's look at the ContextObject: +
- +
-  **ctx_ver=Z39.88-2004** specifies the version of the OpenURL standard we're using. +
-  - **&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook** says that the document is a book. +
-  - **&amp;rft.btitle=The+Wind+in+the+Willows** is the title of the book. +
-  - **&amp;rft.au=Grahame,+Kenneth** is the author of the book. +
- +
-Putting all of those values on one line in the title attribute makes it a COinS reference Here's a complete version: +
- +
-<code><span class="Z3988title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.btitle=The+Wind+in+the+Willows&amp;rft.au=Grahame,+Kenneth"></span>+
 </code> </code>
  
-Apologies for the sideways scrolling.+Zotero can automatically create COinS from items in your library. Select the items in Zotero, right click, and choose "Export Items…". Then choose COinS from the dropdown menu. Open the exported file to see the COinS metadata. Copy and paste this code into your web page editor.
  
-There are a great many different fields you can use in COinS references For a more complete reference, please see [[http://ocoins.info/|OpenURL COinS: A Convention to Embed Bibliographic Metadata in HTML]], especially the two "brief guidesections listed in the table of contents.+You can also set Zotero to use COinS as your default "Quick Copy" export formatOpen the [[preferences:export|Export]] pane of Zotero preferences and select "COinSas the Default Format. Then, you can drag and drop items from your library to your web page editor to insert COinS code. You can also copy COinS to your clipboad by pressing Ctrl/Cmd-Shift-C.
  
-===== Appendix: a PHP function for making COinS ===== 
  
-Here is a brief function I worked out for making COinS references.  I hereby consign it to the public domain - take it, use it, modify it, print it out and sleep on it, whatever.  Read the comments before the function begins for complete documentation.  You'll need to modify it to suit your own project. +{{tag>kb}}
- +
-<code php><?php +
-/* +
-OpenURL() constructs an NISO Z39.88 compliant ContextObject for use in OpenURL links and COinS.  It returns  +
-the proper query string, which you must embed in a <span></span> thus: +
- +
-<span class="Z3988" title="<?php print OpenURL($Document, $People) ?>">Content of your choice goes here</span> +
- +
-This span will work with Zotero. You can also use the output of OpenURL() to link to your library's OpenURL resolver, thus: +
- +
-<a href="http://www.lib.utexas.edu:9003/sfx_local?<?php print OpenURL($Document, $People); ?>" title="Search for a copy of this document in UT's libraries">Find it at UT!</a> +
- +
-Replace "http://www.lib.utexas.edu:9003/sfx_local?" with the correct resolver for your library. +
- +
-OpenURL() takes two arguments. +
- +
-$Document - a document object, having an array (fields) with the following properties: +
- $Document->fields["DocType"+
- 1 = Article +
- 2 = Book Item (e.g. a chapter, section, etc) +
- 3 = Book +
- 4 = Unpublished MA thesis +
- 5 = Unpublished PhD thesis +
- +
- $Document->fields["DocTitle"] - Title of the document. +
- $Document->fields["JournalTitle"] - Title of the journal/magazine the article was published in, or false if this is not an article. +
- +
- $Document->fields["BookTitle"] - Title of the book in which this item was published, or false if this is not a book item. +
- +
- $Document->fields["Volume"] - The volume of the journal this article was published in as an integer, or false if this is not an article.  Optional. +
- $Document->fields["JournalIssue"] - The issue of the journal this article was published in as an integer, or false if this is not an article.  Optional. +
- $Document->fields["JournalSeason"] Optional. +
- The season of the journal this article was published in, as a string, where: +
- Spring +
- Summer +
- Fall +
- Winter +
- false = not applicable +
- $Document->fields["JournalQuarter"] - The quarter of the journal this article was published in as an integer between 1 and 4, or false. Optional. +
- $Document->fields["ISSN"] - The volume of the journal this article was published in, or false.  Optional. +
- +
- +
- $Document->fields["BookPublisher"] - The publisher of the book, or false. Optional. +
- $Document->fields["PubPlace"] - The publication place, or false.  Optional. +
- $Document->fields["ISBN"] - The ISBN of the book.  Optional but highly recommended. +
- +
- $Document->fields["StartPage"] - Start page for the article or item, or false if this is a complete book. +
- $Document->fields["EndPage"] - End page for the article or item, or false if this is a complete book. +
- +
-$Document->fields["DocYear"] - The year in which this document was published. +
- +
-$People - An array of person objects, each having an array, fields, with these properties: +
- $People->fields["DocRelationship"+
- An integer indicating what kind of relationship the person has to this document. +
- 0 = author +
- 1 = editor +
- 2 = translator +
- $People->fields["FirstName"] - The person's first name. +
- $People->fields["LastName"] - The person's last name. +
-*/ +
-function OpenURL($Document, $People){ +
- $DocType = $Document->fields["DocType"]; +
- if($DocType > 2)return false; } +
- +
- // Base of the OpenURL specifying which version of the standard we're using. +
- $URL = "ctx_ver=Z39.88-2004"; +
- +
- // Metadata format - e.g. article or book. +
- if($DocType == 0){ $URL .= "&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal";+
- if($DocType 0){ $URL .= "&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook"; } +
- +
- // An ID for your application.  Replace yoursite.com and specify a name for your application. +
- $URL .= "&amp;rfr_id=info%3Asid%2Fyoursite.com%3AYour+Name+Here+Using+Plus+Signs+For+Spaces"; +
- +
- // Document Genre +
- if($DocType == 0){ $URL .= "&amp;rft.genre=article"; } +
- if($DocType == 1){ $URL .= "&amp;rft.genre=bookitem";+
- if($DocType == 2){ $URL .= "&amp;rft.genre=book";+
- +
- // Document Title +
- if($DocType < 2){ $URL .= "&amp;rft.atitle=".urlencode($Document->fields["DocTitle"]);+
- if($DocType == 2){ $URL .= "&amp;rft.btitle=".urlencode($Document->fields["DocTitle"]);+
- +
- // Publication Title +
- if($DocType == 0){ $URL .= "&amp;rft.jtitle=".urlencode($Document->fields["JournalTitle"]);+
- if($DocType == 1){ $URL .= "&amp;rft.btitle=".urlencode($Document->fields["BookTitle"]);+
- +
- // Volume, Issue, Season, Quarter, and ISSN (for journals) +
- if($DocType == 0){ +
- if($Document->fields["Volume"]){ $URL .= "&amp;rft.volume=".urlencode($Document->fields["Volume"]);+
- if($Document->fields["JournalIssue"]){ $URL .= "&amp;rft.issue=".urlencode($Document->fields["JournalIssue"]);+
- if($Document->fields["JournalSeason"]){ $URL .= "&amp;rft.ssn=".urlencode($Document->fields["JournalSeason"]);+
- if($Document->fields["JournalQuarter"]){ $URL .= "&amp;rft.quarter=".urlencode($Document->fields["JournalQuarter"]);+
- if($Document->fields["JournalQuarter"]){ $URL .= "&amp;rft.quarter=".urlencode($Document->fields["ISSN"]);+
-+
- +
- // Publisher, Publication Place, and ISBN (for books) +
- if($DocType > 0){ +
- $URL .= "&amp;rft.pub=".urlencode($Document->fields["BookPublisher"]); +
- $URL .= "&amp;rft.place=".urlencode($Document->fields["PubPlace"]); +
- $URL .= "&amp;rft.isbn=".urlencode($Document->fields["ISBN"]); +
-+
- +
- // Start page and end page (for journals and book articles) +
- if($DocType < 2){ +
- $URL .= "&amp;rft.spage=".urlencode($Document->fields["StartPage"]); +
- $URL .= "&amp;rft.epage=".urlencode($Document->fields["EndPage"]); +
-+
- +
- // Publication year. +
- $URL .= "&amp;rft.date=".$Document->fields["DocYear"]; +
- +
- // Authors +
- $i = 0; +
- while($People[$i]){ +
- if($People[$i]->fields["DocRelationship"] == 0){ +
- $URL .= "&amp;rft.au=".urlencode($People[$i]->fields["LastName"]).",+".urlencode($People[$i]->fields["FirstName"]); +
-+
- $i++; +
-+
- +
- return $URL; +
-+
-?> +
- +
-</code>+
dev/exposing_metadata/coins.1302887742.txt.gz · Last modified: 2011/04/15 13:15 by rmzelle