/// <summary> Add a single descriptive element, by term </summary> /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param> /// <param name="Value"> String version of this single value for a metadata term/type </param> public void Add_Description(string Term, ReadOnlyCollection <string> Value) { // If the value is NULL or empty, do nothing if ((Value == null) || (Value.Count == 0)) { return; } // Was a value, so look to add it BriefItem_DescriptiveTerm currentList; if (descriptionTermLookup.TryGetValue(Term, out currentList)) { foreach (string thisValue in Value) { currentList.Add_Value(thisValue); } } else { BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term); foreach (string thisValue in Value) { newElement.Add_Value(thisValue); } Description.Add(newElement); descriptionTermLookup.Add(Term, newElement); } }
/// <summary> Add a fully built descriptive element, by term </summary> /// <param name="TermObject"> Fully built descriptive term element, as employed by the SobekCM system </param> public void Add_Description(BriefItem_DescriptiveTerm TermObject) { // Was a value, so look to add it if (!descriptionTermLookup.ContainsKey(TermObject.Term)) { descriptionTermLookup.Add(TermObject.Term, TermObject); Description.Add(TermObject); } }
/// <summary> Map one or more data elements from the original METS-based object to the /// BriefItem object </summary> /// <param name="Original"> Original METS-based object </param> /// <param name="New"> New object to populate some data from the original </param> /// <returns> TRUE if successful, FALSE if an exception is encountered </returns> public bool MapToBriefItem(SobekCM_Item Original, BriefItemInfo New) { if (Original.Bib_Info.Subjects_Count > 0) { int spatial_count = 1; foreach (Subject_Info thisSubject in Original.Bib_Info.Subjects) { if (thisSubject.Class_Type == Subject_Info_Type.Hierarchical_Spatial) { // Determine the term to use string term = "Hierarchical Spatial"; if (spatial_count > 1) term = term + " (" + spatial_count + ")"; // Start to build this BriefItem_DescriptiveTerm thisTerm = new BriefItem_DescriptiveTerm(term); // Cast to the hierarchical geographic subject Subject_Info_HierarchicalGeographic hieroSubj = (Subject_Info_HierarchicalGeographic)thisSubject; // Now, step through and add each subterm if (!String.IsNullOrWhiteSpace(hieroSubj.Continent)) thisTerm.Add_Value(hieroSubj.Continent, "Continent"); if (!String.IsNullOrWhiteSpace(hieroSubj.Country)) thisTerm.Add_Value(hieroSubj.Country, "Country"); if (!String.IsNullOrWhiteSpace(hieroSubj.Province)) thisTerm.Add_Value(hieroSubj.Province, "Province"); if (!String.IsNullOrWhiteSpace(hieroSubj.Region)) thisTerm.Add_Value(hieroSubj.Region, "Region"); if (!String.IsNullOrWhiteSpace(hieroSubj.State)) thisTerm.Add_Value(hieroSubj.State, "State"); if (!String.IsNullOrWhiteSpace(hieroSubj.Territory)) thisTerm.Add_Value(hieroSubj.Territory, "Territory"); if (!String.IsNullOrWhiteSpace(hieroSubj.County)) thisTerm.Add_Value(hieroSubj.County, "County"); if (!String.IsNullOrWhiteSpace(hieroSubj.City)) thisTerm.Add_Value(hieroSubj.City, "City"); if (!String.IsNullOrWhiteSpace(hieroSubj.CitySection)) thisTerm.Add_Value(hieroSubj.CitySection, "City Section"); if (!String.IsNullOrWhiteSpace(hieroSubj.Island)) thisTerm.Add_Value(hieroSubj.Island, "Island"); if (!String.IsNullOrWhiteSpace(hieroSubj.Area)) thisTerm.Add_Value(hieroSubj.Area, "Area"); // Were some values found? if ((thisTerm.Values != null) && (thisTerm.Values.Count > 0)) { New.Add_Description(thisTerm); spatial_count++; } } } } return true; }
/// <summary> Add a single descriptive element, by term </summary> /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param> /// <param name="Value"> String version of this single value for a metadata term/type </param> public BriefItem_DescTermValue Add_Description(string Term, string Value) { // If the value is NULL or empty, do nothing if (String.IsNullOrWhiteSpace(Value)) { return(null); } // Was a value, so look to add it BriefItem_DescriptiveTerm currentList; if (descriptionTermLookup.TryGetValue(Term, out currentList)) { return(currentList.Add_Value(Value)); } else { BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term); descriptionTermLookup.Add(Term, newElement); Description.Add(newElement); return(newElement.Add_Value(Value)); } }
/// <summary> Add a single descriptive element, by term </summary> /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param> /// <param name="Value"> String version of this single value for a metadata term/type </param> public void Add_Description(string Term, ReadOnlyCollection<string> Value) { // If the value is NULL or empty, do nothing if (( Value == null ) || ( Value.Count == 0 )) return; // Was a value, so look to add it BriefItem_DescriptiveTerm currentList; if (descriptionTermLookup.TryGetValue(Term, out currentList)) { foreach( string thisValue in Value ) currentList.Add_Value(thisValue); } else { BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term); foreach (string thisValue in Value) newElement.Add_Value(thisValue); Description.Add(newElement); descriptionTermLookup.Add(Term, newElement); } }
/// <summary> Add a single descriptive element, by term </summary> /// <param name="Term"> Normalized term for this metadata element, as employed by the SobekCM system </param> /// <param name="Value"> String version of this single value for a metadata term/type </param> public BriefItem_DescTermValue Add_Description(string Term, string Value) { // If the value is NULL or empty, do nothing if (String.IsNullOrWhiteSpace(Value)) return null; // Was a value, so look to add it BriefItem_DescriptiveTerm currentList; if (descriptionTermLookup.TryGetValue(Term, out currentList)) { return currentList.Add_Value(Value); } else { BriefItem_DescriptiveTerm newElement = new BriefItem_DescriptiveTerm(Term); descriptionTermLookup.Add(Term, newElement); Description.Add(newElement); return newElement.Add_Value(Value); } }
/// <summary> Add a fully built descriptive element, by term </summary> /// <param name="TermObject"> Fully built descriptive term element, as employed by the SobekCM system </param> public void Add_Description(BriefItem_DescriptiveTerm TermObject ) { // Was a value, so look to add it if (!descriptionTermLookup.ContainsKey(TermObject.Term)) { descriptionTermLookup.Add(TermObject.Term, TermObject); Description.Add(TermObject); } }