About Features Downloads Getting Started Documentation Events Support GitHub

Love VuFind®? Consider becoming a financial supporter. Your support helps build a better VuFind®!

Site Tools


Warning: This page has not been updated in over over a year and may be outdated or deprecated.
legacy:vufind_1.x_developer_manual:supporting_a_new_metadata_format

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
other_than_marc [2009/08/31 14:36] – Added getCOinS method. demiankatzlegacy:vufind_1.x_developer_manual:supporting_a_new_metadata_format [2018/12/19 14:02] (current) demiankatz
Line 1: Line 1:
-====== Support for other record formats ======+====== Support for New Record Formats ======
  
-===== Problem ===== +// This outdated page has been deleted to prevent confusion; for current documentationsee [[development:howtos:supporting_a_new_metadata_format|this page]]. To view old content for historical interest, see the “Old Revisions” list below. //
- +
-VuFind currently is tightly bound to MARCish record formats. The standard indexer ([[http://code.google.com/p/solrmarc/|solrmarc]]) handles MARCish records fast and efficently, but there is no support for other record formats at the moment. Even if writing an appropriate indexer for other formats (which isn't so hard, as long as it doesn't need to meet the quality of solrmarc), the "full record"/"details" view in VuFind still depends on a MARC record to show record data. +
- +
-===== Solutions ===== +
- +
- +
-==== Indexer ==== +
-Indexing is not an integrated part of VuFind. For indexing MARCish records, [[http://code.google.com/p/solrmarc/|solrmarc]] is distributed with VuFind. For other record formats one needs different custom indexers. That's out of the scope of this document (and the VuFind project, isn't it?), so only general hints on how to create such an indexer are given here: +
- +
-Writing a custom indexer for other record formats may be done in almost any programming language. Steps to be done: +
-  * parse record format +
-  * map format entities to Solr index fields +
-  * create XMLish document out of these fields +
-  * POST document to Solr's update handler (FYI: it doesn't have to be a POST per seyou can use SOLR/Lucene APIs to add documents directly to the index which is much faster) +
- +
- +
- +
- +
-==== Record display ==== +
-Currently full record display in VuFind is done by pulling a MARC record out of Solr index field fullrecord. The content to display is then taken out of MARC fields (e.g. 245$a as title...). +
- +
-There has been [[http://www.nabble.com/other-data-sources-for-the-index-to23867424.html|some discussion on the vufind-tech mailing]] list how to support other record formatswith a [[http://www.nabble.com/Re%3A-Using-a-defined-format-for-display-instead-of-MARC-p23930906.html|result]]. +
- +
-So the idea is: +
- +
-when indexing: +
-  * index whatever you want by mapping it to the index schema +
-  * put the original record into the "fullrecord" field in Solr as is (or somewhere else, may even be a flat file in the file system, because that one won't be searchable anyway, will it?) +
-  * put an "identifier" for the record format into an index field for that purpose lets call it recordtype +
- +
-when displaying: +
-  * when a record is retrieved for display, look at recordtype +
-  * call a class appropriate for handling that format +
-  * that class may fetch the full record and render it +
-  * if no special class for a record format exists, take a fallback generic class, that renders a view out of the stored Solr index fields +
- +
- +
- +
- +
- +
-===== Implementation ===== +
-Currently services/Record/Record.php implements the Object Record that parses MARC records, then applies them to interfaces/theme/[theme]/Record/view.tpl for display. Different childs of that Record object are created when the different full title views (Holdings, Details, Reviews, ...) are called. Record implements some methods for adding external data from WorldCat and a constructor that does the MARC parsing. +
- +
-One way to implement handling of other record formats would be by implementing a new family of "Record Driver" classes that extract information from the stored Solr fields and return it through a standard interface.  The top-level parent Record Driver (let's call it the default Record Driver) could rely entirely on the Solr index fields, but children of this class could override and expand methods by using record-specific data extracted from the "fullrecord" field.  When record information is needed (by the current Record constructor or by other areas of code that currently extract MARC data directly), a Record Driver could be instantiated based on the "recordtype" field from Solr (using the default Record Driver if no type-specific driver exists). +
- +
-General "data enrichment services" (like the WorldCat Calls, and calls to extract tags and such from the MySQL database) may be moved to the default Record Driver and inherited by its children. +
- +
-==== Integration with Templates ==== +
- +
-The current view.tpl used by the Record module includes basic record details along with export options, clickable tabs and other framing details.  It uses a sub-template mechanism to fill in the contents of the tabbed area. +
- +
-For greater flexibility, this sub-template mechanism should be extended.  Many methods of the Record Driver interface will assign values to Smarty and then return the name of a template that can display the assigned values.  In some cases, this template can be displayed by itself, but in most cases, it will actually be assigned to Smarty and included as another sub-template. +
- +
- +
- +
- +
- +
- +
- +
-==== Driver API Specification ==== +
- +
-This is the interface that must be implemented by all Record Driver classes: +
- +
-<code php> +
-/** +
- * Record Driver Class +
- * +
- * This interface class is the definition of the required methods for  +
- * interacting with a particular metadata record format. +
- */ +
-interface RecordInterface +
-+
-    /** +
-     * Constructor.  We build the object using all the data retrieved  +
-     * from the (Solr) index (which also happens to include the  +
-     * 'fullrecord' field containing raw metadata).  Since we have to  +
-     * make a search call to find out which record driver to construct,  +
-     * we will already have this data available, so we might as well  +
-     * just pass it into the constructor. +
-     * +
-     * @param   array   $indexFields    All fields retrieved from the index. +
-     * @access  public +
-     */ +
-    public function __construct($indexFields); +
-     +
-    /** +
-     * Get text that can be displayed to represent this record in  +
-     * breadcrumbs. +
-     * +
-     * @access  public +
-     * @return  string              Breadcrumb text to represent this record. +
-     */ +
-    public function getBreadcrumb(); +
- +
-    /** +
-     * Assign necessary Smarty variables and return a template name  +
-     * to load in order to display the requested citation format.   +
-     * For legal values, see getCitationFormats().  Returns null if  +
-     * format is not supported. +
-     * +
-     * @param   string  $format     Citation format to display. +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getCitation($format); +
- +
-    /** +
-     * Get an array of strings representing citation formats supported  +
-     * by this record's data (empty if none).  Legal values: "APA", "MLA"+
-     * +
-     * @access  public +
-     * @return  array               Strings representing citation formats. +
-     */ +
-    public function getCitationFormats(); +
- +
-    /** +
-     * Get the value for the title attribute of a COinS span tag. +
-     * +
-     * @access  public +
-     * @return  string              COinS title value. +
-     */ +
-    public function getCOinS(); +
-          +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display user comments on the current record. +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getComments(); +
-         +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display core metadata (the details shown in the  +
-     * top portion of the record view pages, above the tabs). +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getCoreMetadata(); +
-         +
-    /** +
-     * Get an array of search results for other editions of the title  +
-     * represented by this record (empty if unavailable).  In most cases,  +
-     * this will use the XISSN/XISBN logic to find matches. +
-     * +
-     * @access  public +
-     * @return  array               Editions in index engine result format. +
-     */ +
-    public function getEditions(); +
-     +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to export the record in the requested format.  For  +
-     * legal values, see getExportFormats().  Returns null if format is  +
-     * not supported. +
-     * +
-     * @param   string  $format     Export format to display. +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getExport($format); +
- +
-    /** +
-     * Get an array of strings representing formats in which this record's  +
-     * data may be exported (empty if none).  Legal values: "Refworks",  +
-     * "Endnote", "Zoteo"+
-     * +
-     * @access  public +
-     * @return  array               Strings representing export formats. +
-     */ +
-    public function getExportFormats(); +
-     +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display extended metadata (more details beyond  +
-     * what is found in getCoreMetadata() -- used as the contents of the  +
-     * Description tab of the record view). +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getExtendedMetadata(); +
-     +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display holdings extracted from the base record  +
-     * (i.e. URLs in MARC 856 fields).  This is designed to supplement,  +
-     * not replace, holdings information extracted through the ILS driver   +
-     * and displayed in the Holdings tab of the record view page.  Returns  +
-     * null if no data is available. +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getHoldings(); +
-         +
-    /** +
-     * Get an array of User_list objects belonging to the current user in  +
-     * which this record is saved.  Returns an empty array if no such lists  +
-     * exist. +
-     * +
-     * @access  public +
-     * @return  array               Lists containing the current record. +
-     */ +
-    public function getLists(); +
-     +
-    /** +
-     * Get an array of search results for other items similar to this record +
-     * (empty if none). +
-     * +
-     * @access  public +
-     * @return  array               Editions in index engine result format. +
-     */ +
-    public function getMoreLikeThis(); +
-     +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display the full record information on the Staff  +
-     * View tab of the record view page. +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getStaffView(); +
-         +
-    /** +
-     * Return an array of Tags objects associated with the current record. +
-     * +
-     * @access  public +
-     * @return  array               Tags associated with the current record. +
-     */ +
-    public function getTags(); +
-         +
-    /** +
-     * Assign necessary Smarty variables and return a template name to  +
-     * load in order to display the Table of Contents extracted from the  +
-     * record.  Returns null if no Table of Contents is available. +
-     * +
-     * @access  public +
-     * @return  string              Name of Smarty template file to display. +
-     */ +
-    public function getTOC(); +
-         +
-    /** +
-     * Does this record have audio content available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasAudio(); +
-     +
-    /** +
-     * Does this record have an excerpt available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasExcerpt(); +
-     +
-    /** +
-     * Does this record have searchable full text in the index? +
-     * +
-     * Note: As of this writing, searchable full text is not a VuFind feature, +
-           but this method will be useful if/when it is eventually added. +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasFullText(); +
-     +
-    /** +
-     * Does this record have image content available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasImages(); +
-     +
-    /** +
-     * Does this record have reviews available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasReviews(); +
-     +
-    /** +
-     * Does this record have a Table of Contents available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasTOC(); +
-     +
-    /** +
-     * Does this record have video content available? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function hasVideo(); +
-     +
-    /** +
-     * Is the current record saved in a list by the current user? +
-     * +
-     * @access  public +
-     * @return  bool +
-     */ +
-    public function isSaved(); +
-+
-</code> +
- +
-Record Driver naming conventions: +
- +
-  * Filename: web/RecordDrivers/[record type]Record.php (i.e. web/RecordDrivers/MarcRecord.php) +
-  * Default Filename (if no match was found for [record type]Record.php): web/RecordDrivers/DefaultRecord.php +
-  * Class name: same as the filename -- [record type]Record (i.e. MarcRecord, DefaultRecord, etc.) +
-  * Config file: web/conf/[record type]Record.ini (i.e. MarcRecord.ini, DefaultRecord.ini) -- not sure yet if it will be necessary to have configuration options for record drivers, but it certainly might be. +
- +
-==== Notes ==== +
- +
-  * The public record driver interface is intentionally very abstract -- we want to be able to support records of all kinds, and we don't want to make any assumptions about the structure of the records. +
-  * In spite of the generic interface, it is often useful to have very structured methods (getTitle, getAuthor, etc.).  These should be implemented as protected methods in the default Record Driver.  They are useful within the driver itself, but should never be accessed from the outside -- the interface between the record and the presentation layer must remain abstract to ensure future flexibility.  However, there is nothing wrong with taking advantage of structure within the record driver hierarchy to make implementation of similar record formats easier. +
-  * A lot of discussion has been deleted to reduce clutter on the page now that our ideas seem to be taking firmer shape.  No offense to any of the past contributors is intended -- please look at the old revisions if you are interested in seeing previous comments, especially if you see flaws in what is here now and think old ideas and comments need to be brought back.+
 ---- struct data ---- ---- struct data ----
 +properties.Page Owner : 
 ---- ----
  
legacy/vufind_1.x_developer_manual/supporting_a_new_metadata_format.1251729411.txt.gz · Last modified: 2014/06/13 13:13 (external edit)