def to_openurl      
      # If we have a pre-constructed KEV, just use it. 
      if result_item.openurl_kev_co
        return OpenURL::ContextObject.new_from_kev( result_item.openurl_kev_co )
      end
      
      
      context_object = OpenURL::ContextObject.new
      
      r = context_object.referent
      
      r.set_format( self.format )
      
      if result_item.doi
        r.add_identifier("info:doi/#{result_item.doi}")
      end

      if result_item.pmid
        r.add_identifier("info:pmid/#{result_item.pmid}")
      end
      
      if result_item.oclcnum
        r.add_identifier("info:oclcnum/#{result_item.oclcnum}")
        # and do the one that's not actually legal practice, but is common
        r.set_metadata("oclcnum", result_item.oclcnum)
      end
      
      r.set_metadata("genre", self.genre)
      
      if result_item.authors.length > 0
        r.set_metadata("aufirst", ensure_no_tags(result_item.authors.first.first))
        r.set_metadata("aulast", ensure_no_tags(result_item.authors.first.last))
        r.set_metadata("au", result_item.author_display(ensure_no_tags result_item.authors.first))
      end

      if result_item.publication_date
        r.set_metadata("date", result_item.publication_date.iso8601)
      else
        r.set_metadata("date",    result_item.year.to_s)
      end
      
      
      r.set_metadata("volume",  result_item.volume.to_s)
      r.set_metadata("issue",   result_item.issue.to_s)
      r.set_metadata("spage",   result_item.start_page.to_s)
      r.set_metadata("epage",   result_item.end_page.to_s)
      r.set_metadata("jtitle",  ensure_no_tags(result_item.source_title))
      r.set_metadata("issn",    result_item.issn)
      r.set_metadata("isbn",    result_item.isbn)
      r.set_metadata("pub",     ensure_no_tags(result_item.publisher))
      
      
      case result_item.format
      when "Book"
        r.set_metadata("btitle", ensure_no_tags(result_item.complete_title))
      when :book_item         
        r.set_metadata("btitle", result_item.source_title)
        r.set_metadata("atitle", result_item.title)                  
      when "Article", :conference_paper
        r.set_metadata("atitle", ensure_no_tags(result_item.complete_title))
      else
        r.set_metadata("title", ensure_no_tags(result_item.complete_title))
      end
      
      return context_object
    end
def to_openurl      
      # If we have a pre-constructed KEV, just use it. 
      if result_item.openurl_kev_co
        return OpenURL::ContextObject.new_from_kev( result_item.openurl_kev_co )
      end
      
      
      context_object = OpenURL::ContextObject.new
      
      r = context_object.referent
      
      r.set_format( self.format )
      
      if result_item.doi
        r.add_identifier("info:doi/#{result_item.doi}")
      end

      if result_item.pmid
        r.add_identifier("info:pmid/#{result_item.pmid}")
      end
      
      if result_item.oclcnum
        r.add_identifier("info:oclcnum/#{result_item.oclcnum}")
        # and do the one that's not actually legal practice, but is common
        r.set_metadata("oclcnum", result_item.oclcnum)
      end
      
      r.set_metadata("genre", self.genre)
      
      if result_item.authors.length > 0
        r.set_metadata("aufirst", ensure_no_tags(result_item.authors.first.first))
        r.set_metadata("aulast", ensure_no_tags(result_item.authors.first.last))
        r.set_metadata("au", result_item.author_display(ensure_no_tags result_item.authors.first))
      end

      if result_item.publication_date
        r.set_metadata("date", result_item.publication_date.iso8601)
      else
        r.set_metadata("date",    result_item.year.to_s)
      end
      
      
      r.set_metadata("volume",  result_item.volume.to_s)
      r.set_metadata("issue",   result_item.issue.to_s)
      r.set_metadata("spage",   result_item.start_page.to_s)
      r.set_metadata("epage",   result_item.end_page.to_s)
      r.set_metadata("jtitle",  ensure_no_tags(result_item.source_title))
      r.set_metadata("issn",    result_item.issn)
      r.set_metadata("isbn",    result_item.isbn)
      r.set_metadata("pub",     ensure_no_tags(result_item.publisher))
      
      
      case result_item.format
      when "Book"
        r.set_metadata("btitle", ensure_no_tags(result_item.complete_title))
      when :book_item         
        r.set_metadata("btitle", result_item.source_title)
        r.set_metadata("atitle", result_item.title)                  
      when "Article", :conference_paper
        r.set_metadata("atitle", ensure_no_tags(result_item.complete_title))
      else
        r.set_metadata("title", ensure_no_tags(result_item.complete_title))
      end
      
      return context_object
    end
Pass in a DECORATED result_item, eg StandardDecorator.new(result_item, nil)
 Need the display logic methods in the decorator, not just a raw
 result_item.