/// <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); } } }
/// <summary> Reads the MARC Core-compliant section of XML and stores the data in the provided digital resource </summary> /// <param name="r"> XmlTextReader from which to read the marc data </param> /// <param name="thisBibInfo">Bibliographic object into which most the values are read</param> /// <param name="package"> Digital resource object to save the data to if this is reading the top-level bibDesc (OPTIONAL)</param> /// <param name="Importing_Record"> Importing record flag is used to determine if special treatment should be applied to the 001 identifier. If this is reading MarcXML from a dmdSec, this is set to false </param> /// <param name="Options"> Dictionary of any options which this metadata reader/writer may utilize </param> public static void Read_MarcXML_Info(XmlReader r, Bibliographic_Info thisBibInfo, SobekCM_Item package, bool Importing_Record, Dictionary<string, object> Options ) { // Create the MARC_XML_Reader to load everything into first MARC_Record record = new MARC_Record(); // Read from the file record.Read_MARC_Info(r); // Handle optional mapping first for retaining the 856 as a related link if ((Options != null) && (Options.ContainsKey("MarcXML_File_ReaderWriter.Retain_856_As_Related_Link"))) { if (Options["MarcXML_File_ReaderWriter.Retain_856_As_Related_Link"].ToString().ToUpper() == "TRUE") { if ((record.Get_Data_Subfield(856, 'u').Length > 0) && (record.Get_Data_Subfield(856, 'y').Length > 0)) { string url856 = record.Get_Data_Subfield(856, 'u'); string label856 = record.Get_Data_Subfield(856, 'y'); thisBibInfo.Location.Other_URL = url856; thisBibInfo.Location.Other_URL_Note = label856; } } } // Now, load values into the bib package // Load the date ( 260 |c ) thisBibInfo.Origin_Info.MARC_DateIssued = Remove_Trailing_Punctuation(record.Get_Data_Subfield(260, 'c')); // Load the descriptions and notes about this item Add_Descriptions(thisBibInfo, record); // Look for the 786 with special identifiers to map back into the source notes foreach (MARC_Field thisRecord in record[786]) { if ((thisRecord.Indicators == "0 ") && (thisRecord.Subfield_Count == 1) && (thisRecord.has_Subfield('n'))) thisBibInfo.Add_Note(thisRecord.Subfields[0].Data, Note_Type_Enum.Source); } // Add the contents (505) if (record.Get_Data_Subfield(505, 'a').Length > 2) { thisBibInfo.Add_TableOfContents(record.Get_Data_Subfield(505, 'a')); } // Get the scale information (034) if (record.Get_Data_Subfield(034, 'b').Length > 2) { thisBibInfo.Add_Scale(record.Get_Data_Subfield(034, 'b'), "SUBJ034"); } // Get the scale information (255) if ((record.Get_Data_Subfield(255, 'a').Length > 2) || (record.Get_Data_Subfield(255, 'b').Length > 2) || (record.Get_Data_Subfield(255, 'c').Length > 2)) { thisBibInfo.Add_Scale(record.Get_Data_Subfield(255, 'a'), record.Get_Data_Subfield(255, 'b'), record.Get_Data_Subfield(255, 'c'), "SUBJ255"); } // Get the coordinate information (034) if ((record.Get_Data_Subfield(034, 'd').Length > 0) && (record.Get_Data_Subfield(034, 'e').Length > 0) && (record.Get_Data_Subfield(034, 'f').Length > 0) && (record.Get_Data_Subfield(034, 'g').Length > 0)) { // This is an extra metadata component GeoSpatial_Information geoInfo = package.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { geoInfo = new GeoSpatial_Information(); package.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoInfo); } if (geoInfo.Polygon_Count == 0) { try { string d_field = record.Get_Data_Subfield(034, 'd').Replace("O", "0"); string e_field = record.Get_Data_Subfield(034, 'e').Replace("O", "0"); string f_field = record.Get_Data_Subfield(034, 'f').Replace("O", "0"); string g_field = record.Get_Data_Subfield(034, 'g').Replace("O", "0"); double d_value = 1; double e_value = 1; double f_value = 1; double g_value = 1; if (d_field.Contains(".")) { if (d_field.Contains("W")) { d_value = -1*Convert.ToDouble(d_field.Replace("W", "")); } else { d_value = Convert.ToDouble(d_field.Replace("E", "")); } } else { d_value = Convert.ToDouble(d_field.Substring(1, 3)) + (Convert.ToDouble(d_field.Substring(4, 2))/60); if ((d_field[0] == '-') || (d_field[0] == 'W')) { d_value = -1*d_value; } } if (d_value < -180) d_value = d_value + 360; if (e_field.Contains(".")) { if (e_field.Contains("W")) { e_value = -1*Convert.ToDouble(e_field.Replace("W", "")); } else { e_value = Convert.ToDouble(e_field.Replace("E", "")); } } else { e_value = Convert.ToDouble(e_field.Substring(1, 3)) + (Convert.ToDouble(e_field.Substring(4, 2))/60); if ((e_field[0] == '-') || (e_field[0] == 'W')) { e_value = -1*e_value; } } if (e_value < -180) e_value = e_value + 360; if (f_field.Contains(".")) { if (f_field.Contains("S")) { f_value = -1*Convert.ToDouble(f_field.Replace("S", "")); } else { f_value = Convert.ToDouble(f_field.Replace("N", "")); } } else { f_value = Convert.ToDouble(f_field.Substring(1, 3)) + (Convert.ToDouble(f_field.Substring(4, 2))/60); if ((f_field[0] == '-') || (f_field[0] == 'S')) { f_value = -1*f_value; } } if (g_field.Contains(".")) { if (g_field.Contains("S")) { g_value = -1*Convert.ToDouble(g_field.Replace("S", "")); } else { g_value = Convert.ToDouble(g_field.Replace("N", "")); } } else { g_value = Convert.ToDouble(g_field.Substring(1, 3)) + (Convert.ToDouble(g_field.Substring(4, 2))/60); if ((g_field[0] == '-') || (g_field[0] == 'S')) { g_value = -1*g_value; } } Coordinate_Polygon polygon = new Coordinate_Polygon(); polygon.Add_Edge_Point(f_value, d_value); polygon.Add_Edge_Point(g_value, d_value); polygon.Add_Edge_Point(g_value, e_value); polygon.Add_Edge_Point(f_value, e_value); polygon.Label = "Map Coverage"; geoInfo.Add_Polygon(polygon); } catch { } } } // Add the abstract ( 520 |a ) foreach (MARC_Field thisRecord in record[520]) { if (thisRecord.has_Subfield('a')) { Abstract_Info newAbstract = new Abstract_Info(); switch (thisRecord.Indicator1) { case ' ': newAbstract.Type = "summary"; newAbstract.Display_Label = "Summary"; break; case '0': newAbstract.Type = "subject"; newAbstract.Display_Label = "Subject"; break; case '1': newAbstract.Type = "review"; newAbstract.Display_Label = "Review"; break; case '2': newAbstract.Type = "scope and content"; newAbstract.Display_Label = "Scope and Content"; break; case '4': newAbstract.Type = "content advice"; newAbstract.Display_Label = "Content Advice"; break; default: newAbstract.Display_Label = "Abstract"; break; } if (thisRecord.has_Subfield('b')) { newAbstract.Abstract_Text = thisRecord['a'] + " " + thisRecord['b']; } else { newAbstract.Abstract_Text = thisRecord['a']; } thisBibInfo.Add_Abstract(newAbstract); } } // Load the format ( 300 ) if (record.has_Field(300)) { StringBuilder builder300 = new StringBuilder(); if (record.Get_Data_Subfield(300, 'a').Length > 0) { builder300.Append(record.Get_Data_Subfield(300, 'a').Replace(":", "").Replace(";", "").Trim()); } builder300.Append(" : "); if (record.Get_Data_Subfield(300, 'b').Length > 0) { builder300.Append(record.Get_Data_Subfield(300, 'b').Replace(";", "").Trim()); } builder300.Append(" ; "); if (record.Get_Data_Subfield(300, 'c').Length > 0) { builder300.Append(record.Get_Data_Subfield(300, 'c')); } thisBibInfo.Original_Description.Extent = builder300.ToString().Trim(); if (thisBibInfo.Original_Description.Extent.Replace(" ", "").Replace(":", "").Replace(";", "") == "v.") thisBibInfo.Original_Description.Extent = String.Empty; } // Load the current frequency (310) foreach (MARC_Field thisRecord in record[310]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('b')) { thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[" + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]"); } else { thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")")); } } } // Load the previous frequency (321) foreach (MARC_Field thisRecord in record[321]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('b')) { thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + "]"); } else { thisBibInfo.Origin_Info.Add_Frequency(Remove_Trailing_Punctuation(thisRecord['a']).Replace("[", "(").Replace("]", ")") + "[ FORMER ]"); } } } // Load the edition ( 250 ) if (record.has_Field(250)) { if (record.Get_Data_Subfield(250, 'b').Length > 0) { thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a').Replace("/", "").Replace("=", "").Trim() + " -- " + record.Get_Data_Subfield(250, 'b'); } else { thisBibInfo.Origin_Info.Edition = record.Get_Data_Subfield(250, 'a'); } } // Load the language ( 008 ) if (record.has_Field(8)) { string field_08 = record[8][0].Control_Field_Value; if (field_08.Length > 5) { // Get the language code string languageCode = field_08.Substring(field_08.Length - 5, 3); // Add as the language of the item Language_Info thisLanguage = thisBibInfo.Add_Language(String.Empty, languageCode, String.Empty); // Add as the language of the cataloging thisBibInfo.Record.Add_Catalog_Language(new Language_Info(thisLanguage.Language_Text, thisLanguage.Language_ISO_Code, String.Empty)); } } // Load any additional languages (041) foreach (MARC_Field thisRecord in record[041]) { foreach (MARC_Subfield thisSubfield in thisRecord.Subfields) { if ((thisSubfield.Subfield_Code == 'a') || (thisSubfield.Subfield_Code == 'b') || (thisSubfield.Subfield_Code == 'd') || (thisSubfield.Subfield_Code == 'e') || (thisSubfield.Subfield_Code == 'f') || (thisSubfield.Subfield_Code == 'g') || (thisSubfield.Subfield_Code == 'h')) { thisBibInfo.Add_Language(thisSubfield.Data); } } } // Load the publisher ( 260 |b ) if (record.has_Field(260)) { string[] special_260_splitter = record[260][0].Control_Field_Value.Split("|".ToCharArray()); Publisher_Info thisInfo = new Publisher_Info(); foreach (string thisSplitter in special_260_splitter) { if (thisSplitter.Length > 2) { if (thisSplitter[0] == 'a') { thisInfo.Add_Place(Remove_Trailing_Punctuation(thisSplitter.Substring(2).Replace(" :", "").Trim())); thisInfo.Name = "[s.n.]"; thisBibInfo.Add_Publisher(thisInfo); } if (thisSplitter[0] == 'b') { string pubname = thisSplitter.Substring(2).Replace(";", "").Trim(); if ((pubname.Length > 1) && (pubname[pubname.Length - 1] == ',')) { pubname = pubname.Substring(0, pubname.Length - 1); } thisInfo.Name = pubname; thisBibInfo.Add_Publisher(thisInfo); thisInfo = new Publisher_Info(); } if (thisSplitter[0] == 'e') { thisInfo.Add_Place(thisSplitter.Substring(2).Replace("(", "").Replace(" :", "").Trim()); } if (thisSplitter[0] == 'f') { string manname = thisSplitter.Substring(2).Replace(")", "").Trim(); if ((manname.Length > 1) && (manname[manname.Length - 1] == ',')) { manname = manname.Substring(0, manname.Length - 1); } thisInfo.Name = manname; thisBibInfo.Add_Manufacturer(thisInfo); thisInfo = new Publisher_Info(); } } } } // Load the dates from the 008 string field_008 = String.Empty; if (record.has_Field(008)) { field_008 = record[8][0].Control_Field_Value; if (field_008.Length > 14) { // Save the two date points thisBibInfo.Origin_Info.MARC_DateIssued_Start = field_008.Substring(7, 4).Trim(); thisBibInfo.Origin_Info.MARC_DateIssued_End = field_008.Substring(11, 4).Trim(); // See what type of dates they are (if they are special) char date_type = field_008[6]; switch (date_type) { case 'r': thisBibInfo.Origin_Info.Date_Reprinted = thisBibInfo.Origin_Info.MARC_DateIssued_Start; break; case 't': thisBibInfo.Origin_Info.Date_Copyrighted = thisBibInfo.Origin_Info.MARC_DateIssued_End; break; } } if (field_008.Length > 5) { thisBibInfo.Record.MARC_Creation_Date = field_008.Substring(0, 6); } } // Load the location from the 008 if (field_008.Length > 17) { thisBibInfo.Origin_Info.Add_Place(String.Empty, field_008.Substring(15, 3), String.Empty); } // Load the main record number ( 001 ) string idValue; string oclc = String.Empty; if (record.has_Field(1)) { idValue = record[1][0].Control_Field_Value.Trim(); if (idValue.Length > 0) { thisBibInfo.Record.Main_Record_Identifier.Identifier = idValue; if (Importing_Record) { if (Char.IsNumber(idValue[0])) { // Add this ALEPH number if (thisBibInfo.ALEPH_Record != idValue) { thisBibInfo.Add_Identifier(idValue, "ALEPH"); } thisBibInfo.Record.Record_Origin = "Imported from (ALEPH)" + idValue; } else { if (idValue.Length >= 7) { if ((idValue.IndexOf("ocm") == 0) || (idValue.IndexOf("ocn") == 0)) { oclc = idValue.Replace("ocn", "").Replace("ocm", ""); if (thisBibInfo.OCLC_Record != oclc) { thisBibInfo.Add_Identifier(oclc, "OCLC"); } thisBibInfo.Record.Record_Origin = "Imported from (OCLC)" + oclc; } else { thisBibInfo.Add_Identifier(idValue.Substring(0, 7), "NOTIS"); thisBibInfo.Record.Record_Origin = "Imported from (NOTIS)" + idValue.Substring(0, 7); } } } } } } // If this was OCLC record (non-local) look for a 599 added during time of export if (oclc.Length > 0) { if (record.has_Field(599)) { // Tracking box number will be in the |a field if ((package != null) && (record[599][0].has_Subfield('a'))) { package.Tracking.Tracking_Box = record[599][0]['a']; } // Disposition advice will be in the |b field if ((package != null) && (record[599][0].has_Subfield('b'))) { package.Tracking.Disposition_Advice_Notes = record[599][0]['b']; string advice_notes_as_caps = package.Tracking.Disposition_Advice_Notes.ToUpper(); if ((advice_notes_as_caps.IndexOf("RETURN") >= 0) || (advice_notes_as_caps.IndexOf("RETAIN") >= 0)) { package.Tracking.Disposition_Advice = 1; } else { if (advice_notes_as_caps.IndexOf("WITHDRAW") >= 0) { package.Tracking.Disposition_Advice = 2; } else if (advice_notes_as_caps.IndexOf("DISCARD") >= 0) { package.Tracking.Disposition_Advice = 3; } } } // Do not overlay record in the future will be in the |c field if (record[599][0].has_Subfield('c')) { string record_overlay_notes = record[599][0]['c'].Trim(); if (record_overlay_notes.Length > 0) { if (package != null) { package.Tracking.Never_Overlay_Record = true; package.Tracking.Internal_Comments = record_overlay_notes; } thisBibInfo.Record.Record_Content_Source = thisBibInfo.Record.Record_Content_Source + " (" + record_overlay_notes + ")"; } } } } // Step through all of the identifiers foreach (MARC_Field thisRecord in record[35]) { // Only continue if there is an id in this record if (thisRecord.has_Subfield('a')) { // Was this the old NOTIS number? if (thisRecord.Indicators == "9 ") { thisBibInfo.Add_Identifier(thisRecord['a'], "NOTIS"); } // Was this the OCLC number? if ((oclc.Length == 0) && (thisRecord['a'].ToUpper().IndexOf("OCOLC") >= 0)) { thisBibInfo.Add_Identifier(thisRecord['a'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC"); } // Was this the BIB ID? if ((package != null) && (thisRecord['a'].ToUpper().IndexOf("IID") >= 0)) { package.BibID = thisRecord['a'].ToUpper().Replace("(IID)", "").Trim(); } } } // Also, look for the old original OCLC in the 776 10 |w if (thisBibInfo.OCLC_Record.Length == 0) { foreach (MARC_Field thisRecord in record[776]) { if ((thisRecord.Indicators == "1 ") && (thisRecord.has_Subfield('w')) && (thisRecord['w'].ToUpper().IndexOf("OCOLC") >= 0)) { thisBibInfo.Add_Identifier(thisRecord['w'].ToUpper().Replace("(OCOLC)", "").Trim(), "OCLC"); } } } // Look for the LCCN in field 10 if (record.Get_Data_Subfield(10, 'a').Length > 0) thisBibInfo.Add_Identifier(record.Get_Data_Subfield(10, 'a'), "LCCN"); // Look for ISBN in field 20 if (record.Get_Data_Subfield(20, 'a').Length > 0) thisBibInfo.Add_Identifier(record.Get_Data_Subfield(20, 'a'), "ISBN"); // Look for ISSN in field 22 if (record.Get_Data_Subfield(22, 'a').Length > 0) thisBibInfo.Add_Identifier(record.Get_Data_Subfield(22, 'a'), "ISSN"); // Look for classification ( LCC ) in field 50 if (record.Get_Data_Subfield(50, 'a').Length > 0) { string subfield_3 = String.Empty; if (record.Get_Data_Subfield(50, '3').Length > 0) { subfield_3 = record.Get_Data_Subfield(50, '3'); } if (record.Get_Data_Subfield(50, 'b').Length > 0) thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a') + " " + record.Get_Data_Subfield(50, 'b'), "lcc").Display_Label = subfield_3; else thisBibInfo.Add_Classification(record.Get_Data_Subfield(50, 'a'), "lcc").Display_Label = subfield_3; } // Look for classification ( DDC ) in field 82 if (record.Get_Data_Subfield(82, 'a').Length > 0) { string subfield_2 = String.Empty; if (record.Get_Data_Subfield(82, '2').Length > 0) { subfield_2 = record.Get_Data_Subfield(82, '2'); } if (record.Get_Data_Subfield(82, 'b').Length > 0) thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a') + " " + record.Get_Data_Subfield(82, 'b'), "ddc").Edition = subfield_2; else thisBibInfo.Add_Classification(record.Get_Data_Subfield(82, 'a'), "ddc").Edition = subfield_2; } // Look for classification ( UDC ) in field 80 if (record.Get_Data_Subfield(80, 'a').Length > 0) { StringBuilder builder = new StringBuilder(); builder.Append(record.Get_Data_Subfield(80, 'a')); if (record.Get_Data_Subfield(80, 'b').Length > 0) builder.Append(" " + record.Get_Data_Subfield(80, 'b')); if (record.Get_Data_Subfield(80, 'x').Length > 0) builder.Append(" " + record.Get_Data_Subfield(80, 'x')); thisBibInfo.Add_Classification(builder.ToString(), "udc"); } // Look for classification ( NLM ) in field 60 if (record.Get_Data_Subfield(60, 'a').Length > 0) { if (record.Get_Data_Subfield(60, 'b').Length > 0) thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a') + " " + record.Get_Data_Subfield(60, 'b'), "nlm"); else thisBibInfo.Add_Classification(record.Get_Data_Subfield(60, 'a'), "nlm"); } // Look for classification ( SUDOCS or CANDOCS ) in field 86 foreach (MARC_Field thisRecord in record[84]) { string authority = String.Empty; switch (thisRecord.Indicator1) { case '0': authority = "sudocs"; break; case '1': authority = "candocs"; break; default: if (thisRecord.has_Subfield('2')) authority = thisRecord['2']; break; } if (thisRecord.has_Subfield('a')) thisBibInfo.Add_Classification(thisRecord['a'], authority); } // Look for other classifications in field 084 foreach (MARC_Field thisRecord in record[84]) { if (thisRecord.has_Subfield('a')) { string subfield_2 = String.Empty; if (thisRecord.has_Subfield('2')) { subfield_2 = thisRecord['2']; } if (thisRecord.has_Subfield('b')) thisBibInfo.Add_Classification(thisRecord['a'] + " " + thisRecord['b'], subfield_2); else thisBibInfo.Add_Classification(thisRecord['a'], subfield_2); } } // Look for any other identifiers in field 24 foreach (MARC_Field thisRecord in record[24]) { string identifier_source = String.Empty; switch (thisRecord.Indicator1) { case '0': identifier_source = "isrc"; break; case '1': identifier_source = "upc"; break; case '2': identifier_source = "ismn"; break; case '3': identifier_source = "ian"; break; case '4': identifier_source = "sici"; break; case '7': identifier_source = thisRecord['2']; break; } if (thisRecord.has_Subfield('d')) { thisBibInfo.Add_Identifier(thisRecord['a'] + " (" + thisRecord['d'] + ")", identifier_source); } else { thisBibInfo.Add_Identifier(thisRecord['a'], identifier_source); } } // Look for the ISSN in the 440 and 490 |x and LCCN in the 490 |l foreach (MARC_Field thisRecord in record[440]) { if (thisRecord.has_Subfield('x')) { thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN"); } } foreach (MARC_Field thisRecord in record[490]) { if (thisRecord.has_Subfield('x')) { thisBibInfo.Add_Identifier(thisRecord['x'], "ISSN"); } if (thisRecord.has_Subfield('l')) { thisBibInfo.Add_Identifier(thisRecord['l'], "LCCN"); } } // Load all the MARC Content Sources (040) if (record.has_Field(40)) { if (record.Get_Data_Subfield(40, 'a').Length > 0) { thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'a')); } if (record.Get_Data_Subfield(40, 'b').Length > 0) { thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'b')); } if (record.Get_Data_Subfield(40, 'c').Length > 0) { thisBibInfo.Record.Add_MARC_Record_Content_Sources(record.Get_Data_Subfield(40, 'c')); } string modifying = record.Get_Data_Subfield(40, 'd'); if (modifying.Length > 0) { string[] modSplitter = modifying.Split("|".ToCharArray()); foreach (string split in modSplitter) { thisBibInfo.Record.Add_MARC_Record_Content_Sources(split.Trim()); } } if (record.Get_Data_Subfield(40, 'e').Length > 0) { thisBibInfo.Record.Description_Standard = record.Get_Data_Subfield(40, 'e'); } } // Add the spatial information ( 752, 662 ) Add_Hierarchical_Subject(thisBibInfo, record, 752); Add_Hierarchical_Subject(thisBibInfo, record, 662); // Add all the subjects ( 600... 658, excluding 655 ) Add_Personal_Name(thisBibInfo, record, 600, 4); Add_Corporate_Name(thisBibInfo, record, 610, 4); Add_Conference_Name(thisBibInfo, record, 611, 4); Add_Main_Title(thisBibInfo, record, 630, Title_Type_Enum.UNSPECIFIED, 1, 4); // Add all additional subjects // Letters indicate which fields are: TOPICAL, GEOGRAPHIC, TEMPORAL, GENRE, OCCUPATION Add_Subject(thisBibInfo, record, 648, "x", "z", "ay", "v", ""); Add_Subject(thisBibInfo, record, 650, "ax", "z", "y", "v", ""); Add_Subject(thisBibInfo, record, 651, "x", "az", "y", "v", ""); Add_Subject(thisBibInfo, record, 653, "a", "", "", "", ""); Add_Subject(thisBibInfo, record, 654, "av", "y", "z", "", ""); Add_Subject(thisBibInfo, record, 655, "x", "z", "y", "av", ""); Add_Subject(thisBibInfo, record, 656, "x", "z", "y", "v", "a"); Add_Subject(thisBibInfo, record, 657, "ax", "z", "y", "v", ""); Add_Subject(thisBibInfo, record, 690, "ax", "z", "y", "v", ""); Add_Subject(thisBibInfo, record, 691, "x", "az", "y", "v", ""); // Add the genres (655 -- again) foreach (MARC_Field thisRecord in record[655]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('2')) thisBibInfo.Add_Genre(thisRecord['a'], thisRecord['2']); else thisBibInfo.Add_Genre(thisRecord['a']); } } // Add the abbreviated title (210) foreach (MARC_Field thisRecord in record[210]) { if (thisRecord.has_Subfield('a')) { Title_Info abbrTitle = new Title_Info(thisRecord['a'], Title_Type_Enum.Abbreviated); if (thisRecord.has_Subfield('b')) abbrTitle.Subtitle = thisRecord['b']; thisBibInfo.Add_Other_Title(abbrTitle); } } // Add the title ( 245 |a, |b ) Add_Main_Title(thisBibInfo, record, 245, Title_Type_Enum.UNSPECIFIED, 2, 1); // Add the translated titles ( 242 ) Add_Main_Title(thisBibInfo, record, 242, Title_Type_Enum.Translated, 2, 2); // Add the alternative titles ( 246, 740 ) Add_Main_Title(thisBibInfo, record, 246, Title_Type_Enum.Alternative, 0, 2); Add_Main_Title(thisBibInfo, record, 740, Title_Type_Enum.Alternative, 1, 2); // Add the uniform titles (130, 240, 730 ) Add_Main_Title(thisBibInfo, record, 130, Title_Type_Enum.Uniform, 1, 2); Add_Main_Title(thisBibInfo, record, 240, Title_Type_Enum.Uniform, 2, 2); Add_Main_Title(thisBibInfo, record, 730, Title_Type_Enum.Uniform, 1, 2); // Add the series titles ( 440, 490 ) Add_Main_Title(thisBibInfo, record, 440, Title_Type_Enum.UNSPECIFIED, 2, 3); Add_Main_Title(thisBibInfo, record, 490, Title_Type_Enum.UNSPECIFIED, 0, 3); // Add the creators and contributors ( 100, 110 , 111, 700, 710, 711, 720, 796, 797 ) Add_Personal_Name(thisBibInfo, record, 100, 1); Add_Personal_Name(thisBibInfo, record, 700, 2); Add_Personal_Name(thisBibInfo, record, 796, 3); Add_Corporate_Name(thisBibInfo, record, 110, 1); Add_Corporate_Name(thisBibInfo, record, 710, 2); Add_Corporate_Name(thisBibInfo, record, 797, 3); Add_Conference_Name(thisBibInfo, record, 111, 1); Add_Conference_Name(thisBibInfo, record, 711, 2); // Add the Other Edition Value (775) foreach (MARC_Field thisRecord in record[775]) { Related_Item_Info otherEditionItem = new Related_Item_Info(); otherEditionItem.Relationship = Related_Item_Type_Enum.OtherVersion; if (thisRecord.has_Subfield('t')) otherEditionItem.Main_Title.Title = thisRecord['t']; if (thisRecord.has_Subfield('x')) otherEditionItem.Add_Identifier(thisRecord['x'], "issn"); if (thisRecord.has_Subfield('z')) otherEditionItem.Add_Identifier(thisRecord['z'], "isbn"); if (thisRecord.has_Subfield('w')) { string[] splitter = thisRecord['w'].Split("|".ToCharArray()); foreach (string thisSplitter in splitter) { if (thisSplitter.IndexOf("(DLC)sn") >= 0) { otherEditionItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn"); } if (thisSplitter.IndexOf("(OCoLC)") >= 0) { otherEditionItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc"); } } } thisBibInfo.Add_Related_Item(otherEditionItem); } // Add the Preceding Entry (780) foreach (MARC_Field thisRecord in record[780]) { Related_Item_Info precedingItem = new Related_Item_Info(); precedingItem.Relationship = Related_Item_Type_Enum.Preceding; if (thisRecord.has_Subfield('t')) precedingItem.Main_Title.Title = thisRecord['t']; if (thisRecord.has_Subfield('x')) precedingItem.Add_Identifier(thisRecord['x'], "issn"); if (thisRecord.has_Subfield('z')) precedingItem.Add_Identifier(thisRecord['z'], "isbn"); if (thisRecord.has_Subfield('w')) { string[] splitter = thisRecord['w'].Split("|".ToCharArray()); foreach (string thisSplitter in splitter) { if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0)) { if (thisSplitter.IndexOf("(DLC)sn") >= 0) { precedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn"); } if (thisSplitter.IndexOf("(OCoLC)") >= 0) { precedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc"); } } else { precedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty); } } if (thisRecord.has_Subfield('o')) { if (thisRecord['o'].IndexOf("(SobekCM)") >= 0) precedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim(); } } thisBibInfo.Add_Related_Item(precedingItem); } // Add the Suceeding Entry (785) foreach (MARC_Field thisRecord in record[785]) { Related_Item_Info succeedingItem = new Related_Item_Info(); succeedingItem.Relationship = Related_Item_Type_Enum.Succeeding; if (thisRecord.has_Subfield('t')) succeedingItem.Main_Title.Title = thisRecord['t']; if (thisRecord.has_Subfield('x')) succeedingItem.Add_Identifier(thisRecord['x'], "issn"); if (thisRecord.has_Subfield('z')) succeedingItem.Add_Identifier(thisRecord['z'], "isbn"); if (thisRecord.has_Subfield('w')) { string[] splitter = thisRecord['w'].Split("|".ToCharArray()); foreach (string thisSplitter in splitter) { if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0)) { if (thisSplitter.IndexOf("(DLC)sn") >= 0) { succeedingItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn"); } if (thisSplitter.IndexOf("(OCoLC)") >= 0) { succeedingItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc"); } } else { succeedingItem.Add_Identifier(thisSplitter.Trim(), String.Empty); } } } if (thisRecord.has_Subfield('o')) { if (thisRecord['o'].IndexOf("(SobekCM)") >= 0) succeedingItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim(); } thisBibInfo.Add_Related_Item(succeedingItem); } // Add the Other Relationship Entry (787) foreach (MARC_Field thisRecord in record[787]) { Related_Item_Info otherRelationItem = new Related_Item_Info(); otherRelationItem.Relationship = Related_Item_Type_Enum.UNKNOWN; if (thisRecord.has_Subfield('t')) otherRelationItem.Main_Title.Title = thisRecord['t']; if (thisRecord.has_Subfield('x')) otherRelationItem.Add_Identifier(thisRecord['x'], "issn"); if (thisRecord.has_Subfield('z')) otherRelationItem.Add_Identifier(thisRecord['z'], "isbn"); if (thisRecord.has_Subfield('w')) { string[] splitter = thisRecord['w'].Split("|".ToCharArray()); foreach (string thisSplitter in splitter) { if ((thisSplitter.IndexOf("(DLC)sn") >= 0) || (thisSplitter.IndexOf("(OCoLC)") >= 0)) { if (thisSplitter.IndexOf("(DLC)sn") >= 0) { otherRelationItem.Add_Identifier(thisSplitter.Replace("(DLC)sn", "").Trim(), "lccn"); } if (thisSplitter.IndexOf("(OCoLC)") >= 0) { otherRelationItem.Add_Identifier(thisSplitter.Replace("(OCoLC)", "").Trim(), "oclc"); } } else { otherRelationItem.Add_Identifier(thisSplitter.Trim(), String.Empty); } } } if (thisRecord.has_Subfield('o')) { if (thisRecord['o'].IndexOf("(SobekCM)") >= 0) otherRelationItem.SobekCM_ID = thisRecord['o'].Replace("(SobekCM)", "").Trim(); } thisBibInfo.Add_Related_Item(otherRelationItem); } // Get the type of resource ( Leader/006, Leader/007, Serial 008/021 ) string marc_type = String.Empty; switch (record.Leader[6]) { case 'a': case 't': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book; marc_type = "BKS"; break; case 'e': case 'f': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Map; marc_type = "MAP"; break; case 'c': case 'd': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Book; marc_type = "BKS"; break; case 'i': case 'j': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Audio; marc_type = "REC"; break; case 'k': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Photograph; marc_type = "VIS"; break; case 'g': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Video; marc_type = "VIS"; break; case 'r': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Artifact; marc_type = "VIS"; break; case 'm': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival; marc_type = "COM"; break; case 'p': thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival; marc_type = "MIX"; break; case 'o': marc_type = "VIS"; thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Archival; break; } if (record.Leader[7] == 'c') thisBibInfo.Type.Collection = true; if (record.Leader[7] == 's') { thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Serial; if (field_008.Length > 22) { if (field_008[21] == 'n') thisBibInfo.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper; } marc_type = "CNR"; } thisBibInfo.EncodingLevel = record.Leader[17].ToString().Replace("^", "#").Replace(" ", "#"); if (field_008.Length > 35) { if ((marc_type == "BKS") || (marc_type == "CNR") || (marc_type == "MAP") || (marc_type == "COM") || (marc_type == "VIS")) { switch (field_008[28]) { case 'c': thisBibInfo.Add_Genre("multilocal government publication", "marcgt"); break; case 'f': thisBibInfo.Add_Genre("federal government publication", "marcgt"); break; case 'i': thisBibInfo.Add_Genre("international intergovernmental publication", "marcgt"); break; case 'l': thisBibInfo.Add_Genre("local government publication", "marcgt"); break; case 'm': thisBibInfo.Add_Genre("multistate government publication", "marcgt"); break; case 'o': thisBibInfo.Add_Genre("government publication", "marcgt"); break; case 's': thisBibInfo.Add_Genre("government publication (state, provincial, terriorial, dependent)", "marcgt"); break; case 'a': thisBibInfo.Add_Genre("government publication (autonomous or semiautonomous component)", "marcgt"); break; } } if ((marc_type == "BKS") || (marc_type == "CNR")) { string nature_of_contents = field_008.Substring(24, 4); if (nature_of_contents.IndexOf("a") >= 0) thisBibInfo.Add_Genre("abstract or summary", "marcgt"); if (nature_of_contents.IndexOf("b") >= 0) thisBibInfo.Add_Genre("bibliography", "marcgt"); if (nature_of_contents.IndexOf("c") >= 0) thisBibInfo.Add_Genre("catalog", "marcgt"); if (nature_of_contents.IndexOf("d") >= 0) thisBibInfo.Add_Genre("dictionary", "marcgt"); if (nature_of_contents.IndexOf("r") >= 0) thisBibInfo.Add_Genre("directory", "marcgt"); if (nature_of_contents.IndexOf("k") >= 0) thisBibInfo.Add_Genre("discography", "marcgt"); if (nature_of_contents.IndexOf("e") >= 0) thisBibInfo.Add_Genre("encyclopedia", "marcgt"); if (nature_of_contents.IndexOf("q") >= 0) thisBibInfo.Add_Genre("filmography", "marcgt"); if (nature_of_contents.IndexOf("f") >= 0) thisBibInfo.Add_Genre("handbook", "marcgt"); if (nature_of_contents.IndexOf("i") >= 0) thisBibInfo.Add_Genre("index", "marcgt"); if (nature_of_contents.IndexOf("w") >= 0) thisBibInfo.Add_Genre("law report or digest", "marcgt"); if (nature_of_contents.IndexOf("g") >= 0) thisBibInfo.Add_Genre("legal article", "marcgt"); if (nature_of_contents.IndexOf("v") >= 0) thisBibInfo.Add_Genre("legal case and case notes", "marcgt"); if (nature_of_contents.IndexOf("l") >= 0) thisBibInfo.Add_Genre("legislation", "marcgt"); if (nature_of_contents.IndexOf("j") >= 0) thisBibInfo.Add_Genre("patent", "marcgt"); if (nature_of_contents.IndexOf("p") >= 0) thisBibInfo.Add_Genre("programmed text", "marcgt"); if (nature_of_contents.IndexOf("o") >= 0) thisBibInfo.Add_Genre("review", "marcgt"); if (nature_of_contents.IndexOf("s") >= 0) thisBibInfo.Add_Genre("statistics", "marcgt"); if (nature_of_contents.IndexOf("n") >= 0) thisBibInfo.Add_Genre("survey of literature", "marcgt"); if (nature_of_contents.IndexOf("t") >= 0) thisBibInfo.Add_Genre("technical report", "marcgt"); if (nature_of_contents.IndexOf("m") >= 0) thisBibInfo.Add_Genre("theses", "marcgt"); if (nature_of_contents.IndexOf("z") >= 0) thisBibInfo.Add_Genre("treaty", "marcgt"); if (nature_of_contents.IndexOf("2") >= 0) thisBibInfo.Add_Genre("offprint", "marcgt"); if (nature_of_contents.IndexOf("y") >= 0) thisBibInfo.Add_Genre("yearbook", "marcgt"); if (nature_of_contents.IndexOf("5") >= 0) thisBibInfo.Add_Genre("calendar", "marcgt"); if (nature_of_contents.IndexOf("6") >= 0) thisBibInfo.Add_Genre("comic/graphic novel", "marcgt"); if (field_008[29] == '1') thisBibInfo.Add_Genre("conference publication", "marcgt"); } if (marc_type == "CNR") { if (field_008[21] == 'd') thisBibInfo.Add_Genre("database", "marcgt"); if (field_008[21] == 'l') thisBibInfo.Add_Genre("loose-leaf", "marcgt"); if (field_008[21] == 'n') thisBibInfo.Add_Genre("newspaper", "marcgt"); if (field_008[21] == 'p') thisBibInfo.Add_Genre("periodical", "marcgt"); if (field_008[21] == 's') thisBibInfo.Add_Genre("series", "marcgt"); if (field_008[21] == 'w') thisBibInfo.Add_Genre("web site", "marcgt"); // Get the frequency switch (field_008[18]) { case 'a': thisBibInfo.Origin_Info.Add_Frequency("annual", "marcfrequency"); break; case 'b': thisBibInfo.Origin_Info.Add_Frequency("bimonthly", "marcfrequency"); break; case 'c': thisBibInfo.Origin_Info.Add_Frequency("semiweekly", "marcfrequency"); break; case 'd': thisBibInfo.Origin_Info.Add_Frequency("daily", "marcfrequency"); break; case 'e': thisBibInfo.Origin_Info.Add_Frequency("biweekly", "marcfrequency"); break; case 'f': thisBibInfo.Origin_Info.Add_Frequency("semiannual", "marcfrequency"); break; case 'g': thisBibInfo.Origin_Info.Add_Frequency("biennial", "marcfrequency"); break; case 'h': thisBibInfo.Origin_Info.Add_Frequency("triennial", "marcfrequency"); break; case 'i': thisBibInfo.Origin_Info.Add_Frequency("three times a week", "marcfrequency"); break; case 'j': thisBibInfo.Origin_Info.Add_Frequency("three times a month", "marcfrequency"); break; case 'k': thisBibInfo.Origin_Info.Add_Frequency("continuously updated", "marcfrequency"); break; case 'm': thisBibInfo.Origin_Info.Add_Frequency("monthly", "marcfrequency"); break; case 'q': thisBibInfo.Origin_Info.Add_Frequency("quarterly", "marcfrequency"); break; case 's': thisBibInfo.Origin_Info.Add_Frequency("semimonthly", "marcfrequency"); break; case 't': thisBibInfo.Origin_Info.Add_Frequency("three times a year", "marcfrequency"); break; case 'w': thisBibInfo.Origin_Info.Add_Frequency("weekly", "marcfrequency"); break; case 'z': thisBibInfo.Origin_Info.Add_Frequency("other", "marcfrequency"); break; } // Get the regularity switch (field_008[19]) { case 'n': thisBibInfo.Origin_Info.Add_Frequency("normalized irregular", "marcfrequency"); break; case 'r': thisBibInfo.Origin_Info.Add_Frequency("regular", "marcfrequency"); break; case 'x': thisBibInfo.Origin_Info.Add_Frequency("completely irregular", "marcfrequency"); break; } } if (marc_type == "MAP") { // Get the form of item if (field_008[25] == 'e') thisBibInfo.Add_Genre("atlas", "marcgt"); if (field_008[25] == 'd') thisBibInfo.Add_Genre("globe", "marcgt"); if (field_008[25] == 'a') thisBibInfo.Add_Genre("single map", "marcgt"); if (field_008[25] == 'b') thisBibInfo.Add_Genre("map series", "marcgt"); if (field_008[25] == 'c') thisBibInfo.Add_Genre("map serial", "marcgt"); // Get the projection, if there is one if ((field_008.Substring(22, 2) != " ") && (field_008.Substring(22, 2) != "||") && (field_008.Substring(22, 2) != "^^") && (field_008.Substring(22, 2) != "||")) { Subject_Info_Cartographics cartographicsSubject = new Subject_Info_Cartographics(); cartographicsSubject.ID = "SUBJ008"; cartographicsSubject.Projection = field_008.Substring(22, 2); thisBibInfo.Add_Subject(cartographicsSubject); } // Get whether this is indexed if (field_008[31] == '1') { thisBibInfo.Add_Genre("indexed", "marcgt"); } } if (marc_type == "REC") { string nature_of_recording = field_008.Substring(30, 2); if (nature_of_recording.IndexOf("a") >= 0) thisBibInfo.Add_Genre("autobiography", "marcgt"); if (nature_of_recording.IndexOf("b") >= 0) thisBibInfo.Add_Genre("biography", "marcgt"); if (nature_of_recording.IndexOf("c") >= 0) thisBibInfo.Add_Genre("conference publication", "marcgt"); if (nature_of_recording.IndexOf("d") >= 0) thisBibInfo.Add_Genre("drama", "marcgt"); if (nature_of_recording.IndexOf("e") >= 0) thisBibInfo.Add_Genre("essay", "marcgt"); if (nature_of_recording.IndexOf("f") >= 0) thisBibInfo.Add_Genre("fiction", "marcgt"); if (nature_of_recording.IndexOf("o") >= 0) thisBibInfo.Add_Genre("folktale", "marcgt"); if (nature_of_recording.IndexOf("k") >= 0) thisBibInfo.Add_Genre("humor, satire", "marcgt"); if (nature_of_recording.IndexOf("i") >= 0) thisBibInfo.Add_Genre("instruction", "marcgt"); if (nature_of_recording.IndexOf("t") >= 0) thisBibInfo.Add_Genre("interview", "marcgt"); if (nature_of_recording.IndexOf("j") >= 0) thisBibInfo.Add_Genre("language instruction", "marcgt"); if (nature_of_recording.IndexOf("m") >= 0) thisBibInfo.Add_Genre("memoir", "marcgt"); if (nature_of_recording.IndexOf("p") >= 0) thisBibInfo.Add_Genre("poetry", "marcgt"); if (nature_of_recording.IndexOf("r") >= 0) thisBibInfo.Add_Genre("rehearsal", "marcgt"); if (nature_of_recording.IndexOf("g") >= 0) thisBibInfo.Add_Genre("reporting", "marcgt"); if (nature_of_recording.IndexOf("s") >= 0) thisBibInfo.Add_Genre("sound", "marcgt"); if (nature_of_recording.IndexOf("l") >= 0) thisBibInfo.Add_Genre("speech", "marcgt"); } if (marc_type == "COM") { switch (field_008[26]) { case 'e': thisBibInfo.Add_Genre("database", "marcgt"); break; case 'f': thisBibInfo.Add_Genre("font", "marcgt"); break; case 'g': thisBibInfo.Add_Genre("game", "marcgt"); break; case 'a': thisBibInfo.Add_Genre("numeric data", "marcgt"); break; case 'h': thisBibInfo.Add_Genre("sound", "marcgt"); break; } } if (marc_type == "VIS") { switch (field_008[33]) { case 'a': thisBibInfo.Add_Genre("art original", "marcgt"); break; case 'c': thisBibInfo.Add_Genre("art reproduction", "marcgt"); break; case 'n': thisBibInfo.Add_Genre("chart", "marcgt"); break; case 'd': thisBibInfo.Add_Genre("diorama", "marcgt"); break; case 'f': thisBibInfo.Add_Genre("filmstrip", "marcgt"); break; case 'o': thisBibInfo.Add_Genre("flash card", "marcgt"); break; case 'k': thisBibInfo.Add_Genre("graphic", "marcgt"); break; case 'b': thisBibInfo.Add_Genre("kit", "marcgt"); break; case 'p': thisBibInfo.Add_Genre("microscope slide", "marcgt"); break; case 'q': thisBibInfo.Add_Genre("model", "marcgt"); break; case 'm': thisBibInfo.Add_Genre("motion picture", "marcgt"); break; case 'i': thisBibInfo.Add_Genre("picture", "marcgt"); break; case 'r': thisBibInfo.Add_Genre("realia", "marcgt"); break; case 's': thisBibInfo.Add_Genre("slide", "marcgt"); break; case 'l': thisBibInfo.Add_Genre("technical drawing", "marcgt"); break; case 'w': thisBibInfo.Add_Genre("toy", "marcgt"); break; case 't': thisBibInfo.Add_Genre("transparency", "marcgt"); break; case 'v': thisBibInfo.Add_Genre("video recording", "marcgt"); break; } } if (marc_type == "BKS") { switch (field_008[34]) { case 'a': thisBibInfo.Add_Genre("autobiography", "marcgt"); break; case 'b': thisBibInfo.Add_Genre("individual biography", "marcgt"); break; case 'c': thisBibInfo.Add_Genre("collective biography", "marcgt"); break; } switch (field_008[33]) { case 'a': thisBibInfo.Add_Genre("comic strip", "marcgt"); break; case 'd': thisBibInfo.Add_Genre("drama", "marcgt"); break; case 'e': thisBibInfo.Add_Genre("essay", "marcgt"); break; case 'h': thisBibInfo.Add_Genre("humor, satire", "marcgt"); break; case 'i': thisBibInfo.Add_Genre("letter", "marcgt"); break; case 'p': thisBibInfo.Add_Genre("poetry", "marcgt"); break; case 'f': thisBibInfo.Add_Genre("novel", "marcgt"); break; case 'j': thisBibInfo.Add_Genre("short story", "marcgt"); break; case 's': thisBibInfo.Add_Genre("speech", "marcgt"); break; case '0': thisBibInfo.Add_Genre("non-fiction", "marcgt"); break; case '1': thisBibInfo.Add_Genre("fiction", "marcgt"); break; } if ((field_008[30] == 'h') || (field_008[31] == 'h')) { thisBibInfo.Add_Genre("history", "marcgt"); } if (field_008[30] == '1') { thisBibInfo.Add_Genre("festschrift", "marcgt"); } } } // Look for target audience (521) foreach (MARC_Field thisRecord in record[521]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('b')) { thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")") + " [ " + thisRecord['b'].Replace("[", "(").Replace("]", ")") + " ]"); } else { thisBibInfo.Add_Target_Audience(thisRecord['a'].Replace("[", "(").Replace("]", ")")); } } } // Look for target audince (008/22) if ((marc_type == "BKS") || (marc_type == "COM") || (marc_type == "REC") || (marc_type == "SCO") || (marc_type == "VIS")) { if (field_008.Length > 22) { switch (field_008[22]) { case 'd': thisBibInfo.Add_Target_Audience("adolescent", "marctarget"); break; case 'e': thisBibInfo.Add_Target_Audience("adult", "marctarget"); break; case 'g': thisBibInfo.Add_Target_Audience("general", "marctarget"); break; case 'b': thisBibInfo.Add_Target_Audience("primary", "marctarget"); break; case 'c': thisBibInfo.Add_Target_Audience("pre-adolescent", "marctarget"); break; case 'j': thisBibInfo.Add_Target_Audience("juvenile", "marctarget"); break; case 'a': thisBibInfo.Add_Target_Audience("preschool", "marctarget"); break; case 'f': thisBibInfo.Add_Target_Audience("specialized", "marctarget"); break; } } } // Get any project codes ( 852 ) if ((package != null) && (package.Behaviors.Aggregation_Count == 0)) { foreach (MARC_Field thisRecord in record[852]) { if ((thisRecord.Indicators.Trim().Length == 0) && (thisRecord.has_Subfield('b'))) { string allCodes = thisRecord['b']; string[] splitAllCodes = allCodes.Split("|;".ToCharArray()); foreach (string splitCode in splitAllCodes) { package.Behaviors.Add_Aggregation(splitCode.Trim()); } } } } }
private static void Add_Main_Title(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, Title_Type_Enum type, int non_filling_type, int title_type) { // Step through each instance of this tag foreach (MARC_Field thisRecord in record[tag]) { // Declare new title Title_Info newTitle = new Title_Info(); newTitle.Title_Type = type; switch (non_filling_type) { case 0: newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']); break; case 1: int non_filling_chars1 = 0; try { non_filling_chars1 = Convert.ToInt16(thisRecord.Indicator1) - 48; } catch { } if (non_filling_chars1 == 0) { newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']); } else { string complete_title = thisRecord['a']; newTitle.NonSort = complete_title.Substring(0, non_filling_chars1); newTitle.Title = Remove_Trailing_Punctuation(complete_title.Substring(non_filling_chars1)); } break; case 2: int non_filling_chars2 = 0; try { non_filling_chars2 = Convert.ToInt16(thisRecord.Indicator2) - 48; } catch { } if (non_filling_chars2 == 0) { newTitle.Title = Remove_Trailing_Punctuation(thisRecord['a']); } else { string complete_title = thisRecord['a']; newTitle.NonSort = complete_title.Substring(0, non_filling_chars2); newTitle.Title = Remove_Trailing_Punctuation(complete_title.Substring(non_filling_chars2)); } break; } newTitle.Title = newTitle.Title.Replace("âE", "É"); if (thisRecord.has_Subfield('b')) newTitle.Subtitle = Remove_Trailing_Punctuation(thisRecord['b'].Replace("/", "")); if (thisRecord.has_Subfield('n')) newTitle.Add_Part_Number(thisRecord['n']); if (thisRecord.has_Subfield('p')) newTitle.Add_Part_Name(thisRecord['p']); if (thisRecord.has_Subfield('y')) newTitle.Language = thisRecord['y']; if (tag >= 700) newTitle.Display_Label = "Uncontrolled"; if (tag < 200) newTitle.Display_Label = "Main Entry"; if (tag == 246) { switch (thisRecord.Indicator2) { case '0': newTitle.Display_Label = "Portion of title"; break; case '1': newTitle.Display_Label = "Parallel title"; break; case '2': newTitle.Display_Label = "Distinctive title"; break; case '3': newTitle.Display_Label = "Other title"; break; case '4': newTitle.Display_Label = "Cover title"; break; case '5': newTitle.Display_Label = "Added title page title"; break; case '6': newTitle.Display_Label = "Caption title"; break; case '7': newTitle.Display_Label = "Running title"; break; case '8': newTitle.Display_Label = "Spine title"; break; default: newTitle.Display_Label = "Alternate title"; break; } } if (thisRecord.has_Subfield('i')) newTitle.Display_Label = thisRecord['i'].Replace(":", ""); switch (title_type) { case 1: thisBibInfo.Main_Title = newTitle; break; case 2: thisBibInfo.Add_Other_Title(newTitle); break; case 3: thisBibInfo.SeriesTitle = newTitle; break; case 4: Subject_Info_TitleInfo newTitleSubj = new Subject_Info_TitleInfo(); newTitleSubj.Set_Internal_Title(newTitle); if (thisRecord.has_Subfield('v')) newTitleSubj.Add_Genre(Remove_Trailing_Punctuation(thisRecord['v'])); if (thisRecord.has_Subfield('x')) newTitleSubj.Add_Topic(Remove_Trailing_Punctuation(thisRecord['x'])); if (thisRecord.has_Subfield('y')) newTitleSubj.Add_Temporal(Remove_Trailing_Punctuation(thisRecord['y'])); if (thisRecord.has_Subfield('z')) newTitleSubj.Add_Geographic(Remove_Trailing_Punctuation(thisRecord['z'])); if (thisRecord.has_Subfield('2')) newTitleSubj.Authority = thisRecord['2']; switch (thisRecord.Indicator2) { case '0': newTitleSubj.Authority = "lcsh"; break; case '1': newTitleSubj.Authority = "lcshac"; break; case '2': newTitleSubj.Authority = "mesh"; break; case '3': newTitleSubj.Authority = "nal"; break; case '5': newTitleSubj.Authority = "csh"; break; case '6': newTitleSubj.Authority = "rvm"; break; } thisBibInfo.Add_Subject(newTitleSubj); break; } } }
private static void Add_Personal_Name(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, int name_type) { // Step through each instance of this tag foreach (MARC_Field thisRecord in record[tag]) { // Create the name object Name_Info newName = new Name_Info(); newName.Name_Type = Name_Info_Type_Enum.Personal; // Only continue if there is an id in this record if ((thisRecord.has_Subfield('a')) && (thisRecord['a'].ToUpper().IndexOf("PALMM") < 0)) { // Save the 'a' value switch (thisRecord.Indicator1) { case '0': newName.Given_Name = Remove_Trailing_Punctuation(thisRecord['a']); newName.Full_Name = newName.Given_Name; break; case '1': string tempName = Remove_Trailing_Punctuation(thisRecord['a']); int tempCommaIndex = tempName.IndexOf(","); if (tempCommaIndex > 0) { newName.Family_Name = tempName.Substring(0, tempCommaIndex).Trim(); newName.Given_Name = tempName.Substring(tempCommaIndex + 1).Trim(); newName.Full_Name = tempName; } else { newName.Family_Name = tempName; } break; case '3': newName.Family_Name = Remove_Trailing_Punctuation(thisRecord['a']); newName.Full_Name = newName.Family_Name; break; default: newName.Full_Name = Remove_Trailing_Punctuation(thisRecord['a']); break; } if (thisRecord.has_Subfield('b')) newName.Terms_Of_Address = thisRecord['b']; if (thisRecord.has_Subfield('c')) { if (newName.Terms_Of_Address.Length > 0) { newName.Terms_Of_Address = newName.Terms_Of_Address + "; " + thisRecord['c']; } else { newName.Terms_Of_Address = thisRecord['c']; } } if (thisRecord.has_Subfield('d')) newName.Dates = Remove_Trailing_Punctuation(thisRecord['d']); if (thisRecord.has_Subfield('e')) newName.Add_Role(Remove_Trailing_Punctuation(thisRecord['e'])); if (thisRecord.has_Subfield('g')) newName.Description = Remove_Trailing_Punctuation(thisRecord['g']); if (thisRecord.has_Subfield('j')) { if (newName.Description.Length > 0) { newName.Description = newName.Description + "; " + thisRecord['j']; } else { newName.Description = thisRecord['j']; } } if (thisRecord.has_Subfield('u')) newName.Affiliation = Remove_Trailing_Punctuation(thisRecord['u']); if (thisRecord.has_Subfield('q')) newName.Display_Form = Remove_Trailing_Punctuation(thisRecord['q'].Replace("(", "").Replace(")", "")); // Is there a relator code? if (thisRecord.has_Subfield('4')) { // Get the relator code string completeRelatorcode = thisRecord['4']; string[] relatorCodesSplitter = completeRelatorcode.Split("|".ToCharArray()); foreach (string relatorcode in relatorCodesSplitter) { newName.Add_Role(relatorcode, "marcrelator", Name_Info_Role_Type_Enum.Code); } } switch (name_type) { case 1: thisBibInfo.Main_Entity_Name = newName; break; case 2: thisBibInfo.Add_Named_Entity(newName); break; case 3: thisBibInfo.Donor = newName; break; case 4: Subject_Info_Name newNameSubj = new Subject_Info_Name(); newNameSubj.Set_Internal_Name(newName); if (thisRecord.has_Subfield('v')) newNameSubj.Add_Genre(Remove_Trailing_Punctuation(thisRecord['v'])); if (thisRecord.has_Subfield('x')) newNameSubj.Add_Topic(Remove_Trailing_Punctuation(thisRecord['x'])); if (thisRecord.has_Subfield('y')) newNameSubj.Add_Temporal(Remove_Trailing_Punctuation(thisRecord['y'])); if (thisRecord.has_Subfield('z')) newNameSubj.Add_Geographic(Remove_Trailing_Punctuation(thisRecord['z'])); if (thisRecord.has_Subfield('2')) newNameSubj.Authority = thisRecord['2']; switch (thisRecord.Indicator2) { case '0': newNameSubj.Authority = "lcsh"; break; case '1': newNameSubj.Authority = "lcshac"; break; case '2': newNameSubj.Authority = "mesh"; break; case '3': newNameSubj.Authority = "nal"; break; case '5': newNameSubj.Authority = "csh"; break; case '6': newNameSubj.Authority = "rvm"; break; } break; } } } }
private static void Add_Descriptions(Bibliographic_Info thisBibInfo, MARC_Record record) { // Look for any THESIS note foreach (MARC_Field thisRecord in record[502]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Thesis); } } // Look for any BIBLIORAPHY note foreach (MARC_Field thisRecord in record[504]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Bibliography); } } // Look for any RESTRICTION note foreach (MARC_Field thisRecord in record[506]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Access_Condition.Text = thisRecord['a']; // thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.restriction); } } // Look for any CREATION/PRODUCTION CREDITS note foreach (MARC_Field thisRecord in record[508]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.CreationCredits); } } // Look for any CREATION/PRODUCTION CREDITS note foreach (MARC_Field thisRecord in record[510]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.CitationReference); } } // Look for any PERFORMERS note foreach (MARC_Field thisRecord in record[511]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.Indicator1 == '1') { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Performers, "cast"); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Performers); } } } // Look for any DATE/VENUE note foreach (MARC_Field thisRecord in record[518]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.DateVenue, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.DateVenue); } } } // Look for any PREFERRED CITATION note foreach (MARC_Field thisRecord in record[524]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.PreferredCitation, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.PreferredCitation); } } } // Look for any ADDITIONAL PHYSICAL FORM note foreach (MARC_Field thisRecord in record[530]) { StringBuilder builder_530 = new StringBuilder(); if (thisRecord.has_Subfield('3')) { builder_530.Append(thisRecord['3'] + " "); } if (thisRecord.has_Subfield('a')) { builder_530.Append(thisRecord['a'] + " "); } if (thisRecord.has_Subfield('b')) { builder_530.Append(thisRecord['b'] + " "); } if (thisRecord.has_Subfield('c')) { builder_530.Append(thisRecord['c'] + " "); } string complete_530 = builder_530.ToString().Trim(); if (complete_530.Length > 0) { thisBibInfo.Add_Note(complete_530, Note_Type_Enum.AdditionalPhysicalForm); } } // Look for any ORIGINAL VERSION note foreach (MARC_Field thisRecord in record[534]) { StringBuilder builder_534 = new StringBuilder(); if (thisRecord.has_Subfield('p')) { builder_534.Append(thisRecord['p'] + " "); } if (thisRecord.has_Subfield('k')) { builder_534.Append(thisRecord['k'] + " "); } if (thisRecord.has_Subfield('a')) { builder_534.Append(thisRecord['a'] + " "); } if (thisRecord.has_Subfield('c')) { builder_534.Append(thisRecord['c'] + " "); } if (thisRecord.has_Subfield('e')) { builder_534.Append(thisRecord['e'] + " "); } if (thisRecord.has_Subfield('l')) { builder_534.Append(thisRecord['l'] + " "); } if (thisRecord.has_Subfield('t')) { builder_534.Append(thisRecord['t'] + " "); } if (thisRecord.has_Subfield('b')) { builder_534.Append(thisRecord['b'] + " "); } if (thisRecord.has_Subfield('n')) { builder_534.Append(thisRecord['n'] + " "); } string complete_534 = builder_534.ToString().Trim(); if (complete_534.Length > 0) { thisBibInfo.Add_Note(complete_534, Note_Type_Enum.OriginalVersion); } } // Look for any ORIGINAL LOCATION note foreach (MARC_Field thisRecord in record[535]) { StringBuilder builder_535 = new StringBuilder(); bool possibly_holding_location = true; if (thisRecord.has_Subfield('3')) { builder_535.Append(thisRecord['3'] + " "); possibly_holding_location = false; } if (thisRecord.has_Subfield('a')) { builder_535.Append(thisRecord['a'] + " "); } if (thisRecord.has_Subfield('b')) { builder_535.Append(thisRecord['b'] + " "); possibly_holding_location = false; } if (thisRecord.has_Subfield('d')) { builder_535.Append(thisRecord['d'] + " "); possibly_holding_location = false; } string complete_535 = builder_535.ToString().Trim(); if (complete_535.Length > 0) { if ((possibly_holding_location) && (thisRecord.Indicator1 == '1')) { thisBibInfo.Location.Holding_Name = complete_535; } else { thisBibInfo.Add_Note(complete_535, Note_Type_Enum.OriginalLocation); } } } // Look for any FUNDING note foreach (MARC_Field thisRecord in record[536]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Funding); } } // Look for any SYSTEM DETAILS note foreach (MARC_Field thisRecord in record[538]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.SystemDetails); } } // Look for any ACQUISITION note foreach (MARC_Field thisRecord in record[541]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.Indicator1 != '0') { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Acquisition); } } } // Look for any BIOGRAPHICAL note foreach (MARC_Field thisRecord in record[545]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('b')) { thisBibInfo.Add_Note(thisRecord['a'] + " " + thisRecord['b'], Note_Type_Enum.Biographical); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Biographical); } } } // Look for any LANGUAGE note foreach (MARC_Field thisRecord in record[546]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Language, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Language); } } } // Look for any OWNERSHIP note foreach (MARC_Field thisRecord in record[561]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Ownership, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Ownership); } } } // Look for any VERSION IDENTIFICATION note foreach (MARC_Field thisRecord in record[562]) { StringBuilder builder_562 = new StringBuilder(); if (thisRecord.has_Subfield('3')) { builder_562.Append(thisRecord['3'] + " "); } if (thisRecord.has_Subfield('a')) { builder_562.Append(thisRecord['a'] + " "); } if (thisRecord.has_Subfield('c')) { builder_562.Append(thisRecord['c'] + " "); } if (thisRecord.has_Subfield('e')) { builder_562.Append(thisRecord['e'] + " "); } if (thisRecord.has_Subfield('b')) { builder_562.Append(thisRecord['b'] + " "); } string complete_562 = builder_562.ToString().Trim(); if (complete_562.Length > 0) { thisBibInfo.Add_Note(complete_562, Note_Type_Enum.VersionIdentification); } } // Look for any PUBLICATIONS note foreach (MARC_Field thisRecord in record[581]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Publications, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Publications); } } } // Look for any EXHIBITIONS note foreach (MARC_Field thisRecord in record[585]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('3')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Exhibitions, thisRecord['3']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.Exhibitions); } } } // Look for statement of responsibility (from TITLE - 245 |c ) foreach (MARC_Field thisRecord in record[245]) { if (thisRecord.has_Subfield('c')) { thisBibInfo.Add_Note(thisRecord['c'], Note_Type_Enum.StatementOfResponsibility); } } // Look for any publication dates or sequential designation note (362) foreach (MARC_Field thisRecord in record[362]) { if (thisRecord.has_Subfield('a')) { if (thisRecord.has_Subfield('z')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.DatesSequentialDesignation, thisRecord['z']); } else { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.DatesSequentialDesignation); } } } // Look for any numbering peculiarities note (515) foreach (MARC_Field thisRecord in record[515]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.NumberingPeculiarities); } } // Look for any issuing body note (550) foreach (MARC_Field thisRecord in record[550]) { if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.IssuingBody); } } // Look for any other NOTES fields ( 500, 501, 513, 522, 525, 563, 567, 586 ) int[] other_notes = new int[] {500, 501, 513, 522, 525, 563, 567, 586}; foreach (int tagNumber in other_notes) { foreach (MARC_Field thisRecord in record[tagNumber]) { string displayLabel = String.Empty; if (thisRecord.Indicator1 == ' ') { switch (tagNumber) { case 522: displayLabel = "Geographic Coverage"; break; case 525: displayLabel = "Supplement Note"; break; case 567: displayLabel = "Methodology"; break; case 586: displayLabel = "Awards"; break; } } if (thisRecord.has_Subfield('a')) { thisBibInfo.Add_Note(thisRecord['a'], Note_Type_Enum.NONE, displayLabel); } } } }
private static void Add_Hierarchical_Subject(Bibliographic_Info thisBibInfo, MARC_Record record, int tag) { int subj_index = 1; foreach (MARC_Field thisRecord in record[tag]) { Subject_Info_HierarchicalGeographic spatial = new Subject_Info_HierarchicalGeographic(); // Look for 'a' first if (thisRecord.has_Subfield('a')) { spatial.Country = Remove_Trailing_Punctuation(thisRecord['a']); } // Look for 'b' next if (thisRecord.has_Subfield('b')) { spatial.State = Remove_Trailing_Punctuation(thisRecord['b']); } // Look for 'c' next if (thisRecord.has_Subfield('c')) { spatial.County = Remove_Trailing_Punctuation(thisRecord['c']); } // Look for 'd' next if (thisRecord.has_Subfield('d')) { spatial.City = Remove_Trailing_Punctuation(thisRecord['d']); } // Look for area if (thisRecord.has_Subfield('f')) { spatial.Area = Remove_Trailing_Punctuation(thisRecord['f']); } // Look for authority if (thisRecord.has_Subfield('2')) { spatial.Authority = thisRecord['2']; } // Now, add to the object spatial.ID = "SUBJ" + tag + "_" + subj_index; subj_index++; thisBibInfo.Add_Subject(spatial); } }
private static void Add_Corporate_Name(Bibliographic_Info thisBibInfo, MARC_Record record, int tag, int name_type) { // Step through each instance of this tag foreach (MARC_Field thisRecord in record[tag]) { if ((name_type != 3) || (thisRecord.Indicator2 == '3')) { // Create the name object Name_Info newName = new Name_Info(); newName.Name_Type = Name_Info_Type_Enum.Corporate; // Only continue if there is an id in this record if ((thisRecord.has_Subfield('a')) && (thisRecord['a'].ToUpper().IndexOf("PALMM") < 0)) { newName.Full_Name = Remove_Trailing_Punctuation(thisRecord['a']); if (thisRecord.has_Subfield('b')) { newName.Full_Name = newName.Full_Name + " -- " + Remove_Trailing_Punctuation(thisRecord['b']); } if (thisRecord.has_Subfield('c')) newName.Description = thisRecord['c']; if (thisRecord.has_Subfield('d')) newName.Dates = Remove_Trailing_Punctuation(thisRecord['d']); if (thisRecord.has_Subfield('e')) newName.Add_Role(Remove_Trailing_Punctuation(thisRecord['e'])); if (thisRecord.has_Subfield('u')) newName.Affiliation = Remove_Trailing_Punctuation(thisRecord['u']); // Is there a relator code? if (thisRecord.has_Subfield('4')) { // Get the relator code string relatorcode = thisRecord['4']; newName.Add_Role(relatorcode, "marcrelator", Name_Info_Role_Type_Enum.Code); } switch (name_type) { case 1: thisBibInfo.Main_Entity_Name = newName; break; case 2: thisBibInfo.Add_Named_Entity(newName); break; case 3: thisBibInfo.Donor = newName; break; case 4: Subject_Info_Name newNameSubj = new Subject_Info_Name(); newNameSubj.Set_Internal_Name(newName); if (thisRecord.has_Subfield('v')) newNameSubj.Add_Genre(Remove_Trailing_Punctuation(thisRecord['v'])); if (thisRecord.has_Subfield('x')) newNameSubj.Add_Topic(Remove_Trailing_Punctuation(thisRecord['x'])); if (thisRecord.has_Subfield('y')) newNameSubj.Add_Temporal(Remove_Trailing_Punctuation(thisRecord['y'])); if (thisRecord.has_Subfield('z')) newNameSubj.Add_Geographic(Remove_Trailing_Punctuation(thisRecord['z'])); if (thisRecord.has_Subfield('2')) newNameSubj.Authority = thisRecord['2']; switch (thisRecord.Indicator2) { case '0': newNameSubj.Authority = "lcsh"; break; case '1': newNameSubj.Authority = "lcshac"; break; case '2': newNameSubj.Authority = "mesh"; break; case '3': newNameSubj.Authority = "nal"; break; case '5': newNameSubj.Authority = "csh"; break; case '6': newNameSubj.Authority = "rvm"; break; } break; } } } } }
/// <summary> Returns a string which represents a record in machine readable record format. </summary> /// <param name="Record"> MARC record to convert to MARC21 </param> /// <returns> MARC record as MARC21 Exchange format record string</returns> public static string To_Machine_Readable_Record(MARC_Record Record) { // Create the stringbuilder for this StringBuilder directory = new StringBuilder(1000); StringBuilder completefields = new StringBuilder(2000); StringBuilder completeLine = new StringBuilder(200); // Step through each entry by key from the hashtable List<string> overallRecord = new List<string>(); int runningLength = 0; // Step through each field ( control and data ) in the record foreach (MARC_Field thisEntry in Record.Sorted_MARC_Tag_List) { // Perpare to build this line if (completeLine.Length > 0) completeLine.Remove(0, completeLine.Length); // Is this a control field (with no subfields) or a data field? if (thisEntry.Subfield_Count == 0) { if (!String.IsNullOrEmpty(thisEntry.Control_Field_Value)) { completeLine.Append(int_to_string(thisEntry.Tag, 3) + RECORD_SEPERATOR); completeLine.Append(thisEntry.Control_Field_Value); overallRecord.Add(completeLine.ToString()); } } else { // Start this tag and add the indicator, if there is one if (thisEntry.Indicators.Length == 0) completeLine.Append(int_to_string(thisEntry.Tag, 3) + RECORD_SEPERATOR); else completeLine.Append(int_to_string(thisEntry.Tag, 3) + RECORD_SEPERATOR + thisEntry.Indicators); // Build the complete line foreach (MARC_Subfield thisSubfield in thisEntry.Subfields) { if (thisSubfield.Subfield_Code == ' ') { if (thisEntry.Indicators.Length == 0) completeLine.Append(thisSubfield.Data); else completeLine.Append(UNIT_SEPERATOR.ToString() + thisSubfield.Data); } else { completeLine.Append(UNIT_SEPERATOR.ToString() + thisSubfield.Subfield_Code + thisSubfield.Data); } } // Add this to the list overallRecord.Add(completeLine.ToString()); } } // Now, add these to the directory and completefields StringBuilders foreach (string thisLin in overallRecord) { // Add this line to the directory and fields directory.Append(thisLin.Substring(0, 3) + (int_to_string(adjusted_length(thisLin) - 3, 4)) + (int_to_string(runningLength, 5))); completefields.Append(thisLin.Substring(3)); // Increment the running length runningLength += adjusted_length(thisLin) - 3; } // Get the length of just the directory, before we start appending more to it int directory_length = directory.Length; // Compile the return value directory.Append(completefields.ToString() + RECORD_SEPERATOR + GROUP_SEPERATOR); // Get the leader string leader = Record.Leader; // Insert the total length of this record runningLength += leader.Length + directory_length + 2; // Return the combination of these two fields, plus the end of record char return int_to_string(runningLength, 5) + leader.Substring(5, 7) + int_to_string(leader.Length + directory_length + 1, 5) + leader.Substring(17) + directory; }
/// <summary> Append a single record to the file </summary> /// <param name="Record">New record to append </param> public void AppendRecord(MARC_Record Record) { writer.Write(To_Machine_Readable_Record(Record)); }
private string Save_MARC_XML( MARC_Record result ) { // Determine the directory to save the MARC XML into if ( marc_directory.Length > 0 ) { // If this is an error, just save to a local error folder if ((result.Error_Flag) || ( preview_mode )) { // Save the location for temporary files string marc_xml_name = error_folder + DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ".xml"; if (File.Exists(marc_xml_name)) File.Delete(marc_xml_name); bool error_success = result.Save_MARC_XML(marc_xml_name); if (error_success) return marc_xml_name; else return String.Empty; } // Save by OCLC number first if (result.Control_Number.Length > 3) { string recordNumber = result.Control_Number; if (((recordNumber.IndexOf("ocn") == 0) || ( recordNumber.IndexOf("ocm") == 0 )) && (recordNumber.Length >= 4)) { string oclc = recordNumber.Substring(3).Trim(); bool oclc_success = false; string endDir = "OCLC/"; for (int i = 0; i < oclc.Length; i++) { endDir += oclc[i] + "/"; } endDir = endDir.Remove(endDir.Length - 1); try { if (!Directory.Exists(marc_directory + endDir)) { Directory.CreateDirectory(marc_directory + endDir); } oclc_success = result.Save_MARC_XML(marc_directory + endDir + "/" + oclc + ".xml"); } catch { } if (oclc_success) { return marc_directory + endDir + "/" + oclc + ".xml"; } else { try { if (!Directory.Exists(error_folder + "\\" + endDir)) { Directory.CreateDirectory(error_folder + "\\" + endDir); } // Create the output file result.Save_MARC_XML(error_folder + "\\" + endDir + "\\" + oclc + ".xml"); return error_folder + "\\" + endDir + "\\" + oclc + ".xml"; } catch { } } } else { string aleph = recordNumber.Trim(); bool aleph_success = false; string endDir = String.Empty; for (int i = 0; i < aleph.Length; i++) { endDir += aleph[i] + "/"; } endDir = endDir.Remove(endDir.Length - 1); try { if (!Directory.Exists(marc_directory + endDir)) { Directory.CreateDirectory(marc_directory + endDir); } aleph_success = result.Save_MARC_XML(marc_directory + endDir + "/" + aleph + ".xml"); } catch { } if (aleph_success) { return marc_directory + endDir + "/" + aleph + ".xml"; } else { try { if (!Directory.Exists(error_folder + "\\" + endDir)) { Directory.CreateDirectory(error_folder + "\\" + endDir); } // Create the output file result.Save_MARC_XML(error_folder + "\\" + endDir + "\\" + aleph + ".xml"); return error_folder + "\\" + endDir + "\\" + aleph + ".xml"; } catch { } } } } else { // Save the location for temporary files string marc_xml_name = error_folder + DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0') + DateTime.Now.Hour.ToString().PadLeft(2, '0') + DateTime.Now.Minute.ToString().PadLeft(2, '0') + ".xml"; if (File.Exists(marc_xml_name)) File.Delete(marc_xml_name); bool error_success = result.Save_MARC_XML(marc_xml_name); if (error_success) return marc_xml_name; else return String.Empty; } } return String.Empty; }
public static MARC_Record Get_Record_By_Primary_Identifier(string Primary_Identifier, Z3950_Endpoint Z3950_Server, out string Message) { // Initially set the message to empty Message = String.Empty; // http://jai-on-asp.blogspot.com/2010/01/z3950-client-in-cnet-using-zoomnet-and.html // http://www.indexdata.com/yaz/doc/tools.html#PQF // http://www.loc.gov/z3950/agency/defns/bib1.html // http://www.assembla.com/code/wasolic/subversion/nodes/ZOOM.NET // http://lists.indexdata.dk/pipermail/yazlist/2007-June/002080.html // http://fclaweb.fcla.edu/content/z3950-access-aleph const string prefix = "@attrset Bib-1 @attr 1=12 "; try { IConnection connection; // zoom db connector IPrefixQuery query; // zoom query IRecord record; // one zoom record IResultSet records; // collection of records // allocate MARC tools MARC21_Exchange_Format_Parser parser = new MARC21_Exchange_Format_Parser(); // establish connection connection = new Connection(Z3950_Server.URI, Convert.ToInt32(Z3950_Server.Port)); connection.DatabaseName = Z3950_Server.Database_Name; // Any authentication here? if (Z3950_Server.Username.Length > 0) { connection.Username = Z3950_Server.Username; } if (Z3950_Server.Password.Length > 0) { connection.Password = Z3950_Server.Password; } // Set to USMARC connection.Syntax = RecordSyntax.USMARC; // call the Z39.50 server query = new PrefixQuery(prefix + Primary_Identifier); records = connection.Search(query); // If the record count is not one, return a message if (records.Count != 1) { if (records.Count == 0) { Message = "ERROR: No matching record found in Z39.50 endpoint"; } else { Message = "ERROR: More than one matching record found in Z39.50 endpoint by primary identifier"; } return(null); } // capture the byte stream record = records[0]; MemoryStream ms = new MemoryStream(record.Content); // display while debugging //MessageBox.Show(Encoding.UTF8.GetString(record.Content)); try { // feed the record to the parser and add the 955 MARC_Record marcrec = parser.Parse(ms); parser.Close(); return(marcrec); } catch (Exception error) { Message = "ERROR: Unable to parse resulting record into the MARC Record structure!\n\n" + error.Message; return(null); //MessageBox.Show("Could not convert item " + Primary_Identifier + " to MARCXML."); //Trace.WriteLine("Could not convert item " + Primary_Identifier + " to MARCXML."); //Trace.WriteLine("Error details: " + error.Message); } } catch (Exception error) { if (error.Message.IndexOf("The type initializer for 'Zoom.Net.Yaz") >= 0) { Message = "ERROR: The Z39.50 libraries did not correctly initialize.\n\nThese libraries do not currently work in 64-bit environments."; } else { Message = "ERROR: Unable to connect and search provided Z39.50 endpoint.\n\n" + error.Message; } return(null); //MessageBox.Show("Could not convert item " + Primary_Identifier + " to MARCXML."); //Trace.WriteLine("Could not convert item " + Primary_Identifier + " to MARCXML."); //Trace.WriteLine("Error details: " + error.Message); } return(null); }