/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { string subject_text = String.Empty; string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_text") == 0) { subject_text = HttpContext.Current.Request.Form[thisKey]; } if (thisKey.IndexOf(html_element_name.Replace("_", "") + "_select") == 0) { string subject_type = HttpContext.Current.Request.Form[thisKey]; Subject_Info_Standard standardSubject = new Subject_Info_Standard {Authority = "fast"}; if (subject_text.Trim().Length > 0) { switch (subject_type) { case "genre": standardSubject.Add_Genre( subject_type ); break; case "geographic": standardSubject.Add_Geographic( subject_type ); break; case "occupational": standardSubject.Add_Occupation( subject_type ); break; case "temporal": standardSubject.Add_Temporal( subject_type ); break; case "topic": standardSubject.Add_Topic( subject_type ); break; } if ((standardSubject.Topics_Count > 0) || (standardSubject.Genres_Count > 0) || (standardSubject.Geographics_Count > 0) || (standardSubject.Occupations_Count > 0) || (standardSubject.Temporals_Count > 0)) Bib.Bib_Info.Add_Subject(standardSubject); } subject_text = String.Empty; } } }
private void split_add_subjects(SobekCM_Item Package, string Data ) { if (Data.IndexOf("--") < 0) Package.Bib_Info.Add_Subject(new Subject_Info_Standard(Data, null)); else { Subject_Info_Standard subject = new Subject_Info_Standard(); string[] splitter = Data.Split("-".ToCharArray()); foreach (string thisSplit in splitter) { if (thisSplit.Length == 0) continue; string tsl = thisSplit.ToLower().Trim(); // Was this geographic? if ((tsl.IndexOf("county") >= 0) || (tsl.IndexOf("(nev.)") > 0) || (tsl.IndexOf("henderson") >= 0) || (tsl.IndexOf("nevada") >= 0) || (tsl.IndexOf("las vegas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("los angeles") >= 0) || (tsl.IndexOf("(calif.)") >= 0) || (tsl.IndexOf("russia") >= 0) || (tsl.IndexOf("lake mead") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("united states") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("el paso") >= 0) || (tsl.IndexOf("texas") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || (tsl.IndexOf("boulder city") >= 0) || (tsl.IndexOf("pittman") >= 0) || (tsl.IndexOf("gabbs") >= 0) || (tsl.IndexOf("california") >= 0) || (tsl.IndexOf("colorado") >= 0) || (tsl.IndexOf("reno") >= 0) || (tsl.IndexOf("(ariz.)") >= 0) || ( tsl == "japan")) subject.Add_Geographic(thisSplit.Trim().Replace("\"","")); // Was this temporal? else if ((tsl.IndexOf("20th century") >= 0) || (tsl.IndexOf("war, 19") >= 0)) subject.Add_Temporal(thisSplit.Trim()); else if (tsl.IndexOf("maps, topographic") >= 0) subject.Add_Genre(thisSplit.Trim()); else subject.Add_Topic(thisSplit.Trim()); } Package.Bib_Info.Add_Subject(subject); } }
/// <summary> Gets the collection of MARC tags to be written for this digital resource </summary> /// <param name="CatalogingSourceCode"> Cataloging source code for the 040 field, ( for example FUG for University of Florida ) </param> /// <param name="LocationCode"> Location code for the 852 |a - if none is given the system abbreviation will be used. Otherwise, the system abbreviation will be put in the 852 |b field. </param> /// <param name="ReproductionAgency"> Agency responsible for reproduction, or primary agency associated with the SobekCM instance ( for the added 533 |c field ) </param> /// <param name="ReproductionPlace"> Place of reproduction, or primary location associated with the SobekCM instance ( for the added 533 |b field ) </param> /// <param name="SystemName"> Name used for this SobekCM (or otherwise) digital repository system </param> /// <param name="SystemAbbreviation"> Abbrevation used for this SobekCM (or otherwise) digital repository system </param> /// <param name="ThumbnailBase"> Base URL for the thumbnail to be included</param> /// <returns> Collection of MARC tags to be written for this digital resource </returns> public MARC_Record To_MARC_Record(string CatalogingSourceCode, string LocationCode, string ReproductionAgency, string ReproductionPlace, string SystemName, string SystemAbbreviation, string ThumbnailBase ) { // Find the first aggregation name string first_aggr_name = String.Empty; if (Behaviors.Aggregation_Count > 0) { foreach (Aggregation_Info thisAggr in Behaviors.Aggregations) { if (( String.Compare(thisAggr.Code, "ALL", true) != 0 ) && (( String.IsNullOrEmpty(thisAggr.Type)) || (thisAggr.Type.IndexOf("INSTITUT", StringComparison.InvariantCultureIgnoreCase) < 0))) { first_aggr_name = thisAggr.Name; break; } } } // Create the sorted list MARC_Record tags = new MARC_Record(); // Compute the sobekcm type, which will be used for some of these mappings TypeOfResource_SobekCM_Enum sobekcm_type = BIBInfo.SobekCM_Type; // Build a hashtable of all the pertinent genres Dictionary<string, string> genreHash = new Dictionary<string, string>(); if (Bib_Info.Genres_Count > 0) { foreach (Genre_Info thisGenre in Bib_Info.Genres) { if ((thisGenre.Authority == "marcgt") || (thisGenre.Authority == "sobekcm")) { genreHash[thisGenre.Genre_Term] = thisGenre.Genre_Term; } } } // ADD THE 006 FOR ONLINE MATERIAL StringBuilder bldr006 = new StringBuilder("m o "); switch (Bib_Info.SobekCM_Type) { case TypeOfResource_SobekCM_Enum.Book: case TypeOfResource_SobekCM_Enum.Newspaper: case TypeOfResource_SobekCM_Enum.Multivolume: case TypeOfResource_SobekCM_Enum.Serial: bldr006.Append("d"); break; case TypeOfResource_SobekCM_Enum.Video: case TypeOfResource_SobekCM_Enum.Audio: bldr006.Append("i"); break; case TypeOfResource_SobekCM_Enum.Photograph: case TypeOfResource_SobekCM_Enum.Map: case TypeOfResource_SobekCM_Enum.Aerial: bldr006.Append("c"); break; case TypeOfResource_SobekCM_Enum.Archival: bldr006.Append("m"); break; default: bldr006.Append(" "); break; } bldr006.Append(" "); // Government publication? int govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("local government publication"), 'l', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("government publication"), 'o', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref govt_publication, 1, bldr006); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref govt_publication, 1, bldr006); if (govt_publication == 0) { bldr006.Append(" "); } bldr006.Append(" "); tags.Add_Field(6, " ", bldr006.ToString()); // ADD THE 007 FOR ELECTRONIC RESOURCE StringBuilder bldr007 = new StringBuilder("cr n"); switch (Bib_Info.SobekCM_Type) { case TypeOfResource_SobekCM_Enum.Audio: case TypeOfResource_SobekCM_Enum.Video: bldr007.Append("a"); break; default: bldr007.Append(" "); break; } bldr007.Append("---ma mp"); tags.Add_Field(new MARC_Field(7, " ", bldr007.ToString())); // ADD THE MAIN ENTITY NAME if (Bib_Info.hasMainEntityName) { MARC_Field main_entity_marc = Bib_Info.Main_Entity_Name.to_MARC_HTML(false); switch (Bib_Info.Main_Entity_Name.Name_Type) { case Name_Info_Type_Enum.Personal: main_entity_marc.Tag = 100; break; case Name_Info_Type_Enum.Corporate: main_entity_marc.Tag = 110; break; case Name_Info_Type_Enum.Conference: main_entity_marc.Tag = 111; break; case Name_Info_Type_Enum.UNKNOWN: main_entity_marc.Tag = 720; break; } tags.Add_Field(main_entity_marc); } // ADD THE OTHER NAMES if (Bib_Info.Names_Count > 0) { foreach (Name_Info name in Bib_Info.Names) { if ((!String.IsNullOrEmpty(name.Full_Name)) || (!String.IsNullOrEmpty(name.Given_Name)) || (!String.IsNullOrEmpty(name.Family_Name))) { MARC_Field name_marc = name.to_MARC_HTML(false); switch (name.Name_Type) { case Name_Info_Type_Enum.Personal: name_marc.Tag = 700; break; case Name_Info_Type_Enum.Corporate: name_marc.Tag = 710; break; case Name_Info_Type_Enum.Conference: name_marc.Tag = 711; break; case Name_Info_Type_Enum.UNKNOWN: name_marc.Tag = 720; break; } tags.Add_Field(name_marc); } } } // ADD THE DONOR if ((Bib_Info.hasDonor) && (Bib_Info.Donor.Full_Name.Length > 0)) { MARC_Field donor_marc = Bib_Info.Donor.to_MARC_HTML(false); switch (Bib_Info.Donor.Name_Type) { case Name_Info_Type_Enum.Personal: case Name_Info_Type_Enum.UNKNOWN: donor_marc.Indicators = donor_marc.Indicators[0] + "3"; donor_marc.Tag = 796; tags.Add_Field(donor_marc); break; case Name_Info_Type_Enum.Corporate: case Name_Info_Type_Enum.Conference: donor_marc.Indicators = donor_marc.Indicators[0] + "3"; donor_marc.Tag = 797; tags.Add_Field(donor_marc); break; } } // ADD THE 260 if ((Bib_Info.Origin_Info.Publishers_Count > 0) || (Bib_Info.Origin_Info.Date_Issued.Length > 0) || (Bib_Info.Origin_Info.MARC_DateIssued.Length > 0)) { MARC_Field publisher_tag = new MARC_Field(); StringBuilder builder260 = new StringBuilder(); publisher_tag.Tag = 260; publisher_tag.Indicators = " "; int pub_count = 0; if (Bib_Info.Publishers_Count > 0) { foreach (Publisher_Info thisPublisher in Bib_Info.Publishers) { int place_count = 1; bool place_added = false; // ADD ALL THE |a 's for this publisher if (thisPublisher.Places_Count > 0) { foreach (Origin_Info_Place thisPlace in thisPublisher.Places) { if (thisPlace.Place_Text.Length > 0) { place_added = true; if (place_count > 1) { builder260.Append("; |a " + thisPlace.Place_Text + " "); } else { builder260.Append("|a " + thisPlace.Place_Text + " "); } place_count++; } } } if (!place_added) { builder260.Append("|a [S.l.] "); } builder260.Append(": "); // Add the |b for this publisher string pubName = thisPublisher.Name.Trim(); if ((pubName.Length > 2) && (pubName[pubName.Length - 1] == ',')) { pubName = pubName.Substring(0, pubName.Length - 1); } builder260.Append("|b " + thisPublisher.Name); pub_count++; if (pub_count == Bib_Info.Publishers_Count) { if ((Bib_Info.Origin_Info.Date_Issued.Length > 0) || (Bib_Info.Manufacturers_Count > 0)) { builder260.Append(", "); } } else { builder260.Append(" ; "); } } } if (Bib_Info.Origin_Info.MARC_DateIssued.Length > 0) { builder260.Append("|c " + Bib_Info.Origin_Info.MARC_DateIssued); } else if (Bib_Info.Origin_Info.Date_Issued.Length > 0) { builder260.Append("|c " + Bib_Info.Origin_Info.Date_Issued); } if (Bib_Info.Manufacturers_Count > 0) { foreach (Publisher_Info thisManufacturer in Bib_Info.Manufacturers) { int place_count = 1; bool place_added = false; // ADD ALL THE |e 's for this manufacturer if (thisManufacturer.Places_Count > 0) { foreach (Origin_Info_Place thisPlace in thisManufacturer.Places) { if (thisPlace.Place_Text.Length > 0) { place_added = true; if (place_count > 1) { builder260.Append("; |e " + thisPlace.Place_Text + " "); } else { builder260.Append(" |e (" + thisPlace.Place_Text + " "); } place_count++; } } } if (!place_added) { builder260.Append("|e ( [S.l.] "); } builder260.Append(": "); // Add the |f for this manufacturer builder260.Append("|f " + thisManufacturer.Name + ")"); } } else { builder260.Append("."); } publisher_tag.Control_Field_Value = builder260.ToString(); tags.Add_Field(publisher_tag); } // ADD ALL THE FREQUENCIES if (Bib_Info.Origin_Info.Frequencies_Count > 0) { foreach (Origin_Info_Frequency frequency in Bib_Info.Origin_Info.Frequencies) { if (frequency.Authority != "marcfrequency") { MARC_Field frequency_tag = new MARC_Field {Tag = 310, Indicators = " "}; if (frequency.Term.IndexOf("[") < 0) { frequency_tag.Control_Field_Value = "|a " + frequency.Term; } else { if (frequency.Term.IndexOf("[ FORMER") > 0) { frequency_tag.Tag = 321; int square_bracket_index = frequency.Term.IndexOf("["); frequency_tag.Control_Field_Value = "|a " + frequency.Term.Substring(0, square_bracket_index).Trim() + " |b " + frequency.Term.Substring(square_bracket_index + 9).Replace("]", "").Trim(); } else { int square_bracket_index2 = frequency.Term.IndexOf("["); frequency_tag.Control_Field_Value = "|a " + frequency.Term.Substring(0, square_bracket_index2).Trim() + " |b " + frequency.Term.Substring(square_bracket_index2 + 1).Replace("]", "").Trim(); } } tags.Add_Field(frequency_tag); } } } // Determine if there is a link to another version of this material bool another_version_exists = false; if (Bib_Info.RelatedItems_Count > 0) { if (Bib_Info.RelatedItems.Where(relatedItem => relatedItem.URL.Length > 0).Any(relatedItem => relatedItem.Relationship == Related_Item_Type_Enum.OtherVersion)) { another_version_exists = true; } } // ADD ALL THE NOTES string statement_of_responsibility = ""; string electronic_access_note = ""; if (Bib_Info.Notes_Count > 0) { foreach (Note_Info thisNote in Bib_Info.Notes) { switch (thisNote.Note_Type) { case Note_Type_Enum.StatementOfResponsibility: statement_of_responsibility = thisNote.Note; break; case Note_Type_Enum.ElectronicAccess: electronic_access_note = thisNote.Note; break; case Note_Type_Enum.PublicationStatus: case Note_Type_Enum.InternalComments: // DO nothing break; default: tags.Add_Field(thisNote.to_MARC_HTML()); break; } } } // Add an 856 pointing to this item first MARC_Field tag856 = new MARC_Field {Tag = 856, Indicators = "40"}; string url = Bib_Info.Location.PURL; if (url.Length == 0) { url = web.Service_URL; } string linkText = "Electronic Resource"; if ((Bib_Info.Type.MODS_Type == TypeOfResource_MODS_Enum.Text)) linkText = "Click here for full text"; if ((another_version_exists) && ( SystemAbbreviation.Length > 0 )) { if (electronic_access_note.Length > 0) tag856.Control_Field_Value = "|3 " + SystemAbbreviation + " Version |u " + url + " |y " + linkText + " |z " + electronic_access_note; else tag856.Control_Field_Value = "|3 " + SystemAbbreviation + " Version |u " + url + " |y " + linkText; } else { if (electronic_access_note.Length > 0) tag856.Control_Field_Value = "|u " + url + " |y " + linkText + " |z " + electronic_access_note; else tag856.Control_Field_Value = "|u " + url + " |y " + linkText; } tags.Add_Field(tag856); // ADD THE RELATED ITEMS if (Bib_Info.RelatedItems_Count > 0) { foreach (Related_Item_Info relatedItem in Bib_Info.RelatedItems) { // Add the main tag tags.Add_Field(relatedItem.to_MARC_HTML()); // If there is a URL listed, add another tag if (relatedItem.URL.Length > 0) { MARC_Field linking_tag = new MARC_Field {Tag = 856, Indicators = "42"}; if (relatedItem.Relationship == Related_Item_Type_Enum.OtherVersion) linking_tag.Indicators = "41"; StringBuilder linking856_builder = new StringBuilder(); if (relatedItem.URL_Display_Label.Length > 0) { linking856_builder.Append("|3 " + XML_Writing_Base_Type.Convert_String_To_XML_Safe_Static(relatedItem.URL_Display_Label) + " "); } else { switch (relatedItem.Relationship) { case Related_Item_Type_Enum.Host: linking856_builder.Append("|3 Host material "); break; case Related_Item_Type_Enum.OtherFormat: linking856_builder.Append("|3 Other format "); break; case Related_Item_Type_Enum.OtherVersion: linking856_builder.Append("|3 Other version "); break; case Related_Item_Type_Enum.Preceding: linking856_builder.Append("|3 Preceded by "); break; case Related_Item_Type_Enum.Succeeding: linking856_builder.Append("|3 Succeeded by "); break; default: linking856_builder.Append("|3 Related item "); break; } } // Add the URL linking856_builder.Append("|u " + XML_Writing_Base_Type.Convert_String_To_XML_Safe_Static(relatedItem.URL) + " "); // Add the title if there is one if ((relatedItem.hasMainTitle) && (relatedItem.Main_Title.Title.Length > 0)) { linking856_builder.Append("|y " + XML_Writing_Base_Type.Convert_String_To_XML_Safe_Static(relatedItem.Main_Title.Title)); } linking_tag.Control_Field_Value = linking856_builder.ToString().Trim(); tags.Add_Field(linking_tag); } } } // ADD THE TARGET AUDIENCE string skipped_marctarget = String.Empty; bool done_with_skipped = false; if (Bib_Info.Target_Audiences_Count > 0) { foreach (TargetAudience_Info targetAudience in Bib_Info.Target_Audiences) { if (targetAudience.Authority.Length > 0) { // This part is kinda wierd. basically, one marctarget audience can be included in the // leader, so it does not need to be included in the 521 as well. But, if there is // more than one "marctarget" audience, I want ALL of them to show up here. if (targetAudience.Authority == "marctarget") { if (skipped_marctarget.Length == 0) { skipped_marctarget = targetAudience.Audience; } else { if (!done_with_skipped) { tags.Add_Field(521, " ", "|a " + skipped_marctarget + " |b marctarget"); done_with_skipped = true; } tags.Add_Field(521, " ", "|a " + targetAudience.Audience + " |b " + targetAudience.Authority); } } else { tags.Add_Field(521, " ", "|a " + targetAudience.Audience + " |b " + targetAudience.Authority); } } else { tags.Add_Field(521, " ", "|a " + targetAudience.Audience); } } } //// ADD THE ORIGINAL CATALOGING SOURCE INFORMATION //if (this.Bib_Info.Record.MARC_Record_Content_Sources.Count > 0) //{ // MARC_XML_Field origCatSource = new MARC_XML_Field(); // StringBuilder builder599 = new StringBuilder(); // origCatSource.Tag = "599"; // origCatSource.Indicators = " "; // builder599.Append("|a " + this.Bib_Info.Record.MARC_Record_Content_Sources[0]); // if (this.Bib_Info.Record.MARC_Record_Content_Sources.Count > 1) // { // builder599.Append(" |c " + this.Bib_Info.Record.MARC_Record_Content_Sources[1]); // } // int orig_count = 2; // while (orig_count < this.Bib_Info.Record.MARC_Record_Content_Sources.Count) // { // builder599.Append(" |d " + this.Bib_Info.Record.MARC_Record_Content_Sources[orig_count]); // orig_count++; // } // origCatSource.Field = builder599.ToString(); // tags.Add_Field(origCatSource); //} // Add the NEW cataloging source information if ((!String.IsNullOrEmpty(CatalogingSourceCode)) || ( Bib_Info.Record.MARC_Record_Content_Sources_Count > 0 )) { MARC_Field catSource = new MARC_Field { Tag = 40, Indicators = " " }; StringBuilder catSourceBuilder = new StringBuilder(); if (Bib_Info.Record.MARC_Record_Content_Sources_Count > 0) { bool a_added = false; foreach (string thisSource in Bib_Info.Record.MARC_Record_Content_Sources) { if (!a_added) { catSourceBuilder.Append("|a " + thisSource); a_added = true; } else { catSourceBuilder.Append(" |d " + thisSource); } } } else { catSourceBuilder.Append("|a " + CatalogingSourceCode.Trim() + " |c " + CatalogingSourceCode.Trim()); } if (BIBInfo.Record.Description_Standard.Length > 0) catSourceBuilder.Append(" |e " + BIBInfo.Record.Description_Standard.ToLower()); catSource.Control_Field_Value = catSourceBuilder.ToString(); tags.Add_Field(catSource); } // ADD THE ABSTRACTS if (Bib_Info.Abstracts_Count > 0) { foreach (Abstract_Info thisAbstract in Bib_Info.Abstracts) { tags.Add_Field(thisAbstract.to_MARC_HTML()); } } // ADD THE MAIN TITLE if (Bib_Info.Main_Title.Title.Length > 0) { MARC_Field mainTitleTag = Bib_Info.Main_Title.to_MARC_HTML(245, 2, statement_of_responsibility, "[electronic resource]"); if ((Bib_Info.hasMainEntityName) && (Bib_Info.Main_Entity_Name.Full_Name.Length > 0)) mainTitleTag.Indicators = "1" + mainTitleTag.Indicators[1]; else mainTitleTag.Indicators = "0" + mainTitleTag.Indicators[1]; tags.Add_Field(mainTitleTag); } // ADD THE SERIES TITLE if ((Bib_Info.hasSeriesTitle) && (Bib_Info.SeriesTitle.Title.Length > 0)) { tags.Add_Field(Bib_Info.SeriesTitle.to_MARC_HTML(490, 0, String.Empty, String.Empty)); } // ADD ALL OTHER TITLES if (Bib_Info.Other_Titles_Count > 0) { foreach (Title_Info thisTitle in Bib_Info.Other_Titles) { tags.Add_Field(thisTitle.to_MARC_HTML(-1, -1, String.Empty, String.Empty)); } } // ADD THE EXTENT if (Bib_Info.Original_Description.Extent.Length > 0) { int semi_index = Bib_Info.Original_Description.Extent.IndexOf(";"); int colon_index = Bib_Info.Original_Description.Extent.IndexOf(":"); if ((semi_index > 0) || (colon_index > 0)) { string a_300_subfield_string; string b_300_subfield_string = String.Empty; string c_300_subfield_string = String.Empty; if (semi_index > 0) { if (colon_index > 0) { a_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(0, colon_index); b_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(colon_index + 1, semi_index - colon_index - 1); c_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(semi_index + 1); //tags.Add_Field("300", " ", "|a " + this.Bib_Info.Original_Description.Extent.Substring(0, colon_index + 1) + " |b " + this.Bib_Info.Original_Description.Extent.Substring(colon_index + 1, semi_index - colon_index) + " |c " + this.Bib_Info.Original_Description.Extent.Substring(semi_index + 1)); } else { a_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(0, semi_index); c_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(semi_index + 1); // No colon ( colon_index < 0 ) //tags.Add_Field("300", " ", "|a " + this.Bib_Info.Original_Description.Extent.Substring(0, semi_index + 1) + " |c " + this.Bib_Info.Original_Description.Extent.Substring(semi_index + 1)); } } else { a_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(0, colon_index); b_300_subfield_string = Bib_Info.Original_Description.Extent.Substring(colon_index + 1); // No semi colon ( semi_index < 0 ) //tags.Add_Field("300", " ", "|a " + this.Bib_Info.Original_Description.Extent.Substring(0, colon_index + 1) + " |b " + this.Bib_Info.Original_Description.Extent.Substring(colon_index + 1)); } StringBuilder builder_300 = new StringBuilder("|a " + a_300_subfield_string, a_300_subfield_string.Length + b_300_subfield_string.Length + c_300_subfield_string.Length + 10); if (b_300_subfield_string.Trim().Length > 0) { builder_300.Append(": |b " + b_300_subfield_string); } if (c_300_subfield_string.Trim().Length > 0) { builder_300.Append("; |c " + c_300_subfield_string); } tags.Add_Field(300, " ", builder_300.ToString()); } else { tags.Add_Field(300, " ", "|a " + Bib_Info.Original_Description.Extent); } } // ADD THE EDITION if (Bib_Info.Origin_Info.Edition.Length > 0) { if (Bib_Info.Origin_Info.Edition.IndexOf(" -- ") > 0) { int edition_index = Bib_Info.Origin_Info.Edition.IndexOf(" -- "); tags.Add_Field(250, " ", "|a " + Bib_Info.Origin_Info.Edition.Substring(0, edition_index) + " /|b " + Bib_Info.Origin_Info.Edition.Substring(edition_index + 4)); } else { tags.Add_Field(250, " ", "|a " + Bib_Info.Origin_Info.Edition); } } // ADD THE CLASSIFICATIONS if (Bib_Info.Classifications_Count > 0) { foreach (Classification_Info thisClassification in Bib_Info.Classifications) { tags.Add_Field(thisClassification.to_MARC_Tag()); } } // ADD ALL THE IDENTIFIERS if (Bib_Info.Identifiers_Count > 0) { foreach (Identifier_Info thisIdentifier in Bib_Info.Identifiers) { switch (thisIdentifier.Type.ToUpper()) { case "LCCN": tags.Add_Field(10, " ", "|a " + thisIdentifier.Identifier); break; case "ISBN": tags.Add_Field(20, " ", "|a " + thisIdentifier.Identifier); break; case "ISSN": tags.Add_Field(22, " ", "|a " + thisIdentifier.Identifier); break; case "OCLC": tags.Add_Field(776, "1 ", "|c Original |w (OCoLC)" + thisIdentifier.Identifier); break; case "NOTIS": tags.Add_Field(035, "9 ", "|a " + thisIdentifier.Identifier + " |b UF"); break; case "ALEPH": tags.Add_Field(035, "9 ", "|a " + thisIdentifier.Identifier.PadLeft(9, '0') + " |b UF"); break; default: if (thisIdentifier.Type.Length > 0) { tags.Add_Field(024, "7 ", "|a " + thisIdentifier.Identifier + " |2 " + thisIdentifier.Type); } else { tags.Add_Field(024, "8 ", "|a " + thisIdentifier.Identifier); } break; } } } // ADD THE MAIN IDENTIFIER if ((METS_Header.ObjectID.Length > 0) || (Bib_Info.Record.Main_Record_Identifier.Identifier.Length > 0) || ((BibID.Length > 0) && ((VID.Length > 0) || (METS_Header.RecordStatus_Enum != METS_Record_Status.BIB_LEVEL)))) { if (Bib_Info.Record.Main_Record_Identifier.Identifier.Length > 0) { tags.Add_Field(1, " ", Bib_Info.Record.Main_Record_Identifier.Identifier); } else { if (METS_Header.ObjectID.Length > 0) { tags.Add_Field(1, " ", METS_Header.ObjectID); } else { if (METS_Header.RecordStatus_Enum != METS_Record_Status.BIB_LEVEL) tags.Add_Field(1, " ", BibID + "_" + VID); else tags.Add_Field(1, " ", BibID); } } } // ADD THE LAST MODIFIED DATE tags.Add_Field(5, " ", METS_Header.Modify_Date.Year + METS_Header.Modify_Date.Month.ToString().PadLeft(2, '0') + METS_Header.Modify_Date.Day.ToString().PadLeft(2, '0') + METS_Header.Modify_Date.Hour.ToString().PadLeft(2, '0') + METS_Header.Modify_Date.Minute.ToString().PadLeft(2, '0') + METS_Header.Modify_Date.Second.ToString().PadLeft(2, '0') + ".0"); // ADD THE SUBJECT KEYWORDS if (Bib_Info.Subjects_Count > 0) { foreach (Subject_Info thisSubject in Bib_Info.Subjects) { tags.Add_Field(thisSubject.to_MARC_HTML()); } } // ADD ANY NON-MARCGT GENRE TERMS AS 655 CODES AS WELL if (Bib_Info.Genres_Count > 0) { foreach (Genre_Info thisGenre in Bib_Info.Genres) { tags.Add_Field(thisGenre.to_MARC_HTML()); } } // ADD THE TEMPORAL SUBJECT (if the term appears nowehere in the subjects) if (Bib_Info.TemporalSubjects_Count > 0) { foreach (Temporal_Info thisTemporal in Bib_Info.TemporalSubjects) { string temporal_upper = thisTemporal.TimePeriod.ToUpper(); string years = String.Empty; if ((thisTemporal.Start_Year > 0) && (thisTemporal.End_Year > 0)) years = thisTemporal.Start_Year.ToString() + "-" + thisTemporal.End_Year; if ((thisTemporal.Start_Year > 0) && (thisTemporal.End_Year < 0)) years = thisTemporal.Start_Year.ToString() + "-"; if ((thisTemporal.Start_Year < 0) && (thisTemporal.End_Year > 0)) years = "-" + thisTemporal.End_Year; bool found = false; if (Bib_Info.Subjects_Count > 0) { foreach (Subject_Info thisSubject in Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard) thisSubject; if (standSubject.Temporals_Count > 0) { if (standSubject.Temporals.Any(temporal => (temporal_upper == temporal.ToUpper()) || (temporal == years))) { found = true; } } } if (found) break; } } if (!found) { Subject_Info_Standard tempSubject = new Subject_Info_Standard(); if (years.Length > 0) { tempSubject.Add_Temporal(years); } if (thisTemporal.TimePeriod.Length > 0) { tempSubject.Add_Temporal(thisTemporal.TimePeriod); } tags.Add_Field(tempSubject.to_MARC_HTML()); } } } // ADD THE TABLE OF CONTENTS if (Bib_Info.TableOfContents.Length > 0) { tags.Add_Field(505, "0 ", "|a " + Bib_Info.TableOfContents); } // ADD THE RIGHTS if (Bib_Info.Access_Condition.Text.Length > 0) { if (String.Compare(Bib_Info.Access_Condition.Type, "use and reproduction", StringComparison.OrdinalIgnoreCase) == 0) { if ( Bib_Info.Access_Condition.Text.IndexOf("http") == 0 ) tags.Add_Field(540, " ", "|u " + Bib_Info.Access_Condition.Text); else tags.Add_Field(540, " ", "|a " + Bib_Info.Access_Condition.Text); } else { if (Bib_Info.Access_Condition.Text.IndexOf("http") == 0) tags.Add_Field(506, " ", "|u " + Bib_Info.Access_Condition.Text); else tags.Add_Field(506, " ", "|a " + Bib_Info.Access_Condition.Text); } } // ADD THE HOLDING LOCATION if ((Bib_Info.hasLocationInformation) && (Bib_Info.Location.Holding_Name.Length > 0)) { if (Bib_Info.Location.Holding_Name[Bib_Info.Location.Holding_Name.Length - 1] != '.') tags.Add_Field(535, "1 ", "|a " + Bib_Info.Location.Holding_Name + "."); else tags.Add_Field(535, "1 ", "|a " + Bib_Info.Location.Holding_Name); } // IF THERE IS MORE THAN ONE LANGUAGE, ADD THEM ALL IN THE 041 if (Bib_Info.Languages_Count > 1) { StringBuilder marc_coded_languages = new StringBuilder(); foreach (Language_Info thisLanguage in Bib_Info.Languages) { if (thisLanguage.Language_ISO_Code.Length > 0) marc_coded_languages.Append("|a " + thisLanguage.Language_ISO_Code + " "); } if (marc_coded_languages.Length > 0) tags.Add_Field(041, " ", marc_coded_languages.ToString().Trim()); } // ADD THE 008 FIELD (FIXED LENGTH DATA ELEMENTS) MARC_Field fixedField008 = new MARC_Field {Indicators = " ", Tag = 008}; StringBuilder builder008 = new StringBuilder(); builder008.Append(METS_Header.Create_Date.Year.ToString().Substring(2) + METS_Header.Create_Date.Month.ToString().PadLeft(2, '0') + METS_Header.Create_Date.Day.ToString().PadLeft(2, '0')); if ((Bib_Info.Origin_Info.MARC_DateIssued_Start.Length == 0) && (Bib_Info.Origin_Info.MARC_DateIssued_End.Length == 0)) { builder008.Append("n "); } else { if ((sobekcm_type != TypeOfResource_SobekCM_Enum.Newspaper) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Serial) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Multivolume)) { if ((Bib_Info.Origin_Info.MARC_DateIssued_End.Length == 0) || (Bib_Info.Origin_Info.MARC_DateIssued_End == "0000")) { builder008.Append("s" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + " "); } else { switch (Bib_Info.Origin_Info.MARC_DateIssued_End.ToUpper()) { case "UUUU": builder008.Append("u" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + "uuuu"); break; case "9999": builder008.Append("m" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + "9999"); break; default: if (Bib_Info.Origin_Info.Date_Reprinted == Bib_Info.Origin_Info.MARC_DateIssued_Start) { builder008.Append("r" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + Bib_Info.Origin_Info.MARC_DateIssued_End.PadLeft(4, '0')); } else { if (Bib_Info.Origin_Info.Date_Copyrighted == Bib_Info.Origin_Info.MARC_DateIssued_End) { builder008.Append("t" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + Bib_Info.Origin_Info.MARC_DateIssued_End.PadLeft(4, '0')); } else { builder008.Append("d" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + Bib_Info.Origin_Info.MARC_DateIssued_End.PadLeft(4, '0')); } } break; } } } else { if (Bib_Info.Origin_Info.MARC_DateIssued_End.Length == 0) { builder008.Append("s" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + " "); } else { switch (Bib_Info.Origin_Info.MARC_DateIssued_End.ToUpper()) { case "UUUU": builder008.Append("u" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + "uuuu"); break; case "9999": builder008.Append("c" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + "9999"); break; default: builder008.Append("d" + Bib_Info.Origin_Info.MARC_DateIssued_Start.PadLeft(4, '0') + Bib_Info.Origin_Info.MARC_DateIssued_End.PadLeft(4, '0')); break; } } } } // Is there a place listed in marc country? string marccountry_code = "xx "; if (Bib_Info.Origin_Info.Places_Count > 0) { foreach (Origin_Info_Place thisPlace in Bib_Info.Origin_Info.Places) { if (thisPlace.Place_MarcCountry.Length > 0) { marccountry_code = thisPlace.Place_MarcCountry.PadRight(3, ' '); break; } } } builder008.Append(marccountry_code); // Set the default code for the any simple flag characters char default_code = '|'; if (Bib_Info.EncodingLevel.Length > 0) default_code = '0'; #region Map Specific 008 Values // Build the Map-Specific 008 Values if (sobekcm_type == TypeOfResource_SobekCM_Enum.Map) { // Add the map relief information string map_relief_note = String.Empty; if (Bib_Info.Notes_Count > 0) { foreach (Note_Info thisNote in Bib_Info.Notes) { if (thisNote.Note_Type == Note_Type_Enum.NONE) { if ((thisNote.Note.IndexOf("Relief shown") >= 0) || (thisNote.Note.IndexOf("Depths shown") >= 0) || (thisNote.Note.IndexOf("Depth shown") >= 0)) { map_relief_note = thisNote.Note; } } } } if (map_relief_note.Length > 0) { string[] map_relief_note_splitter = map_relief_note.Split(".".ToCharArray()); int map_relief_info = 0; foreach (string map_split in map_relief_note_splitter) { add_value((map_split.IndexOf("contours") >= 0), 'a', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("shading") >= 0), 'b', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("Relief") >= 0) && ((map_split.IndexOf("gradient") >= 0) || (map_split.IndexOf("bathymetric") >= 0)), 'c', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("hachure") >= 0), 'd', ref map_relief_info, 4, builder008); add_value(((map_split.IndexOf("Depth") >= 0) && (map_split.IndexOf("soundings") > 0)) || (map_split.IndexOf("spot depth") >= 0), 'e', ref map_relief_info, 4, builder008); add_value(map_split.IndexOf("form lines") >= 0, 'f', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("spot height") >= 0), 'g', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("pictorially") >= 0), 'i', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("land forms") >= 0), 'j', ref map_relief_info, 4, builder008); add_value((map_split.IndexOf("isolines") >= 0), 'k', ref map_relief_info, 4, builder008); } for (int i = map_relief_info; i < 4; i++) builder008.Append(" "); } else { builder008.Append(" "); } // Add the projection information bool map_projection_handled = false; if (Bib_Info.Subjects_Count > 0) { foreach (Subject_Info possibleCarto in Bib_Info.Subjects) { if ((possibleCarto.Authority == "marcgt") && (possibleCarto.Class_Type == Subject_Info_Type.Cartographics)) { if (((Subject_Info_Cartographics) possibleCarto).Projection.Length == 2) { builder008.Append(((Subject_Info_Cartographics) possibleCarto).Projection); map_projection_handled = true; break; } } } } if (!map_projection_handled) { builder008.Append(" "); } // Undefined character position builder008.Append(" "); // Add the type of cartographic material int map_type = 0; add_value(genreHash.ContainsKey("atlas"), 'e', ref map_type, 1, builder008); add_value(genreHash.ContainsKey("globe"), 'd', ref map_type, 1, builder008); add_value(genreHash.ContainsKey("single map"), 'a', ref map_type, 1, builder008); add_value(genreHash.ContainsKey("map series"), 'b', ref map_type, 1, builder008); add_value(genreHash.ContainsKey("map serial"), 'c', ref map_type, 1, builder008); if (map_type == 0) { builder008.Append(" "); } // Two undefined positions builder008.Append(" "); // Government publication? int map_govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("local government publication"), 'l', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication"), 'o', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref map_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref map_govt_publication, 1, builder008); if (map_govt_publication == 0) { builder008.Append(" "); } // Add form of item builder008.Append("o"); // Undefined position builder008.Append(" "); // Code if this includes an index if (genreHash.ContainsKey("indexed")) { builder008.Append("1"); } else { builder008.Append(default_code); } // Undefined position builder008.Append(" "); // Special format characteristics builder008.Append(" "); } #endregion #region Continuing Resource Specific 008 Values // Build the Continuing Resource-Specific 008 Values if ((sobekcm_type == TypeOfResource_SobekCM_Enum.Newspaper) || (sobekcm_type == TypeOfResource_SobekCM_Enum.Serial)) { // Add the frequency (008/18) int newspaper_frequency = 0; if (Bib_Info.Origin_Info.Frequencies_Count > 0) { foreach (Origin_Info_Frequency thisFrequency in Bib_Info.Origin_Info.Frequencies) { if (thisFrequency.Authority == "marcfrequency") { add_value(thisFrequency.Term == "annual", 'a', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "bimonthly", 'b', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "semiweekly", 'c', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "daily", 'd', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "bieweekly", 'e', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "semiannual", 'f', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "biennial", 'g', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "triennial", 'h', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "three times a week", 'i', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "three times a month", 'j', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "continuously updated", 'k', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "monthly", 'm', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "quarterly", 'q', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "semimonthly", 's', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "three times a year", 't', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "weekly", 'w', ref newspaper_frequency, 1, builder008); add_value(thisFrequency.Term == "other", 'z', ref newspaper_frequency, 1, builder008); } } } if (newspaper_frequency == 0) builder008.Append(" "); // Add the regularity (08/19) int newspaper_regularity = 0; if (Bib_Info.Origin_Info.Frequencies_Count > 0) { foreach (Origin_Info_Frequency thisFrequency in Bib_Info.Origin_Info.Frequencies) { if (thisFrequency.Authority == "marcfrequency") { add_value(thisFrequency.Term == "normalized irregular", 'n', ref newspaper_regularity, 1, builder008); add_value(thisFrequency.Term == "regular", 'r', ref newspaper_regularity, 1, builder008); add_value(thisFrequency.Term == "completely irregular", 'x', ref newspaper_regularity, 1, builder008); } } } if (newspaper_regularity == 0) builder008.Append("u"); // undefined (008/20) builder008.Append(" "); // Add the type of continuing resource (008/21) int newspaper_type = 0; add_value(genreHash.ContainsKey("database"), 'd', ref newspaper_type, 1, builder008); add_value(genreHash.ContainsKey("loose-leaf"), 'l', ref newspaper_type, 1, builder008); add_value(genreHash.ContainsKey("newspaper"), 'n', ref newspaper_type, 1, builder008); add_value(genreHash.ContainsKey("periodical"), 'p', ref newspaper_type, 1, builder008); add_value(genreHash.ContainsKey("series"), 's', ref newspaper_type, 1, builder008); add_value(genreHash.ContainsKey("web site"), 'w', ref newspaper_type, 1, builder008); if (newspaper_type == 0) builder008.Append(" "); // Add original form of item and this item (electronic) (008/22-23) builder008.Append(sobekcm_type == TypeOfResource_SobekCM_Enum.Newspaper ? "eo" : " o"); // Add nature of work (008/24-27) int newspaper_nature_of_contents = 0; add_value(genreHash.ContainsKey("abstract or summary"), 'a', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("bibliography"), 'b', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("catalog"), 'c', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("dictionary"), 'd', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("directory"), 'r', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("discography"), 'k', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("encyclopedia"), 'e', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("filmography"), 'q', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("handbook"), 'f', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("index"), 'i', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("law report or digest"), 'w', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("legal article"), 'g', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("legal case and case notes"), 'v', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("legislation"), 'l', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("patent"), 'j', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("programmed text"), 'p', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("review"), 'o', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("statistics"), 's', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("survey of literature"), 'n', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("technical reports"), 't', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("theses"), 'm', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("treaty"), 'z', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("offprint"), '2', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("yearbook"), 'y', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("calendar"), '5', ref newspaper_nature_of_contents, 3, builder008); add_value(genreHash.ContainsKey("comic/graphic novel"), '6', ref newspaper_nature_of_contents, 3, builder008); for (int i = newspaper_nature_of_contents; i < 4; i++) { builder008.Append(" "); } // Code if this is a government document (008/28) int newspaper_govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("local government publication"), 'l', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication"), 'o', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref newspaper_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref newspaper_govt_publication, 1, builder008); if (newspaper_govt_publication == 0) { builder008.Append(" "); } // Code if this is a conference publication (008/29) if (genreHash.ContainsKey("conference publication")) { builder008.Append("1"); } else { builder008.Append(default_code); } // Undefined (008/30-32) builder008.Append(" "); // Code original alphebet or script of title builder008.Append(" "); // Code the entry convention builder008.Append("0"); } #endregion #region Book Specific 008 Values if (sobekcm_type == TypeOfResource_SobekCM_Enum.Book) { if (Bib_Info.Original_Description.Extent.Length > 0) { int book_illustration_specs = 0; string extent_upper = Bib_Info.Original_Description.Extent.ToUpper(); add_value((extent_upper.IndexOf("ILL.") >= 0), 'a', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("MAP") >= 0), 'b', ref book_illustration_specs, 4, builder008); add_value(((extent_upper.IndexOf("PORT.") >= 0) || (extent_upper.IndexOf("PORTS.") >= 0)), 'c', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("CHART") >= 0), 'd', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("PLAN") >= 0), 'e', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("PLATE") >= 0), 'f', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("MUSIC") >= 0), 'g', ref book_illustration_specs, 4, builder008); add_value(((extent_upper.IndexOf("FACSIM.") >= 0) || (extent_upper.IndexOf("FACSIMS.") >= 0)), 'h', ref book_illustration_specs, 4, builder008); add_value(((extent_upper.IndexOf("COAT OF ARMS") >= 0) || (extent_upper.IndexOf("COATS OF ARMS") >= 0)), 'i', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("FORM") >= 0), 'k', ref book_illustration_specs, 4, builder008); add_value((extent_upper.IndexOf("SAMPLE") >= 0), 'l', ref book_illustration_specs, 4, builder008); add_value(((extent_upper.IndexOf("PHOTO.") >= 0) || (extent_upper.IndexOf("PHOTOS.") >= 0)), 'o', ref book_illustration_specs, 4, builder008); // Finish this off if (book_illustration_specs == 0) { builder008.Append(" "); } else { for (int i = book_illustration_specs; i < 4; i++) { builder008.Append(" "); } } } else { builder008.Append("||||"); } // Look for target audience int book_target_audiences = 0; if (Bib_Info.Target_Audiences_Count > 0) { foreach (TargetAudience_Info thisTarget in Bib_Info.Target_Audiences) { if (thisTarget.Authority == "marctarget") { add_value(thisTarget.Audience == "adolescent", 'd', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "adult", 'e', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "general", 'g', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "primary", 'b', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "pre-adolescent", 'c', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "juvenile", 'j', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "preschool", 'a', ref book_target_audiences, 1, builder008); add_value(thisTarget.Audience == "specialized", 'f', ref book_target_audiences, 1, builder008); } } } if (book_target_audiences == 0) builder008.Append(" "); // Always electronic --> online (1/11/2013) builder008.Append("o"); // Code nature of contents int book_nature_of_contents = 0; add_value(genreHash.ContainsKey("abstract or summary"), 'a', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("bibliography"), 'b', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("catalog"), 'c', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("dictionary"), 'd', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("directory"), 'r', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("discography"), 'k', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("encyclopedia"), 'e', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("filmography"), 'q', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("handbook"), 'f', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("index"), 'i', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("law report or digest"), 'w', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("legal article"), 'g', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("legal case and case notes"), 'v', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("legislation"), 'l', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("patent"), 'j', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("programmed text"), 'p', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("review"), 'o', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("statistics"), 's', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("survey of literature"), 'n', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("technical reports"), 't', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("theses"), 'm', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("treaty"), 'z', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("offprint"), '2', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("yearbook"), 'y', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("calendar"), '5', ref book_nature_of_contents, 4, builder008); add_value(genreHash.ContainsKey("comic/graphic novel"), '6', ref book_nature_of_contents, 4, builder008); for (int i = book_nature_of_contents; i < 4; i++) { builder008.Append(" "); } // Code if this is a government document int book_govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("local government publication"), 'l', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication"), 'o', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref book_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref book_govt_publication, 1, builder008); if (book_govt_publication == 0) { builder008.Append(" "); } // Code if this is a conference publication if (genreHash.ContainsKey("conference publication")) { builder008.Append("1"); } else { builder008.Append(default_code); } // Code if this is a festschrift if (genreHash.ContainsKey("festschrift")) { builder008.Append("1"); } else { builder008.Append(default_code); } // Code if this includes an index if (genreHash.ContainsKey("indexed")) { builder008.Append("1"); } else { builder008.Append(default_code); } // Undefined character spot builder008.Append(" "); // Code the literary form int book_literary_form = 0; add_value(genreHash.ContainsKey("drama"), 'd', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("comic strip"), 'a', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("essay"), 'e', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("humor, satire"), 'h', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("letter"), 'i', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("poetry"), 'p', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("novel"), 'f', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("short story"), 'j', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("speech"), 's', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("non-fiction"), '0', ref book_literary_form, 1, builder008); add_value(genreHash.ContainsKey("fiction"), '1', ref book_literary_form, 1, builder008); if (book_literary_form == 0) builder008.Append("u"); // Code the biography value int book_biography_value = 0; add_value(genreHash.ContainsKey("autobiography"), 'a', ref book_biography_value, 1, builder008); add_value(genreHash.ContainsKey("individual biography"), 'b', ref book_biography_value, 1, builder008); add_value(genreHash.ContainsKey("collective biography"), 'c', ref book_biography_value, 1, builder008); if (book_biography_value == 0) builder008.Append(" "); } #endregion #region Visual Material Specific 008 Values if ((sobekcm_type == TypeOfResource_SobekCM_Enum.Aerial) || (sobekcm_type == TypeOfResource_SobekCM_Enum.Photograph) || (sobekcm_type == TypeOfResource_SobekCM_Enum.Audio) || (sobekcm_type == TypeOfResource_SobekCM_Enum.Video) || (sobekcm_type == TypeOfResource_SobekCM_Enum.Artifact)) { // Code running time for movies (008/18-20) builder008.Append("nnn"); // Undefined (008/21) builder008.Append(" "); // Target Audience (008/22) int visual_target_audiences = 0; if (Bib_Info.Target_Audiences_Count > 0) { foreach (TargetAudience_Info thisTarget in Bib_Info.Target_Audiences) { if (thisTarget.Authority == "marctarget") { add_value(thisTarget.Audience == "adolescent", 'd', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "adult", 'e', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "general", 'g', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "primary", 'b', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "pre-adolescent", 'c', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "juvenile", 'j', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "preschool", 'a', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "specialized", 'f', ref visual_target_audiences, 1, builder008); } } } if (visual_target_audiences == 0) builder008.Append(" "); // Undefined (008/23-27) builder008.Append(" "); // Is this a government publication? (008/28) int visual_govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("local government publication"), 'l', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication"), 'o', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref visual_govt_publication, 1, builder008); if (visual_govt_publication == 0) { builder008.Append(" "); } // What is the form of this item (always electronic) (008/29) builder008.Append("o"); // Undefined (008/30-32) builder008.Append(" "); // Type of visual material (008/33) int visual_nature_of_contents = 0; add_value(genreHash.ContainsKey("art original"), 'a', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("art reproduction"), 'c', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("chart"), 'n', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("diorama"), 'd', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("filmstrip"), 'f', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("flash card"), 'o', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("graphic"), 'k', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("kit"), 'b', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("microscope slide"), 'p', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("model"), 'q', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("motion picture"), 'm', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("picture"), 'i', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("realia"), 'r', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("slide"), 's', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("technical drawing"), 'l', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("toy"), 'w', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("transparency"), 't', ref visual_nature_of_contents, 1, builder008); add_value(genreHash.ContainsKey("video recording"), 'v', ref visual_nature_of_contents, 1, builder008); if (visual_nature_of_contents == 0) { builder008.Append(" "); } // Technique (008/34) builder008.Append(sobekcm_type == TypeOfResource_SobekCM_Enum.Video ? "u" : "n"); } #endregion #region Visual Material Specific 008 Values if (sobekcm_type == TypeOfResource_SobekCM_Enum.Dataset) { // Undefined (008/18-21) builder008.Append(" "); // Target Audience (008/22) int visual_target_audiences = 0; if (Bib_Info.Target_Audiences_Count > 0) { foreach (TargetAudience_Info thisTarget in Bib_Info.Target_Audiences) { if (thisTarget.Authority == "marctarget") { add_value(thisTarget.Audience == "adolescent", 'd', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "adult", 'e', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "general", 'g', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "primary", 'b', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "pre-adolescent", 'c', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "juvenile", 'j', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "preschool", 'a', ref visual_target_audiences, 1, builder008); add_value(thisTarget.Audience == "specialized", 'f', ref visual_target_audiences, 1, builder008); } } } if (visual_target_audiences == 0) builder008.Append(" "); // Form of item (008/23) (unknown or not specified) builder008.Append(" "); // Undefined (008/24-25) builder008.Append(" "); // Type of computer file (008/26) builder008.Append(" "); int computer_file_type = 0; add_value(genreHash.ContainsKey("numeric data"), 'c', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("computer program"), 'f', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("representational"), 'i', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("document"), 'l', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("bibliographic data"), 'm', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("font"), 'o', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("game"), 's', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("sound"), 'a', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("interactive multimedia"), 'm', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("online system or service"), 'o', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("combination"), 's', ref computer_file_type, 1, builder008); add_value(genreHash.ContainsKey("other computer file"), 'a', ref computer_file_type, 1, builder008); if (computer_file_type == 0) { builder008.Append(" "); } // Undefined (008/27) builder008.Append(" "); // Is this a government publication? (008/28) int visual_govt_publication = 0; add_value(genreHash.ContainsKey("multilocal government publication"), 'c', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("federal government publication"), 'f', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("international intergovernmental publication"), 'i', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("local government publication"), 'l', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("multistate government publication"), 'm', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication"), 'o', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (state, provincial, terriorial, dependent)"), 's', ref visual_govt_publication, 1, builder008); add_value(genreHash.ContainsKey("government publication (autonomous or semiautonomous component)"), 'a', ref visual_govt_publication, 1, builder008); if (visual_govt_publication == 0) { builder008.Append(" "); } // Undefined (008/29-34) builder008.Append(" "); } #endregion if (sobekcm_type == TypeOfResource_SobekCM_Enum.Archival) { // Treat as MIXED material builder008.Append(" s "); } // For any other type, just use spaces if ((sobekcm_type != TypeOfResource_SobekCM_Enum.Book) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Map) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Newspaper) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Serial) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Aerial) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Photograph) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Audio) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Video) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Artifact) && (sobekcm_type != TypeOfResource_SobekCM_Enum.Archival) && ( sobekcm_type != TypeOfResource_SobekCM_Enum.Dataset )) { builder008.Append(" s "); } // Add the language code string language_code = "eng"; if (Bib_Info.Languages_Count > 0) { foreach (Language_Info thisLanguage in Bib_Info.Languages) { if (thisLanguage.Language_ISO_Code.Length > 0) { language_code = thisLanguage.Language_ISO_Code; break; } } } builder008.Append(language_code); builder008.Append(" d"); //if (this.Bib_Info.Record.MARC_Record_Content_Sources.Count > 0) //{ // builder008.Append("d"); //} //else //{ // builder008.Append("|"); //} fixedField008.Control_Field_Value = builder008.ToString(); tags.Add_Field(fixedField008); // Add the system name also as a 830 (before the collections) if (!String.IsNullOrEmpty(SystemName)) { tags.Add_Field(new MARC_Field(830, " 0", "|a " + SystemName + ".")); } // Add the collection name as well ( Was getting duplicates here sometimes ) if (Behaviors.Aggregations != null) { List<string> added_already = new List<string>(); foreach (Aggregation_Info thisAggr in Behaviors.Aggregations) { if (( String.Compare(thisAggr.Code,"ALL", true ) != 0 ) && (( String.IsNullOrEmpty(thisAggr.Type)) || (thisAggr.Type.IndexOf("INSTITUT", StringComparison.InvariantCultureIgnoreCase) < 0))) { string collection = thisAggr.Name; if (String.IsNullOrEmpty(collection)) collection = thisAggr.Code; if (!added_already.Contains(collection.ToUpper().Trim())) { if (collection.Trim().Length > 0) { added_already.Add(collection.ToUpper().Trim()); tags.Add_Field(new MARC_Field(830, " 0", "|a " + collection + ".")); } } } } } // Add the thumbnail link (992) if ((Behaviors.Main_Thumbnail.Length > 0) && (!Behaviors.Dark_Flag)) { string thumbnail_link = Path.Combine(web.Source_URL, Behaviors.Main_Thumbnail); if (!String.IsNullOrEmpty(ThumbnailBase)) { thumbnail_link = Path.Combine(ThumbnailBase, thumbnail_link); } tags.Add_Field(new MARC_Field(992, "04", "|a " + thumbnail_link.Replace("\\", "/").Replace("//", "/").Replace("http:/", "http://"))); } // Was this born digital? in which case this is NOT an electronic reproduction, so // leave out the 533 field bool borndigital = Bib_Info.Genres.Any(ThisGenre => (ThisGenre.Authority == "sobekcm") && (ThisGenre.Genre_Term == "born-digital")); if (!borndigital) { MARC_Field tag533 = new MARC_Field { Tag = 533, Indicators = " " }; StringBuilder builder533 = new StringBuilder(100); builder533.Append("|a Electronic reproduction. "); if ( !String.IsNullOrEmpty(ReproductionPlace)) builder533.Append("|b " + ReproductionPlace + " : "); List<string> agencies = new List<string>(); if (!String.IsNullOrEmpty(ReproductionAgency)) { builder533.Append("|c " + ReproductionAgency + ", "); agencies.Add(ReproductionAgency); } // Add the source statement as another agency possibly if (!String.IsNullOrEmpty(Bib_Info.Source.Statement)) { string source_statement = Bib_Info.Source.Statement; // determine if this is a subset of any existing agency, or vice versa bool found = false; foreach (string thisAgency in agencies) { if ((source_statement.IndexOf(thisAgency, StringComparison.InvariantCultureIgnoreCase) >= 0) || (thisAgency.IndexOf(source_statement, StringComparison.InvariantCultureIgnoreCase) >= 0)) { found = true; break; } } if (!found) { builder533.Append("|c " + source_statement + ", "); agencies.Add(source_statement); } } // Add the source statement as another agency possibly if ((Bib_Info.hasLocationInformation) && (Bib_Info.Location.Holding_Code != Bib_Info.Source.Code) && (!String.IsNullOrEmpty(Bib_Info.Location.Holding_Name))) { string holding_statement = Bib_Info.Location.Holding_Name; // determine if this is a subset of any existing agency, or vice versa bool found = false; foreach (string thisAgency in agencies) { if ((holding_statement.IndexOf(thisAgency, StringComparison.InvariantCultureIgnoreCase) >= 0) || (thisAgency.IndexOf(holding_statement, StringComparison.InvariantCultureIgnoreCase) >= 0)) { found = true; break; } } if (!found) { builder533.Append("|c " + holding_statement + ", "); agencies.Add(holding_statement); } } builder533.Append("|d " + METS_Header.Create_Date.Year + ". "); if (!String.IsNullOrEmpty(SystemName)) { builder533.Append("|f (" + SystemName + ") "); } //foreach (string collection in Collection_Names) //{ // if (collection.Trim().Length > 0) // { // builder533.Append(" |f (" + collection + ")"); // } //} builder533.Append("|n Mode of access: World Wide Web. |n System requirements: Internet connectivity; Web browser software."); tag533.Control_Field_Value = builder533.ToString(); tags.Add_Field(tag533); } // Add the endeca only tags if (( !String.IsNullOrEmpty(SystemAbbreviation)) || ( !String.IsNullOrEmpty(LocationCode))) { // Add the 852 MARC_Field tag852 = new MARC_Field { Tag = 852, Indicators = " " }; StringBuilder builder852 = new StringBuilder(100); if (!String.IsNullOrEmpty(LocationCode)) { builder852.Append("|a " + LocationCode + " "); if (!String.IsNullOrEmpty(SystemAbbreviation)) builder852.Append("|b " + SystemAbbreviation); } else { builder852.Append("|a " + SystemAbbreviation); } if ( !String.IsNullOrEmpty(first_aggr_name)) builder852.Append(" |c " + first_aggr_name); tag852.Control_Field_Value = builder852.ToString(); tags.Add_Field(tag852); } // Add the collection name in the Endeca spot (997) if (!String.IsNullOrEmpty(first_aggr_name)) { tags.Add_Field(new MARC_Field(997, " ", "|a " + first_aggr_name)); } // Now, set the leader tags.Leader = MARC_Leader(); return tags; }
private static void Add_Subject(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, string topical_codes, string geographic_codes, string temporal_codes, string genre_codes, string occupation_codes) { // Step through all of the subjects under this tag int subj_index = 1; string source; foreach (MARC_Field thisRecord in record[tag]) { // Only continue if there is an id in this record if (thisRecord.has_Subfield('a')) { // Was there a source? source = String.Empty; if (thisRecord.has_Subfield('2')) { source = thisRecord['2']; } else if ((tag != 653)) { switch (thisRecord.Indicator2) { case '0': source = "lcsh"; break; case '1': source = "lcshac"; break; case '2': source = "mesh"; break; case '3': source = "nal"; break; case '5': source = "csh"; break; case '6': source = "rvm"; break; case '9': source = "local"; break; } } Subject_Info_Standard obj = new Subject_Info_Standard(); obj.Authority = source; obj.ID = "SUBJ" + tag + "_" + subj_index; subj_index++; // Add the topics foreach (char thisTopicChar in topical_codes) { if (thisRecord.has_Subfield(thisTopicChar)) { string topicString = thisRecord[thisTopicChar]; if (topicString.IndexOf("|") > 0) { string[] topicStringSplit = topicString.Split("|".ToCharArray()); foreach (string thisTopicString in topicStringSplit) obj.Add_Topic(Remove_Trailing_Punctuation(thisTopicString)); } else { obj.Add_Topic(Remove_Trailing_Punctuation(topicString)); } } } // Add the temporals foreach (char thisTempChar in temporal_codes) { if (thisRecord.has_Subfield(thisTempChar)) { string tempString = thisRecord[thisTempChar]; if (tempString.IndexOf("|") > 0) { string[] tempStringSplit = tempString.Split("|".ToCharArray()); foreach (string thisTempString in tempStringSplit) obj.Add_Temporal(Remove_Trailing_Punctuation(thisTempString)); } else { obj.Add_Temporal(Remove_Trailing_Punctuation(tempString)); } } } // Add the geographics foreach (char thisGeoChar in geographic_codes) { if (thisRecord.has_Subfield(thisGeoChar)) { string geoString = thisRecord[thisGeoChar]; if (geoString.IndexOf("|") > 0) { string[] geoStringSplit = geoString.Split("|".ToCharArray()); foreach (string thisGeoString in geoStringSplit) obj.Add_Geographic(Remove_Trailing_Punctuation(thisGeoString)); } else { obj.Add_Geographic(Remove_Trailing_Punctuation(geoString)); } } } // Add the genres foreach (char thisGenreChar in genre_codes) { if (thisRecord.has_Subfield(thisGenreChar)) { string genreString = thisRecord[thisGenreChar]; if (genreString.IndexOf("|") > 0) { string[] genreStringSplit = genreString.Split("|".ToCharArray()); foreach (string thisGenreString in genreStringSplit) obj.Add_Genre(Remove_Trailing_Punctuation(thisGenreString)); } else { obj.Add_Genre(Remove_Trailing_Punctuation(genreString)); } } } // Add the occupations foreach (char thisOccChar in occupation_codes) { if (thisRecord.has_Subfield(thisOccChar)) { string occString = thisRecord[thisOccChar].Replace("--", "|"); if (occString.IndexOf("|") > 0) { string[] occStringSplit = occString.Split("|".ToCharArray()); foreach (string thisOccString in occStringSplit) obj.Add_Occupation(Remove_Trailing_Punctuation(thisOccString.Trim())); } else { obj.Add_Occupation(Remove_Trailing_Punctuation(occString)); } } } // Add this subject thisBibInfo.Add_Subject(obj); } } }
private static void read_subject_object(XmlReader r, Bibliographic_Info thisBibInfo) { string language = String.Empty; string authority = String.Empty; string id = String.Empty; if (r.MoveToAttribute("ID")) id = r.Value; if (r.MoveToAttribute("lang")) language = r.Value; if (r.MoveToAttribute("authority")) authority = r.Value; // Move to the next element while (r.Read()) { if (r.NodeType == XmlNodeType.Element) break; } // Determine the subject type Subject_Info_Type type = Subject_Info_Type.UNKNOWN; // What is the name of this node? switch (r.Name) { case "mods:topic": case "mods:geographic": case "mods:genre": case "mods:temporal": case "mods:occupation": case "topic": case "geographic": case "genre": case "temporal": case "occupation": type = Subject_Info_Type.Standard; break; case "mods:hierarchicalGeographic": case "hierarchicalGeographic": type = Subject_Info_Type.Hierarchical_Spatial; break; case "mods:cartographics": case "cartographics": type = Subject_Info_Type.Cartographics; break; case "mods:name": case "name": type = Subject_Info_Type.Name; break; case "mods:titleInfo": case "titleInfo": type = Subject_Info_Type.TitleInfo; break; } // If no type was determined, return null if (type == Subject_Info_Type.UNKNOWN) return; // Was this the standard subject object? if (type == Subject_Info_Type.Standard) { Subject_Info_Standard standardSubject = new Subject_Info_Standard(); standardSubject.Language = language; standardSubject.Authority = authority; standardSubject.ID = id; do { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject"))) { if ((standardSubject.Topics_Count > 0) || (standardSubject.Geographics_Count > 0) || (standardSubject.Genres_Count > 0) || (standardSubject.Temporals_Count > 0) || (standardSubject.Occupations_Count > 0)) { thisBibInfo.Add_Subject(standardSubject); } return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:topic": case "topic": r.Read(); if (r.NodeType == XmlNodeType.Text) standardSubject.Add_Topic(r.Value); break; case "mods:geographic": case "geographic": r.Read(); if (r.NodeType == XmlNodeType.Text) standardSubject.Add_Geographic(r.Value); break; case "mods:genre": case "genre": r.Read(); if (r.NodeType == XmlNodeType.Text) standardSubject.Add_Genre(r.Value); break; case "mods:temporal": case "temporal": r.Read(); if (r.NodeType == XmlNodeType.Text) standardSubject.Add_Temporal(r.Value); break; case "mods:occupation": case "occupation": r.Read(); if (r.NodeType == XmlNodeType.Text) standardSubject.Add_Occupation(r.Value); break; } } } while (r.Read()); } // Was this the hierarchical geography subject? if (type == Subject_Info_Type.Hierarchical_Spatial) { Subject_Info_HierarchicalGeographic geoSubject = new Subject_Info_HierarchicalGeographic(); geoSubject.Language = language; geoSubject.Authority = authority; geoSubject.ID = id; while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject"))) { thisBibInfo.Add_Subject(geoSubject); return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:continent": case "continent": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Continent = r.Value; break; case "mods:country": case "country": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Country = r.Value; break; case "mods:province": case "province": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Province = r.Value; break; case "mods:region": case "region": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Region = r.Value; break; case "mods:state": case "state": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.State = r.Value; break; case "mods:territory": case "territory": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Territory = r.Value; break; case "mods:county": case "county": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.County = r.Value; break; case "mods:city": case "city": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.City = r.Value; break; case "mods:citySection": case "citySection": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.CitySection = r.Value; break; case "mods:island": case "island": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Island = r.Value; break; case "mods:area": case "area": r.Read(); if (r.NodeType == XmlNodeType.Text) geoSubject.Area = r.Value; break; } } } } // Was this the cartographics subject? if (type == Subject_Info_Type.Cartographics) { Subject_Info_Cartographics mapSubject = new Subject_Info_Cartographics(); mapSubject.Language = language; mapSubject.Authority = authority; mapSubject.ID = id; while (r.Read()) { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject"))) { if ((mapSubject.Projection.Length > 0) || (mapSubject.Coordinates.Length > 0) || (mapSubject.Scale.Length > 0)) { thisBibInfo.Add_Subject(mapSubject); } return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:coordinates": case "coordinates": r.Read(); if (r.NodeType == XmlNodeType.Text) mapSubject.Coordinates = r.Value; break; case "mods:scale": case "scale": r.Read(); if (r.NodeType == XmlNodeType.Text) mapSubject.Scale = r.Value; break; case "mods:projection": case "projection": r.Read(); if (r.NodeType == XmlNodeType.Text) mapSubject.Projection = r.Value; break; } } } } // Was this the name subject? if (type == Subject_Info_Type.Name) { Subject_Info_Name nameSubject = new Subject_Info_Name(); nameSubject.Language = language; nameSubject.Authority = authority; nameSubject.ID = id; do { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject"))) { thisBibInfo.Add_Subject(nameSubject); return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:name": case "name": Name_Info nameInfo = read_name_object(r); nameSubject.Set_Internal_Name(nameInfo); break; case "mods:topic": case "topic": r.Read(); if (r.NodeType == XmlNodeType.Text) nameSubject.Add_Topic(r.Value); break; case "mods:geographic": case "geographic": r.Read(); if (r.NodeType == XmlNodeType.Text) nameSubject.Add_Geographic(r.Value); break; case "mods:genre": case "genre": r.Read(); if (r.NodeType == XmlNodeType.Text) nameSubject.Add_Genre(r.Value); break; case "mods:temporal": case "temporal": r.Read(); if (r.NodeType == XmlNodeType.Text) nameSubject.Add_Temporal(r.Value); break; } } } while (r.Read()); } // Was this the title subject? if (type == Subject_Info_Type.TitleInfo) { Subject_Info_TitleInfo titleSubject = new Subject_Info_TitleInfo(); titleSubject.Language = language; titleSubject.Authority = authority; titleSubject.ID = id; do { if ((r.NodeType == XmlNodeType.EndElement) && ((r.Name == "mods:subject") || (r.Name == "subject"))) { thisBibInfo.Add_Subject(titleSubject); return; } if (r.NodeType == XmlNodeType.Element) { switch (r.Name) { case "mods:titleInfo": case "titleInfo": Title_Info titleInfo = read_title_object(r); titleSubject.Set_Internal_Title(titleInfo); break; case "mods:topic": case "topic": r.Read(); if (r.NodeType == XmlNodeType.Text) titleSubject.Add_Topic(r.Value); break; case "mods:geographic": case "geographic": r.Read(); if (r.NodeType == XmlNodeType.Text) titleSubject.Add_Geographic(r.Value); break; case "mods:genre": case "genre": r.Read(); if (r.NodeType == XmlNodeType.Text) titleSubject.Add_Genre(r.Value); break; case "mods:temporal": case "temporal": r.Read(); if (r.NodeType == XmlNodeType.Text) titleSubject.Add_Temporal(r.Value); break; } } } while (r.Read()); } }
/// <summary> Saves the data rendered by this element to the provided bibliographic object during postback </summary> /// <param name="Bib"> Object into which to save the user's data, entered into the html rendered by this element </param> public override void Save_To_Bib(SobekCM_Item Bib) { string[] getKeys = HttpContext.Current.Request.Form.AllKeys; foreach (string thisKey in getKeys) { if (thisKey.IndexOf("formsubjecttype_") == 0) { string diff = thisKey.Replace("formsubjecttype_",""); string topic1 = HttpContext.Current.Request.Form["formsubjecttopic1_" + diff].Trim(); string topic2 = HttpContext.Current.Request.Form["formsubjecttopic2_" + diff].Trim(); string topic3 = HttpContext.Current.Request.Form["formsubjecttopic3_" + diff].Trim(); string topic4 = HttpContext.Current.Request.Form["formsubjecttopic4_" + diff].Trim(); string temporal1 = HttpContext.Current.Request.Form["formsubjecttemporal1_" + diff].Trim(); string temporal2 = HttpContext.Current.Request.Form["formsubjecttemporal2_" + diff].Trim(); string geographic1 = HttpContext.Current.Request.Form["formsubjectgeo1_" + diff].Trim(); string geographic2 = HttpContext.Current.Request.Form["formsubjectgeo2_" + diff].Trim(); string genre1 = HttpContext.Current.Request.Form["formsubjectgenre1_" + diff].Trim(); string genre2 = HttpContext.Current.Request.Form["formsubjectgenre2_" + diff].Trim(); string occcupation = HttpContext.Current.Request.Form["formsubjectoccup1_" + diff].Trim(); string authority = HttpContext.Current.Request.Form["formsubjectauthority_" + diff].Trim(); string language = HttpContext.Current.Request.Form["formsubjectlanguage_" + diff].Trim(); string marc = HttpContext.Current.Request.Form["formsubjectmap_" + diff].Trim(); if ((topic1.Length > 0) || (topic2.Length > 0) || (topic3.Length > 0) || (topic4.Length > 0) || (temporal1.Length > 0) || (temporal2.Length > 0) || (geographic1.Length > 0) || (geographic2.Length > 0) || (genre1.Length > 0) || (genre2.Length > 0) || (occcupation.Length > 0)) { Subject_Info_Standard newSubject = new Subject_Info_Standard(); if (topic1.Length > 0) newSubject.Add_Topic(topic1); if (topic2.Length > 0) newSubject.Add_Topic(topic2); if (topic3.Length > 0) newSubject.Add_Topic(topic3); if (topic4.Length > 0) newSubject.Add_Topic(topic4); if (temporal1.Length > 0) newSubject.Add_Temporal(temporal1); if (temporal2.Length > 0) newSubject.Add_Temporal(temporal2); if (geographic1.Length > 0) newSubject.Add_Geographic(geographic1); if (geographic2.Length > 0) newSubject.Add_Geographic(geographic2); if (genre1.Length > 0) newSubject.Add_Genre(genre1); if (genre2.Length > 0) newSubject.Add_Genre(genre2); if (occcupation.Length > 0) newSubject.Add_Occupation(occcupation); newSubject.Authority = authority; newSubject.Language = language; if ((marc.Length > 0) && (marc != "none")) { newSubject.ID = "SUBJ" + marc + "_" + diff; } Bib.Bib_Info.Add_Subject(newSubject); } } } }