/// <summary> Writes the amdSec for the entire package to the text writer </summary> /// <param name="Output_Stream">Stream to which the formatted text is written </param> /// <param name="METS_Item">Package with all the metadata to save</param> /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param> /// <returns>TRUE if successful, otherwise FALSE </returns> public bool Write_amdSec(TextWriter Output_Stream, SobekCM_Item METS_Item, Dictionary <string, object> Options) { // Ensure this metadata module extension exists and has data DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if ((daitssInfo == null) || (!daitssInfo.hasData)) { return(true); } Output_Stream.WriteLine("<daitss:daitss>"); if (!String.IsNullOrEmpty(daitssInfo.SubAccount)) { Output_Stream.WriteLine("<daitss:AGREEMENT_INFO ACCOUNT=\"" + daitssInfo.Account + "\" SUB_ACCOUNT=\"" + daitssInfo.SubAccount + "\" PROJECT=\"" + daitssInfo.Project + "\"/>"); } else { Output_Stream.WriteLine("<daitss:AGREEMENT_INFO ACCOUNT=\"" + daitssInfo.Account + "\" PROJECT=\"" + daitssInfo.Project + "\"/>"); } Output_Stream.WriteLine("</daitss:daitss>"); return(true); }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo != null) { base.thisBox.Text = daitssInfo.Project; } }
/// <summary> Prepares the bib object for the save, by clearing the /// existing data in this element's related field. </summary> /// <param name="Bib"> Existing Bib object </param> public override void Prepare_For_Save(SobekCM_Item Bib) { DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo != null) { daitssInfo.Project = String.Empty; } }
/// <summary> Flag indicates if this active reader/writer needs to append schema reference information /// to the METS XML header by analyzing the contents of the digital resource item </summary> /// <param name="METS_Item"> Package with all the metadata to save</param> /// <returns> TRUE if the schema should be attached, otherwise fALSE </returns> public bool Schema_Reference_Required_Package(SobekCM_Item METS_Item) { DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo == null) { return(false); } return(daitssInfo.hasData); }
/// <summary> Flag indicates if this active reader/writer will write an amdSec </summary> /// <param name="METS_Item"> Package with all the metadata to save</param> /// <param name="Options"> Dictionary of any options which this METS section writer may utilize</param> /// <returns> TRUE if the package has data to be written, otherwise fALSE </returns> public bool Include_amdSec(SobekCM_Item METS_Item, Dictionary <string, object> Options) { // Ensure this metadata module extension exists and has data DAITSS_Info daitssInfo = METS_Item.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if ((daitssInfo == null) || (!daitssInfo.hasData)) { return(false); } return(true); }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object into which to save this element's data </param> public override void Save_To_Bib(SobekCM_Item Bib) { if (thisBox.Text.Trim().Length > 0) { DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo == null) { daitssInfo = new DAITSS_Info(); Bib.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); } daitssInfo.Project = thisBox.Text.Trim(); } }
/// <summary> Reads the amdSec at the current position in the XmlTextReader and associates it with the /// entire package </summary> /// <param name="Input_XmlReader"> Open XmlReader from which to read the metadata </param> /// <param name="Return_Package"> Package into which to read the metadata</param> /// <param name="Options"> Dictionary of any options which this METS section reader may utilize</param> /// <returns> TRUE if successful, otherwise FALSE</returns> public bool Read_amdSec(XmlReader Input_XmlReader, SobekCM_Item Return_Package, Dictionary <string, object> Options) { // Ensure this metadata module extension exists DAITSS_Info daitssInfo = Return_Package.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo == null) { daitssInfo = new DAITSS_Info(); Return_Package.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); } // Loop through reading each XML node do { // If this is the end of this section, return if ((Input_XmlReader.NodeType == XmlNodeType.EndElement) && ((Input_XmlReader.Name == "METS:mdWrap") || (Input_XmlReader.Name == "mdWrap"))) { return(true); } // get the right division information based on node type switch (Input_XmlReader.NodeType) { case XmlNodeType.Element: if ((Input_XmlReader.Name.ToLower() == "daitss:agreement_info") && (Input_XmlReader.HasAttributes)) { if (Input_XmlReader.MoveToAttribute("ACCOUNT")) { daitssInfo.Account = Input_XmlReader.Value; } if (Input_XmlReader.MoveToAttribute("SUB_ACCOUNT")) { daitssInfo.SubAccount = Input_XmlReader.Value; } if (Input_XmlReader.MoveToAttribute("PROJECT")) { daitssInfo.Project = Input_XmlReader.Value; } } break; } } while (Input_XmlReader.Read()); // Return false since this read all the way to the end of the steam return(false); }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object into which to save this element's data </param> public override void Save_To_Bib(SobekCM_Item Bib) { PALMM_Info palmmInfo = Bib.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info; if (palmmInfo == null) { palmmInfo = new PALMM_Info(); Bib.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo); } palmmInfo.toPALMM = palmmFlagCheckBox.Checked; DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo == null) { daitssInfo = new DAITSS_Info(); Bib.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); } daitssInfo.toArchive = fdaFlagCheckBox.Checked; }
/// <summary> Saves the data stored in this instance of the /// element to the provided bibliographic object </summary> /// <param name="Bib"> Object to populate this element from </param> public override void Populate_From_Bib(SobekCM_Item Bib) { PALMM_Info palmmInfo = Bib.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info; if ((palmmInfo != null) && (palmmInfo.toPALMM)) { palmmFlagCheckBox.Checked = true; } else { palmmFlagCheckBox.Checked = false; } DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if ((daitssInfo != null) && (daitssInfo.toArchive)) { fdaFlagCheckBox.Checked = true; } else { fdaFlagCheckBox.Checked = false; } }
/// <summary> </summary> /// <param name="thisElement"></param> /// <param name="Bib"></param> /// <returns></returns> private int Get_Bib_Element_Count(abstract_Element thisElement, SobekCM_Item Bib) { switch (thisElement.Type) { case Element_Type.Abstract: return(Bib.Bib_Info.Abstracts_Count); case Element_Type.Affiliation: return(Bib.Bib_Info.Affiliations_Count); case Element_Type.Aggregations: return(Bib.Behaviors.Aggregation_Count > 0 ? 1 : 0); case Element_Type.Attribution: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.funding)); case Element_Type.BibID: return(1); case Element_Type.Classification: return(Bib.Bib_Info.Classifications_Count); case Element_Type.Contributor: int contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && (Bib.Bib_Info.Main_Entity_Name.Roles.Count > 0) && ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() == "CTB"))) { contributor_count++; } contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count > 0) && ((thisName.Roles[0].Role.ToUpper() == "CONTRIBUTOR") || (thisName.Roles[0].Role.ToUpper() == "CTB"))); return(contributor_count); case Element_Type.Coordinates: GeoSpatial_Information geoInfo = Bib.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information; if (geoInfo == null) { return(0); } return((geoInfo.Point_Count > 0) || (geoInfo.Polygon_Count > 0) ? 1 : 0); case Element_Type.Creator: if ((thisElement.Display_SubType != "simple") || (((Creator_Simple_Element)thisElement).Contributor_Exists == false)) { return(Bib.Bib_Info.Main_Entity_Name.hasData ? Bib.Bib_Info.Names.Count + 1 : Bib.Bib_Info.Names.Count); } int non_contributor_count = 0; if ((Bib.Bib_Info.Main_Entity_Name.hasData) && ((Bib.Bib_Info.Main_Entity_Name.Roles.Count == 0) || ((Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (Bib.Bib_Info.Main_Entity_Name.Roles[0].Role.ToUpper() != "CTB")))) { non_contributor_count++; } non_contributor_count += Bib.Bib_Info.Names.Count(thisName => (thisName.Roles.Count == 0) || ((thisName.Roles[0].Role.ToUpper() != "CONTRIBUTOR") && (thisName.Roles[0].Role.ToUpper() != "CTB"))); return(non_contributor_count); case Element_Type.CreatorNotes: return(Bib.METS_Header.Creator_Individual_Notes_Count > 0 ? 1 : 0); case Element_Type.Date: return(Bib.Bib_Info.Origin_Info.Date_Issued.Length == 0 ? 0 : 1); case Element_Type.DateCopyrighted: return(Bib.Bib_Info.Origin_Info.Date_Copyrighted.Length > 0 ? 1 : 0); case Element_Type.DescriptionStandard: return(Bib.Bib_Info.Record.Description_Standard.Length > 0 ? 1 : 0); case Element_Type.Donor: return(Bib.Bib_Info.Donor.Full_Name.Length > 0 ? 1 : 0); case Element_Type.Edition: return(Bib.Bib_Info.Origin_Info.Edition.Length > 0 ? 1 : 0); case Element_Type.EncodingLevel: return(Bib.Bib_Info.EncodingLevel.Length > 0 ? 1 : 0); case Element_Type.EAD: return((Bib.Bib_Info.Location.EAD_URL.Length > 0) || (Bib.Bib_Info.Location.EAD_Name.Length > 0) ? 1 : 0); case Element_Type.Error: return(0); case Element_Type.ETD_CommitteeChair: Thesis_Dissertation_Info thesisInfo = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo != null) && (thesisInfo.Committee_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeCoChair: Thesis_Dissertation_Info thesisInfo2 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo2 != null) && (thesisInfo2.Committee_Co_Chair.Length > 0) ? 1 : 0); case Element_Type.ETD_CommitteeMember: Thesis_Dissertation_Info thesisInfo3 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo3 != null) ? thesisInfo3.Committee_Members_Count : 0); case Element_Type.ETD_Degree: Thesis_Dissertation_Info thesisInfo4 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo4 != null) && (thesisInfo4.Degree.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeDiscipline: Thesis_Dissertation_Info thesisInfo5 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo5 != null) && (thesisInfo5.Degree_Discipline.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeGrantor: Thesis_Dissertation_Info thesisInfo6 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo6 != null) && (thesisInfo6.Degree_Grantor.Length > 0) ? 1 : 0); case Element_Type.ETD_DegreeLevel: Thesis_Dissertation_Info thesisInfo7 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo7 != null) && (thesisInfo7.Degree_Level != Thesis_Dissertation_Info.Thesis_Degree_Level_Enum.Unknown) ? 1 : 0); case Element_Type.ETD_GraduationDate: Thesis_Dissertation_Info thesisInfo8 = Bib.Get_Metadata_Module(GlobalVar.THESIS_METADATA_MODULE_KEY) as Thesis_Dissertation_Info; return((thesisInfo8 != null) && (thesisInfo8.Graduation_Date.HasValue) ? 1 : 0); case Element_Type.FCLA_Flags: return(1); case Element_Type.FDA_Account: DAITSS_Info daitssInfo = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo != null && daitssInfo.Account.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_SubAccount: DAITSS_Info daitssInfo2 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo2 != null && daitssInfo2.SubAccount.Trim().Length > 0 ? 1 : 0); case Element_Type.FDA_Project: DAITSS_Info daitssInfo3 = Bib.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; return(daitssInfo3 != null && daitssInfo3.Project.Trim().Length > 0 ? 1 : 0); case Element_Type.Format: return(Bib.Bib_Info.Original_Description.Extent.Length > 0 ? 1 : 0); case Element_Type.Frequency: return(Bib.Bib_Info.Origin_Info.Frequencies_Count); case Element_Type.Genre: return(Bib.Bib_Info.Genres_Count); case Element_Type.Holding: return(1); case Element_Type.Wordmark: return(Bib.Behaviors.Wordmark_Count > 0 ? 1 : 0); case Element_Type.Identifier: return(Bib.Bib_Info.Identifiers_Count); case Element_Type.Language: return(Bib.Bib_Info.Languages.Count(thisLanguage => thisLanguage.Language_Text.Length > 0)); case Element_Type.MainThumbnail: return(Bib.Behaviors.Main_Thumbnail.Length > 0 ? 1 : 0); case Element_Type.Manufacturer: return(Bib.Bib_Info.Manufacturers_Count); case Element_Type.Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type != Note_Type_Enum.statement_of_responsibility)); case Element_Type.OtherURL: return((Bib.Bib_Info.Location.Other_URL.Length > 0) || (Bib.Bib_Info.Location.Other_URL_Note.Length > 0) ? 1 : 0); case Element_Type.PALMM_Code: return(1); case Element_Type.Publisher: return(Bib.Bib_Info.Publishers_Count); case Element_Type.Publication_Place: if (Bib.Bib_Info.Publishers_Count > 0) { if (Bib.Bib_Info.Publishers.SelectMany(thisName => thisName.Places).Any(thisPlace => thisPlace.Place_Text.Length > 0)) { return(1); } } return(0); case Element_Type.RecordOrigin: return(Bib.Bib_Info.Record.Record_Origin.Length > 0 ? 1 : 0); case Element_Type.RecordStatus: return(1); case Element_Type.RelatedItem: return(Bib.Bib_Info.RelatedItems_Count); case Element_Type.Rights: return(Bib.Bib_Info.Access_Condition.Text.Length > 0 ? 1 : 0); case Element_Type.Scale: if (Bib.Bib_Info.Subjects.Where(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Cartographics).Any(thisSubject => ((Subject_Info_Cartographics)thisSubject).Scale.Length > 0)) { return(1); } return(0); case Element_Type.SerialHierarchy: return(Bib.Behaviors.Serial_Info.Count > 0 ? 1 : 0); case Element_Type.Source_Institution: return(1); case Element_Type.Source_Note: return(Bib.Bib_Info.Notes.Count(thisNote => thisNote.Note_Type == Note_Type_Enum.source)); case Element_Type.Spatial: int hierSubjectCount = 0; if (thisElement.Display_SubType == "dublincore") { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { hierSubjectCount++; } else if (thisSubject.Class_Type == Subject_Info_Type.Standard) { Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Genres_Count == 0) && (standSubject.Occupations_Count == 0) && (standSubject.Topics_Count == 0)) { hierSubjectCount++; } } } } else { hierSubjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial); } return(hierSubjectCount); case Element_Type.Structure_Map: return(1); case Element_Type.Subject: bool standard = true; if ((thisElement.Display_SubType == "simple") || (thisElement.Display_SubType == "dublincore")) { if (((Subject_Simple_Element)thisElement).Seperate_Dublin_Core_Spatial_Exists) { standard = false; } } int subjectCount = 0; if (standard) { subjectCount += Bib.Bib_Info.Subjects.Count(thisSubject => (thisSubject.Class_Type == Subject_Info_Type.Standard) || (thisSubject.Class_Type == Subject_Info_Type.TitleInfo) || (thisSubject.Class_Type == Subject_Info_Type.Name)); } else { foreach (Subject_Info thisSubject in Bib.Bib_Info.Subjects) { switch (thisSubject.Class_Type) { case Subject_Info_Type.TitleInfo: subjectCount++; break; case Subject_Info_Type.Name: subjectCount++; break; case Subject_Info_Type.Standard: Subject_Info_Standard standSubject = (Subject_Info_Standard)thisSubject; if ((standSubject.Topics_Count > 0) || (standSubject.Occupations_Count > 0) || (standSubject.Genres_Count > 0)) { subjectCount++; } break; } } } return(subjectCount); case Element_Type.TargetAudience: return(Bib.Bib_Info.Target_Audiences.Any(thisTarget => thisTarget.Authority != "marctarget") ? 1 : 0); case Element_Type.Temporal: return(Bib.Bib_Info.TemporalSubjects_Count); case Element_Type.Title: return(1); case Element_Type.Title_Other: int title_count = 0; if (Bib.Bib_Info.Main_Title.Subtitle.Length > 0) { title_count++; } if ((Bib.Bib_Info.hasSeriesTitle) && (Bib.Bib_Info.SeriesTitle.Title.Length > 0)) { title_count++; } if (Bib.Bib_Info.Other_Titles_Count > 0) { title_count += Bib.Bib_Info.Other_Titles.Count(thisTitle => thisTitle.Title.Length > 0); } return(title_count); case Element_Type.Type: return(1); case Element_Type.VID: return(1); case Element_Type.Viewer: return(Bib.Behaviors.Views_Count); case Element_Type.VRA_CulturalContext: VRACore_Info vraInfo = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo != null ? vraInfo.Cultural_Context_Count : 0); case Element_Type.VRA_Inscription: VRACore_Info vraInfo2 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo2 != null ? vraInfo2.Inscription_Count : 0); case Element_Type.VRA_Material: VRACore_Info vraInfo3 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo3 != null ? vraInfo3.Material_Count : 0); case Element_Type.VRA_Measurement: VRACore_Info vraInfo4 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo4 != null ? vraInfo4.Measurement_Count : 0); case Element_Type.VRA_StateEdition: VRACore_Info vraInfo5 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo5 != null ? vraInfo5.State_Edition_Count : 0); case Element_Type.VRA_StylePeriod: VRACore_Info vraInfo6 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo6 != null ? vraInfo6.Style_Period_Count : 0); case Element_Type.VRA_Technique: VRACore_Info vraInfo7 = Bib.Get_Metadata_Module(GlobalVar.VRACORE_METADATA_MODULE_KEY) as VRACore_Info; return(vraInfo7 != null ? vraInfo7.Technique_Count : 0); case Element_Type.Web_Skin: return(Bib.Behaviors.Web_Skin_Count > 0 ? 1 : 0); case Element_Type.ZT_Class: Zoological_Taxonomy_Info darwinCoreInfo = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo != null && darwinCoreInfo.Class.Length > 0 ? 1 : 0); case Element_Type.ZT_CommonName: Zoological_Taxonomy_Info darwinCoreInfo2 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo2 != null && darwinCoreInfo2.Common_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_Family: Zoological_Taxonomy_Info darwinCoreInfo3 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo3 != null && darwinCoreInfo3.Family.Length > 0 ? 1 : 0); case Element_Type.ZT_Genus: Zoological_Taxonomy_Info darwinCoreInfo4 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo4 != null && darwinCoreInfo4.Genus.Length > 0 ? 1 : 0); case Element_Type.ZT_HigherClassification: Zoological_Taxonomy_Info darwinCoreInfo5 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo5 != null && darwinCoreInfo5.Higher_Classification.Length > 0 ? 1 : 0); case Element_Type.ZT_Kingdom: Zoological_Taxonomy_Info darwinCoreInfo6 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo6 != null && darwinCoreInfo6.Kingdom.Length > 0 ? 1 : 0); case Element_Type.ZT_Order: Zoological_Taxonomy_Info darwinCoreInfo7 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo7 != null && darwinCoreInfo7.Order.Length > 0 ? 1 : 0); case Element_Type.ZT_Phylum: Zoological_Taxonomy_Info darwinCoreInfo8 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo8 != null && darwinCoreInfo8.Phylum.Length > 0 ? 1 : 0); case Element_Type.ZT_ScientificName: Zoological_Taxonomy_Info darwinCoreInfo9 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo9 != null && darwinCoreInfo9.Scientific_Name.Length > 0 ? 1 : 0); case Element_Type.ZT_SpecificEpithet: Zoological_Taxonomy_Info darwinCoreInfo10 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo10 != null && darwinCoreInfo10.Specific_Epithet.Length > 0 ? 1 : 0); case Element_Type.ZT_TaxonRank: Zoological_Taxonomy_Info darwinCoreInfo11 = Bib.Get_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY) as Zoological_Taxonomy_Info; return(darwinCoreInfo11 != null && darwinCoreInfo11.Taxonomic_Rank.Length > 0 ? 1 : 0); default: return(0); } }
/// <summary> Create a test digital resource item </summary> /// <param name="directory">Directory for the package source directory</param> /// <returns>Fully built test bib package</returns> public static SobekCM_Item Create(string directory) { SobekCM_Item testPackage = new SobekCM_Item(); // Add all the METS header information testPackage.METS_Header.Create_Date = new DateTime(2007, 1, 1); testPackage.METS_Header.Modify_Date = DateTime.Now; testPackage.METS_Header.Creator_Individual = "Mark Sullivan"; testPackage.METS_Header.Add_Creator_Individual_Notes("Programmer of new SobekCM.Resource_Object"); testPackage.METS_Header.Add_Creator_Individual_Notes("Adding coordinates"); testPackage.METS_Header.Creator_Organization = "University of Florida"; testPackage.METS_Header.Creator_Software = "SobekCM Bib Package Test"; testPackage.METS_Header.RecordStatus_Enum = METS_Record_Status.COMPLETE; testPackage.METS_Header.Add_Creator_Org_Notes("This test package was done to test DLCs new METS package"); // Add all the MODS elements Abstract_Info testAbstract = testPackage.Bib_Info.Add_Abstract("This is a sample abstract", "en"); testPackage.Bib_Info.Add_Abstract("Tämä on esimerkki abstrakteja", "fin"); testAbstract.Display_Label = "Summary Abstract"; testAbstract.Type = "summary"; testPackage.Bib_Info.Access_Condition.Text = "All rights are reserved by source institution."; testPackage.Bib_Info.Access_Condition.Language = "en"; testPackage.Bib_Info.Access_Condition.Type = "restrictions on use"; testPackage.Bib_Info.Access_Condition.Display_Label = "Rights"; testPackage.Bib_Info.Add_Identifier("000123234", "OCLC", "Electronic OCLC"); testPackage.Bib_Info.Add_Identifier("182-asdsd-28k", "DOI"); testPackage.Bib_Info.Add_Language("English", String.Empty, "en"); testPackage.Bib_Info.Add_Language("Finnish"); testPackage.Bib_Info.Add_Language(String.Empty, "ita", String.Empty); testPackage.Bib_Info.Location.Holding_Code = "MVS"; testPackage.Bib_Info.Location.Holding_Name = "From the Private Library of Mark Sullivan"; testPackage.Bib_Info.Location.PURL = "http://www.uflib.ufl.edu/ufdc/?b=CA00000000"; testPackage.Bib_Info.Location.Other_URL = "http://www.fnhm.edu"; testPackage.Bib_Info.Location.Other_URL_Display_Label = "Specimen Information"; testPackage.Bib_Info.Location.Other_URL_Note = "Specimen FLAS 125342 Database"; testPackage.Bib_Info.Location.EAD_URL = "http://digital.uflib.ufl.edu/"; testPackage.Bib_Info.Location.EAD_Name = "Digital Library Center Finding Guide"; testPackage.Bib_Info.Main_Entity_Name.Name_Type = Name_Info_Type_Enum.personal; testPackage.Bib_Info.Main_Entity_Name.Full_Name = "Brown, B.F."; testPackage.Bib_Info.Main_Entity_Name.Terms_Of_Address = "Dr."; testPackage.Bib_Info.Main_Entity_Name.Display_Form = "B.F. Brown"; testPackage.Bib_Info.Main_Entity_Name.Affiliation = "Chemistry Dept., American University"; testPackage.Bib_Info.Main_Entity_Name.Description = "Chemistry Professor Emeritus"; testPackage.Bib_Info.Main_Entity_Name.Add_Role("Author"); Zoological_Taxonomy_Info taxonInfo = new Zoological_Taxonomy_Info(); testPackage.Add_Metadata_Module(GlobalVar.ZOOLOGICAL_TAXONOMY_METADATA_MODULE_KEY, taxonInfo); taxonInfo.Scientific_Name = "Ctenomys sociabilis"; taxonInfo.Higher_Classification = "Animalia; Chordata; Vertebrata; Mammalia; Theria; Eutheria; Rodentia; Hystricognatha; Hystricognathi; Ctenomyidae; Ctenomyini; Ctenomys"; taxonInfo.Kingdom = "Animalia"; taxonInfo.Phylum = "Chordata"; taxonInfo.Class = "Mammalia"; taxonInfo.Order = "Rodentia"; taxonInfo.Family = "Ctenomyidae"; taxonInfo.Genus = "Ctenomys"; taxonInfo.Specific_Epithet = "sociabilis"; taxonInfo.Taxonomic_Rank = "species"; taxonInfo.Common_Name = "Social Tuco-Tuco"; Name_Info name1 = new Name_Info(); name1.Name_Type = Name_Info_Type_Enum.personal; name1.Given_Name = "John Paul"; name1.Terms_Of_Address = "Pope; II"; name1.Dates = "1920-2002"; name1.User_Submitted = true; testPackage.Bib_Info.Add_Named_Entity(name1); Name_Info name2 = new Name_Info(); name2.Name_Type = Name_Info_Type_Enum.conference; name2.Full_Name = "Paris Peace Conference (1919-1920)"; name2.Dates = "1919-1920"; testPackage.Bib_Info.Add_Named_Entity(name2); Name_Info name3 = new Name_Info(); name3.Name_Type = Name_Info_Type_Enum.corporate; name3.Full_Name = "United States -- Court of Appeals (2nd Court)"; testPackage.Bib_Info.Add_Named_Entity(name3); Name_Info name4 = new Name_Info(); name4.Name_Type = Name_Info_Type_Enum.personal; name4.Full_Name = "Wilson, Mary"; name4.Display_Form = "Mary 'Weels' Wilson"; name4.Given_Name = "Mary"; name4.Family_Name = "Wilson"; name4.ID = "NAM4"; name4.Terms_Of_Address = "2nd"; name4.Add_Role("illustrator"); name4.Add_Role("cartographer"); testPackage.Bib_Info.Add_Named_Entity(name4); Name_Info donor = new Name_Info(); donor.Name_Type = Name_Info_Type_Enum.personal; donor.Full_Name = "Livingston, Arthur"; donor.Description = "Gift in honor of Arthur Livingston"; donor.Terms_Of_Address = "3rd"; donor.Add_Role("honoree", String.Empty); testPackage.Bib_Info.Donor = donor; testPackage.Bib_Info.Main_Title.NonSort = "The "; testPackage.Bib_Info.Main_Title.Title = "Man Who Would Be King"; testPackage.Bib_Info.Main_Title.Subtitle = "The story of succession in England"; Title_Info title1 = new Title_Info("homme qui voulut être roi", Title_Type_Enum.translated); title1.NonSort = "L'"; title1.Language = "fr"; testPackage.Bib_Info.Add_Other_Title(title1); Title_Info title2 = new Title_Info(); title2.Title = "Man Who Be King"; title2.Display_Label = "also known as"; title2.NonSort = "The"; title2.Title_Type = Title_Type_Enum.alternative; testPackage.Bib_Info.Add_Other_Title(title2); Title_Info title3 = new Title_Info(); title3.Title = "Great works of England"; title3.Authority = "naf"; title3.Add_Part_Name("Second Portion"); title3.Add_Part_Number("2nd"); title3.Title_Type = Title_Type_Enum.uniform; title3.User_Submitted = true; testPackage.Bib_Info.Add_Other_Title(title3); testPackage.Bib_Info.Add_Note("Funded by the NEH", Note_Type_Enum.funding); testPackage.Bib_Info.Add_Note("Based on a play which originally appeared in France as \"Un peu plus tard, un peu plus tôt\"").User_Submitted = true; testPackage.Bib_Info.Add_Note("Anne Baxter (Louise), Maria Perschy (Angela), Gustavo Rojo (Bill), Reginald Gilliam (Mr. Johnson), [Catherine Elliot?] (Aunt Sallie), Ben Tatar (waiter)", Note_Type_Enum.performers, "Performed By"); testPackage.Bib_Info.Origin_Info.Add_Place("New York", "nyu", "usa"); testPackage.Bib_Info.Origin_Info.Date_Issued = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_Start = "1992"; testPackage.Bib_Info.Origin_Info.MARC_DateIssued_End = "1993"; testPackage.Bib_Info.Origin_Info.Date_Copyrighted = "1999"; testPackage.Bib_Info.Origin_Info.Edition = "2nd"; Publisher_Info newPub = testPackage.Bib_Info.Add_Publisher("Published for the American Vacuum Society by the American Institute of Physics"); newPub.Add_Place("New York, New York"); newPub.User_Submitted = true; testPackage.Bib_Info.Add_Publisher("University of Florida Press House").Add_Place("Gainesville, FL"); testPackage.Bib_Info.Add_Manufacturer("Addison Randly Publishing House"); testPackage.Bib_Info.Original_Description.Extent = "1 sound disc (56 min.) : digital ; 3/4 in."; testPackage.Bib_Info.Original_Description.Add_Note("The sleeve of this sound disc was damaged in a fire"); testPackage.Bib_Info.Original_Description.Add_Note("The disc has a moderate amount of scratches, but still plays"); testPackage.Bib_Info.Series_Part_Info.Day = "18"; testPackage.Bib_Info.Series_Part_Info.Day_Index = 18; testPackage.Bib_Info.Series_Part_Info.Month = "Syyskuu"; testPackage.Bib_Info.Series_Part_Info.Month_Index = 9; testPackage.Bib_Info.Series_Part_Info.Year = "1992"; testPackage.Bib_Info.Series_Part_Info.Year_Index = 1992; testPackage.Bib_Info.Series_Part_Info.Enum1 = "Volume 12"; testPackage.Bib_Info.Series_Part_Info.Enum1_Index = 12; testPackage.Bib_Info.Series_Part_Info.Enum2 = "Issue 3"; testPackage.Bib_Info.Series_Part_Info.Enum2_Index = 3; testPackage.Bib_Info.Series_Part_Info.Enum3 = "Part 1"; testPackage.Bib_Info.Series_Part_Info.Enum3_Index = 1; testPackage.Behaviors.Serial_Info.Add_Hierarchy(1, 1992, "1992"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(2, 9, "Syyskuu"); testPackage.Behaviors.Serial_Info.Add_Hierarchy(3, 18, "18"); testPackage.Bib_Info.SeriesTitle.Title = "Shakespeare's most famous musicals"; testPackage.Bib_Info.Add_Target_Audience("young adults"); testPackage.Bib_Info.Add_Target_Audience("adolescent", "marctarget"); testPackage.Bib_Info.SobekCM_Type = TypeOfResource_SobekCM_Enum.Newspaper; // Add cartographic subject Subject_Info_Cartographics newCartographics = testPackage.Bib_Info.Add_Cartographics_Subject(); newCartographics.Scale = "1:2000"; newCartographics.Projection = "Conical Projection"; newCartographics.Coordinates = "E 72°--E 148°/N 13°--N 18°"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical.Continent = "North America"; hierarchical.Country = "United States of America"; hierarchical.State = "Kansas"; hierarchical.County = "Butler"; hierarchical.City = "Augusta"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical2 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical2.Region = "Arctic Ocean"; // Add hierarchical geographic subject Subject_Info_HierarchicalGeographic hierarchical3 = testPackage.Bib_Info.Add_Hierarchical_Geographic_Subject(); hierarchical3.Island = "Puerto Rico"; hierarchical3.Language = "English"; hierarchical3.Province = "Provincial"; hierarchical3.Territory = "Puerto Rico"; hierarchical3.Area = "Intercontinental areas (Western Hemisphere)"; // Add a name subject Subject_Info_Name subjname1 = testPackage.Bib_Info.Add_Name_Subject(); subjname1.Authority = "lcsh"; subjname1.Full_Name = "Garcia Lorca, Federico"; subjname1.Dates = "1898-1936"; subjname1.Add_Geographic("Russia"); subjname1.Add_Geographic("Moscow"); subjname1.Add_Genre("maps"); subjname1.User_Submitted = true; // Add a title information subject Subject_Info_TitleInfo subjtitle1 = testPackage.Bib_Info.Add_Title_Subject(); subjtitle1.Title_Type = Title_Type_Enum.uniform; subjtitle1.Authority = "naf"; subjtitle1.Title = "Missale Carnotense"; // Add a standard subject Subject_Info_Standard subject1 = testPackage.Bib_Info.Add_Subject(); subject1.Authority = "lcsh"; subject1.Add_Topic("Real property"); subject1.Add_Geographic("Mississippi"); subject1.Add_Geographic("Tippah County"); subject1.Add_Genre("Maps"); // Add a standard subject Subject_Info_Standard subject2 = testPackage.Bib_Info.Add_Subject(); subject2.Add_Occupation("Migrant laborers"); subject2.Add_Genre("School district case files"); // Add a standard subject Subject_Info_Standard subject3 = testPackage.Bib_Info.Add_Subject(); subject3.Authority = "lctgm"; subject3.Add_Topic("Educational buildings"); subject3.Add_Geographic("Washington (D.C.)"); subject3.Add_Temporal("1890-1910"); // Add a standard subject Subject_Info_Standard subject4 = testPackage.Bib_Info.Add_Subject(); subject4.Authority = "rvm"; subject4.Language = "french"; subject4.Add_Topic("Église catholique"); subject4.Add_Topic("Histoire"); subject4.Add_Temporal("20e siècle"); // Add record information testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("English", "eng", "en")); testPackage.Bib_Info.Record.Add_Catalog_Language(new Language_Info("French", "fre", "fr")); testPackage.Bib_Info.Record.MARC_Creation_Date = "080303"; testPackage.Bib_Info.Record.Add_MARC_Record_Content_Sources("FUG"); testPackage.Bib_Info.Record.Record_Origin = "Imported from (OCLC)001213124"; // Test the items which are in the non-MODS portion of the Bib_Info object testPackage.BibID = "MVS0000001"; testPackage.VID = "00001"; testPackage.Bib_Info.SortDate = 1234; testPackage.Bib_Info.SortTitle = "MAN WHO WOULD BE KING"; testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Recent history"); testPackage.Bib_Info.Add_Temporal_Subject(1990, 2002, "Lähihistoria"); testPackage.Bib_Info.Source.Code = "UF"; testPackage.Bib_Info.Source.Statement = "University of Florida"; // Add an affiliation Affiliation_Info affiliation1 = new Affiliation_Info(); affiliation1.University = "University of Florida"; affiliation1.Campus = "Gainesville Campus"; affiliation1.College = "College of Engineering"; affiliation1.Department = "Computer Engineering Department"; affiliation1.Unit = "Robotics"; affiliation1.Name_Reference = "NAM4"; testPackage.Bib_Info.Add_Affiliation(affiliation1); // Add a related item Related_Item_Info relatedItem1 = new Related_Item_Info(); relatedItem1.SobekCM_ID = "UF00001234"; relatedItem1.Relationship = Related_Item_Type_Enum.preceding; relatedItem1.Publisher = "Gainesville Sun Publishing House"; relatedItem1.Add_Note(new Note_Info("Digitized with funding from NEH", Note_Type_Enum.funding)); relatedItem1.Add_Note(new Note_Info("Gainesville Bee was the precursor to this item")); relatedItem1.Main_Title.NonSort = "The"; relatedItem1.Main_Title.Title = "Gainesville Bee"; relatedItem1.Add_Identifier("01234353", "oclc"); relatedItem1.Add_Identifier("002232311", "aleph"); Name_Info ri_name = new Name_Info(); ri_name.Full_Name = "Hills, Bryan"; ri_name.Terms_Of_Address = "Mr."; ri_name.Name_Type = Name_Info_Type_Enum.personal; ri_name.Add_Role("author"); relatedItem1.Add_Name(ri_name); relatedItem1.URL = @"http://www.uflib.ufl.edu/ufdc/?b=UF00001234"; relatedItem1.URL_Display_Label = "Full Text"; testPackage.Bib_Info.Add_Related_Item(relatedItem1); // Add another related item Related_Item_Info relatedItem2 = new Related_Item_Info(); relatedItem2.Relationship = Related_Item_Type_Enum.succeeding; relatedItem2.SobekCM_ID = "UF00009999"; relatedItem2.Main_Title.NonSort = "The"; relatedItem2.Main_Title.Title = "Daily Sun"; relatedItem2.Add_Identifier("0125437", "oclc"); relatedItem2.Add_Note("Name change occured in Fall 1933"); relatedItem2.Start_Date = "Fall 1933"; relatedItem2.End_Date = "December 31, 1945"; testPackage.Bib_Info.Add_Related_Item(relatedItem2); // Add some processing parameters testPackage.Behaviors.Add_Aggregation("JUV"); testPackage.Behaviors.Add_Aggregation("DLOC"); testPackage.Behaviors.Add_Aggregation("DLOSA1"); testPackage.Behaviors.Add_Aggregation("ALICE"); testPackage.Behaviors.Add_Aggregation("ARTE"); testPackage.Web.GUID = "GUID!"; testPackage.Behaviors.Add_Wordmark("DLOC"); testPackage.Behaviors.Add_Wordmark("UFSPEC"); testPackage.Behaviors.Main_Thumbnail = "00001thm.jpg"; // Add some downloads testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.PDF"); testPackage.Divisions.Download_Tree.Add_File("MVS_Complete.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.MP2"); testPackage.Divisions.Download_Tree.Add_File("MVS_Part1.PDF"); // Add some coordinate information GeoSpatial_Information geoSpatial = new GeoSpatial_Information(); testPackage.Add_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY, geoSpatial); geoSpatial.Add_Point(29.530151, -82.301459, "Lake Wauberg"); geoSpatial.Add_Point(29.634352, -82.350640, "Veterinary School"); Coordinate_Polygon polygon = new Coordinate_Polygon(); polygon.Label = "University of Florida Campus"; polygon.Add_Edge_Point(new Coordinate_Point(29.651435, -82.339869, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.641216, -82.340298, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.629503, -82.371969, String.Empty)); polygon.Add_Edge_Point(new Coordinate_Point(29.649645, -82.371712, String.Empty)); polygon.Add_Inner_Point(29.649794, -82.351971, "Stadium"); polygon.Add_Inner_Point(29.650988, -82.341156, "Library"); geoSpatial.Add_Polygon(polygon); Coordinate_Line line = new Coordinate_Line(); line.Label = "Waldo Road"; line.Add_Point(29.652852, -82.310944, "Gainesville"); line.Add_Point(29.716681, -82.268372, String.Empty); line.Add_Point(29.791494, -82.167778, "Waldo"); geoSpatial.Add_Line(line); // Add some performing arts information Performing_Arts_Info partInfo = new Performing_Arts_Info(); testPackage.Add_Metadata_Module("PerformingArts", partInfo); partInfo.Performance = "Hamlet"; partInfo.Performance_Date = "August 12, 1923"; Performer performer1 = partInfo.Add_Performer("Sullivan, Mark"); performer1.Sex = "M"; performer1.LifeSpan = "1873-"; performer1.Occupation = "actor"; performer1.Title = "Mr."; Performer performer2 = partInfo.Add_Performer("Waldbart, Julia"); performer2.Sex = "F"; performer2.LifeSpan = "1876-"; performer2.Occupation = "actress"; performer2.Title = "Mrs."; // Add some oral history information Oral_Interview_Info oralInfo = new Oral_Interview_Info(); testPackage.Add_Metadata_Module("OralInterview", oralInfo); oralInfo.Interviewee = "Edwards, Herm"; oralInfo.Interviewer = "Proctor, Samual"; // Add some learning object resource information LearningObjectMetadata lomInfo = new LearningObjectMetadata(); testPackage.Add_Metadata_Module(GlobalVar.IEEE_LOM_METADATA_MODULE_KEY, lomInfo); lomInfo.AggregationLevel = AggregationLevelEnum.level3; lomInfo.Status = StatusEnum.draft; LOM_System_Requirements lomReq1 = new LOM_System_Requirements(); lomReq1.RequirementType = RequirementTypeEnum.operating_system; lomReq1.Name.Value = "Windows"; lomReq1.MinimumVersion = "Windows XP"; lomReq1.MaximumVersion = "Windows 7"; lomInfo.Add_SystemRequirements(lomReq1); LOM_System_Requirements lomReq2 = new LOM_System_Requirements(); lomReq2.RequirementType = RequirementTypeEnum.software; lomReq2.Name.Value = "Java SDK"; lomReq2.MinimumVersion = "1.7.1"; lomReq2.MaximumVersion = "2.09"; lomInfo.Add_SystemRequirements(lomReq2); lomInfo.InteractivityType = InteractivityTypeEnum.mixed; lomInfo.Add_LearningResourceType("exercise"); lomInfo.Add_LearningResourceType("Tutorials", "encdlwebpedagogicaltype"); lomInfo.InteractivityLevel = InteractivityLevelEnum.high; lomInfo.Add_IntendedEndUserRole(IntendedEndUserRoleEnum.learner); lomInfo.Add_Context("Undergraduate lower division", "enclearningcontext"); lomInfo.Add_Context("15", "grade"); lomInfo.Add_Context("16", "grade"); lomInfo.Add_Context("5", "group"); lomInfo.Add_TypicalAgeRange("suitable for children over 7", "en"); lomInfo.Add_TypicalAgeRange("2-8"); lomInfo.DifficultyLevel = DifficultyLevelEnum.medium; lomInfo.TypicalLearningTime = "PT45M"; LOM_Classification lomClassification1 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification1); lomClassification1.Purpose.Value = "Discipline"; LOM_TaxonPath lomTaxonPath1 = new LOM_TaxonPath(); lomClassification1.Add_TaxonPath(lomTaxonPath1); lomTaxonPath1.Add_SourceName("ARIADNE"); LOM_Taxon lomTaxon1 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon1); lomTaxon1.ID = "BF120"; lomTaxon1.Add_Entry("Work_History", "en"); lomTaxon1.Add_Entry("Historie", "nl"); LOM_Taxon lomTaxon2 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon2); lomTaxon2.ID = "BF120.1"; lomTaxon2.Add_Entry("American Work_History", "en"); LOM_Taxon lomTaxon3 = new LOM_Taxon(); lomTaxonPath1.Add_Taxon(lomTaxon3); lomTaxon3.ID = "BF120.1.4"; lomTaxon3.Add_Entry("American Civil War", "en"); LOM_Classification lomClassification2 = new LOM_Classification(); lomInfo.Add_Classification(lomClassification2); lomClassification2.Purpose.Value = "Educational Objective"; LOM_TaxonPath lomTaxonPath2 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath2); lomTaxonPath2.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon4 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon4); lomTaxon4.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon5 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon5); lomTaxon5.ID = "3"; lomTaxon5.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon6 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon6); lomTaxon6.ID = "OA"; lomTaxon6.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon7 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon7); lomTaxon7.ID = "A"; lomTaxon7.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon8 = new LOM_Taxon(); lomTaxonPath2.Add_Taxon(lomTaxon8); lomTaxon8.ID = "3"; lomTaxon8.Add_Entry("Use multiplication and division within 100 to solve word problems in situations involving equal groups, arrays, and measurement quantities, e.g., by using drawings and equations with a symbol for the unknown number to represent the problem.", "en"); LOM_TaxonPath lomTaxonPath3 = new LOM_TaxonPath(); lomClassification2.Add_TaxonPath(lomTaxonPath3); lomTaxonPath3.Add_SourceName("Common Core Standards", "en"); LOM_Taxon lomTaxon14 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon14); lomTaxon14.ID = "CCS.Math.Content"; LOM_Taxon lomTaxon15 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon15); lomTaxon15.ID = "3"; lomTaxon15.Add_Entry("Grade 3", "en"); LOM_Taxon lomTaxon16 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon16); lomTaxon16.ID = "OA"; lomTaxon16.Add_Entry("Operations and Algebraic Thinking", "en"); LOM_Taxon lomTaxon17 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon17); lomTaxon17.ID = "A"; lomTaxon17.Add_Entry("Represent and solve problems involving multiplication and division.", "en"); LOM_Taxon lomTaxon18 = new LOM_Taxon(); lomTaxonPath3.Add_Taxon(lomTaxon18); lomTaxon18.ID = "4"; lomTaxon18.Add_Entry("Determine the unknown whole number in a multiplication or division equation relating three whole numbers. For example, determine the unknown number that makes the equation true in each of the equations 8 × ? = 48, 5 = _ ÷ 3, 6 × 6 = ?", "en"); // Add some views and interfaces testPackage.Behaviors.Clear_Web_Skins(); testPackage.Behaviors.Add_Web_Skin("dLOC"); testPackage.Behaviors.Add_Web_Skin("UFDC"); testPackage.Behaviors.Add_View(View_Enum.JPEG2000); testPackage.Behaviors.Add_View(View_Enum.JPEG); testPackage.Behaviors.Add_View(View_Enum.RELATED_IMAGES); testPackage.Behaviors.Add_View(View_Enum.HTML, "Full Document", "MVS001214.html"); // Create the chapters and pages and link them Division_TreeNode chapter1 = new Division_TreeNode("Chapter", "First Chapter"); Page_TreeNode page1 = new Page_TreeNode("First Page"); Page_TreeNode page2 = new Page_TreeNode("Page 2"); chapter1.Nodes.Add(page1); chapter1.Nodes.Add(page2); Division_TreeNode chapter2 = new Division_TreeNode("Chapter", "Last Chapter"); Page_TreeNode page3 = new Page_TreeNode("Page 3"); Page_TreeNode page4 = new Page_TreeNode("Last Page"); chapter2.Nodes.Add(page3); chapter2.Nodes.Add(page4); testPackage.Divisions.Physical_Tree.Roots.Add(chapter1); testPackage.Divisions.Physical_Tree.Roots.Add(chapter2); // Create the files SobekCM_File_Info file1_1 = new SobekCM_File_Info("2000626_0001.jp2", 2120, 1100); SobekCM_File_Info file1_2 = new SobekCM_File_Info("2000626_0001.jpg", 630, 330); SobekCM_File_Info file1_3 = new SobekCM_File_Info("2000626_0001.tif"); SobekCM_File_Info file2_1 = new SobekCM_File_Info("2000626_0002.jp2", 1754, 2453); SobekCM_File_Info file2_2 = new SobekCM_File_Info("2000626_0002.jpg", 630, 832); SobekCM_File_Info file2_3 = new SobekCM_File_Info("2000626_0002.tif"); SobekCM_File_Info file3_1 = new SobekCM_File_Info("2000626_0003.jp2", 2321, 1232); SobekCM_File_Info file3_2 = new SobekCM_File_Info("2000626_0003.jpg", 630, 342); SobekCM_File_Info file3_3 = new SobekCM_File_Info("2000626_0003.tif"); SobekCM_File_Info file4_1 = new SobekCM_File_Info("2000626_0004.jp2", 2145, 1024); SobekCM_File_Info file4_2 = new SobekCM_File_Info("2000626_0004.jpg", 630, 326); SobekCM_File_Info file4_3 = new SobekCM_File_Info("2000626_0004.tif"); // Link the files to the pages page1.Files.Add(file1_1); page1.Files.Add(file1_2); page1.Files.Add(file1_3); page2.Files.Add(file2_1); page2.Files.Add(file2_2); page2.Files.Add(file2_3); page3.Files.Add(file3_1); page3.Files.Add(file3_2); page3.Files.Add(file3_3); page4.Files.Add(file4_1); page4.Files.Add(file4_2); page4.Files.Add(file4_3); // Add the DAITSS information DAITSS_Info daitssInfo = new DAITSS_Info(); daitssInfo.Account = "FTU"; daitssInfo.SubAccount = "CLAS"; daitssInfo.Project = "UFDC"; daitssInfo.toArchive = true; testPackage.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); PALMM_Info palmmInfo = new PALMM_Info(); testPackage.Add_Metadata_Module("PALMM", palmmInfo); palmmInfo.toPALMM = false; // Save this package testPackage.Source_Directory = directory; return(testPackage); }
public void Do_Work() { string username = WindowsIdentity.GetCurrent().Name; List <string> directories_to_process = new List <string>(); try { recurse_through_directories(directory, directories_to_process); } catch { } // Now, iterate through all the directories int current_directory = 1; int errors_encountered = 0; foreach (string thisDirectory in directories_to_process) { try { DirectoryInfo thisDirectoryInfo = new DirectoryInfo(thisDirectory); string folder_name_for_progress = thisDirectoryInfo.Name; if (folder_name_for_progress.Length <= 5) { folder_name_for_progress = (thisDirectoryInfo.Parent.Name) + "\\" + folder_name_for_progress; } OnNewFolder(folder_name_for_progress + " ( " + current_directory + " of " + directories_to_process.Count + " )"); // Get the metadata file string[] metadata = Directory.GetFiles(thisDirectory, filter); if (metadata.Length > 0) { SobekCM_Item newItem = null; if (metadata_type.IndexOf("METS") >= 0) { newItem = SobekCM_Item.Read_METS(metadata[0]); } else { newItem = new SobekCM_Item(); newItem.Source_Directory = thisDirectory; newItem = new SobekCM_Item(); List <string> addOns = MetaTemplate_UserSettings.AddOns_Enabled; // Set the initial agents if (MetaTemplate_UserSettings.Individual_Creator.Length > 0) { newItem.METS_Header.Creator_Individual = MetaTemplate_UserSettings.Individual_Creator; } else { newItem.METS_Header.Creator_Individual = username; } newItem.METS_Header.Creator_Software = "SobekCM METS Editor"; // Add FCLA add-on defaults if (addOns.Contains("FCLA")) { PALMM_Info palmmInfo = newItem.Get_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY) as PALMM_Info; if (palmmInfo == null) { palmmInfo = new PALMM_Info(); newItem.Add_Metadata_Module(GlobalVar.PALMM_METADATA_MODULE_KEY, palmmInfo); } palmmInfo.PALMM_Project = MetaTemplate_UserSettings.PALMM_Code; palmmInfo.toPALMM = MetaTemplate_UserSettings.FCLA_Flag_PALMM; DAITSS_Info daitssInfo = newItem.Get_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY) as DAITSS_Info; if (daitssInfo == null) { daitssInfo = new DAITSS_Info(); newItem.Add_Metadata_Module(GlobalVar.DAITSS_METADATA_MODULE_KEY, daitssInfo); } daitssInfo.toArchive = MetaTemplate_UserSettings.FCLA_Flag_FDA; daitssInfo.Account = MetaTemplate_UserSettings.FDA_Account; daitssInfo.SubAccount = MetaTemplate_UserSettings.FDA_SubAccount; daitssInfo.Project = MetaTemplate_UserSettings.FDA_Project; } // Add SobekCM add-on defaults if (addOns.Contains("SOBEKCM")) { // Add any wordmarks List <string> wordmarks = MetaTemplate_UserSettings.SobekCM_Wordmarks; foreach (string thisWordmark in wordmarks) { newItem.Behaviors.Add_Wordmark(thisWordmark); } // Add any aggregations List <string> aggregations = MetaTemplate_UserSettings.SobekCM_Aggregations; foreach (string thisAggregation in aggregations) { newItem.Behaviors.Add_Aggregation(thisAggregation); } // Add any web skins List <string> webskins = MetaTemplate_UserSettings.SobekCM_Web_Skins; foreach (string thisWebSkin in webskins) { newItem.Behaviors.Add_Web_Skin(thisWebSkin); } // Add any viewers List <string> viewers = MetaTemplate_UserSettings.SobekCM_Viewers; foreach (string thisViewer in viewers) { if (String.Compare(thisViewer, "Page Image (JPEG)") == 0) { newItem.Behaviors.Add_View(View_Enum.JPEG); } if (String.Compare(thisViewer, "Zoomable (JPEG2000)") == 0) { newItem.Behaviors.Add_View(View_Enum.JPEG2000); } if (String.Compare(thisViewer, "Page Turner") == 0) { newItem.Behaviors.Add_View(View_Enum.PAGE_TURNER); } if (String.Compare(thisViewer, "Text") == 0) { newItem.Behaviors.Add_View(View_Enum.TEXT); } if (String.Compare(thisViewer, "Thumbnails") == 0) { newItem.Behaviors.Add_View(View_Enum.RELATED_IMAGES); } } } // Add all other defaults newItem.Bib_Info.Source.Code = MetaTemplate_UserSettings.Default_Source_Code; newItem.Bib_Info.Source.Statement = MetaTemplate_UserSettings.Default_Source_Statement; if (MetaTemplate_UserSettings.Default_Funding_Note.Length > 0) { newItem.Bib_Info.Add_Note(MetaTemplate_UserSettings.Default_Funding_Note, Note_Type_Enum.funding); } if (MetaTemplate_UserSettings.Default_Rights_Statement.Length > 0) { newItem.Bib_Info.Access_Condition.Text = MetaTemplate_UserSettings.Default_Rights_Statement; } // Set some final values newItem.Bib_Info.Type.MODS_Type = TypeOfResource_MODS_Enum.Text; // Assign an ObjectID switch (next_bibid_counter) { case -1: newItem.METS_Header.ObjectID = thisDirectoryInfo.Name; if ((newItem.METS_Header.ObjectID.Length == 16) && (newItem.METS_Header.ObjectID[10] == '_')) { newItem.VID = newItem.BibID.Substring(11); newItem.BibID = newItem.BibID.Substring(0, 10).ToUpper(); } break; case -2: newItem.METS_Header.ObjectID = (new FileInfo(metadata[0])).Name; if ((newItem.METS_Header.ObjectID.Length == 16) && (newItem.METS_Header.ObjectID[10] == '_')) { newItem.VID = newItem.BibID.Substring(11); newItem.BibID = newItem.BibID.Substring(0, 10).ToUpper(); } break; default: string next_bibid = next_bibid_counter.ToString(); next_bibid_counter++; newItem.BibID = (bibid_start + next_bibid.PadLeft(10 - bibid_start.Length, '0')).ToUpper(); newItem.VID = "00001"; break; } string errors = String.Empty; if (metadata_type.IndexOf("DUBLIN CORE") >= 0) { // Open a stream to read the indicated import file Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read); DC_File_ReaderWriter dcreader = new DC_File_ReaderWriter(); dcreader.Read_Metadata(reader, newItem, null, out errors); } if (metadata_type.IndexOf("MODS") >= 0) { // Open a stream to read the indicated import file Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read); MODS_File_ReaderWriter dcreader = new MODS_File_ReaderWriter(); dcreader.Read_Metadata(reader, newItem, null, out errors); } if (metadata_type.IndexOf("MARCXML") >= 0) { // Open a stream to read the indicated import file Stream reader = new FileStream(metadata[0], FileMode.Open, FileAccess.Read); MarcXML_File_ReaderWriter dcreader = new MarcXML_File_ReaderWriter(); dcreader.Read_Metadata(reader, newItem, null, out errors); } } // Make sure there is a title if (newItem.Bib_Info.Main_Title.ToString().Trim().Length == 0) { newItem.Bib_Info.Main_Title.Title = "Missing Title"; } // We now have a good METS file, so let's look for files to add string[] existing_files = Directory.GetFiles(thisDirectory); bool image_files_found = false; List <string> otherFiles = new List <string>(); foreach (string thisFile in existing_files) { string upper_case = new FileInfo(thisFile).Name.ToUpper(); if ((upper_case.IndexOf(".TIF") > 0) || (upper_case.IndexOf(".JPG") > 0) || (upper_case.IndexOf(".JP2") > 0)) { image_files_found = true; } else if ((upper_case.IndexOf(".METS") < 0) && (upper_case.IndexOf(".TXT") < 0) && (upper_case.IndexOf(".PRO") < 0) && (upper_case.IndexOf(".XML") < 0) && (upper_case.IndexOf(".MODS") < 0) && (upper_case.IndexOf(".DC") < 0)) { otherFiles.Add((new FileInfo(thisFile)).Name); } } // Add the image files first newItem.Source_Directory = thisDirectory; Bib_Package_Builder.Add_All_Files(newItem, "*.tif|*.jpg|*.jp2|*.txt|*.pro|*.gif", MetaTemplate_UserSettings.Always_Recurse_Through_Subfolders_On_New, MetaTemplate_UserSettings.Page_Images_In_Seperate_Folders_Can_Be_Same_Page); // Add any downloads next foreach (string thisFile in otherFiles) { newItem.Divisions.Download_Tree.Add_File(thisFile); } // Now, save this METS file // Prepare to save the enw METS // Determine the filename string mets_file = thisDirectory + "\\" + newItem.METS_Header.ObjectID + MetaTemplate_UserSettings.METS_File_Extension; // Save the actual file newItem.Divisions.Suppress_Checksum = !MetaTemplate_UserSettings.Include_Checksums; // Save the actual file METS_File_ReaderWriter metsWriter = new METS_File_ReaderWriter(); string writing_error = String.Empty; metsWriter.Write_Metadata(mets_file, newItem, null, out writing_error); } } catch (Exception ee) { errors_encountered++; } OnNewProgress(current_directory, directories_to_process.Count); current_directory++; } OnComplete(current_directory, errors_encountered); }