Ignore:
Timestamp:
2010-03-03T14:59:22+13:00 (14 years ago)
Author:
kjdon
Message:

adding code to provide a URL in a dc.identifier field to link to the document. half finished

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/oaiservr/metaformat.cpp

    r21605 r21761  
    3939}
    4040
     41bool metaformat::output_custom_metadata(ostream &output, outconvertclass &outconvert, bool &headerDone, const text_t &collection, ResultDocInfo_t &docInfo) {
     42  return false;
     43}
    4144bool metaformat::scan_metadata(ostream &output, const text_t &collection, ResultDocInfo_t &docInfo,
    4245                   bool doOutput)
     
    7073    text_t mapTo = this->get_mapping(collection, here->first);
    7174    if (mapTo != "") {
    72       // Do we actually want to do anything here? Doesn't getting here imply that this
    73       // particular metadata is stuff we don't want?
    7475      if (doOutput) {
    7576    if (this->is_valid_element(mapTo)) {
     
    8586
    8687    // Otherwise try to map the element automatically
    87     // For example, dc.X is mapped to oai_dc.X (doesn't check X is a valid Dublin Core element though)
     88    // For example, dc.X is mapped to oai_dc.X
    8889    else if (metaItem == this->formatPrefix()) {
    8990      metaItem = substr(last+1, here->first.end()); // Get the rest of the metadata tag (it's name) but without the '.'
     
    117118    return false;
    118119  }
    119  
     120  // specific metadata formats might need to do some custom metadata that is not just a standard mapping. eg oai_dc outputting an identifier that is a link
     121  this->output_custom_metadata(output, utf8convert, headerDone, collection, docInfo);
    120122  if (headerDone) {
     123
    121124    this->output_metadata_footer(output);
    122125  }
     
    125128}
    126129
     130text_t metaformat::get_metadata_value(ResultDocInfo_t &docInfo, const text_t &meta_name) {
     131  MetadataInfo_tmap::iterator here = docInfo.metadata.find(meta_name);
     132  if (here == docInfo.metadata.end()) {
     133    return "";
     134  }
     135  return here->second.values[0];
     136 
     137}
     138
     139void metaformat::get_metadata_values(ResultDocInfo_t &docInfo, const text_t &meta_name, text_tarray &values) {
     140  MetadataInfo_tmap::iterator here = docInfo.metadata.find(meta_name);
     141  if (here != docInfo.metadata.end()) {
     142    values = here->second.values;
     143  }
     144}
    127145
    128146bool metaformat::is_available(const text_t &collection, ResultDocInfo_t &docInfo)
Note: See TracChangeset for help on using the changeset viewer.