/// ------------------------------------------------------------------------------------ /// <summary> /// Gets required and optional information that describes the files being submitted in /// the RAMP package. METS = Metadata Encoding & Transmission Standard /// (see http://www.loc.gov/METS/). /// </summary> /// <param name="model">Object provided by SIL.Archiving for setting application /// specific archiving information.</param> /// <param name="fieldWorksVersion">Fieldworks version to display.</param> /// <param name="cache"></param> /// <returns>A list of JSON encoded pairs that describe the information in the RAMP /// package.</returns> /// ------------------------------------------------------------------------------------ private void AddMetsPairs(RampArchivingDlgViewModel model, string fieldWorksVersion, FdoCache cache) { IWritingSystemManager wsManager = cache.ServiceLocator.GetInstance <IWritingSystemManager>(); var wsDefaultVern = wsManager.Get(cache.DefaultVernWs); var vernIso3Code = wsDefaultVern.GetIso3Code(); model.SetScholarlyWorkType(ScholarlyWorkType.PrimaryData); // use year range for CreationDate if possible GetCreateDateRange(cache); var yearStart = m_earliest.Year; var yearEnd = m_latest.Year; if (yearEnd > yearStart) { model.SetCreationDate(yearStart, yearEnd); } else { model.SetCreationDate(m_earliest); } model.SetModifiedDate(cache.LangProject.DateModified); if (!string.IsNullOrEmpty(vernIso3Code)) { model.SetSubjectLanguage(vernIso3Code, wsDefaultVern.LanguageName); } var contentLanguages = new List <ArchivingLanguage>(); var softwareRequirements = new HashSet <string>(); bool fWsUsesKeyman = false; softwareRequirements.Add(string.Format("FieldWorks Language Explorer, Version {0} or later", fieldWorksVersion)); foreach (var ws in cache.ServiceLocator.WritingSystems.CurrentVernacularWritingSystems.Union( cache.ServiceLocator.WritingSystems.CurrentAnalysisWritingSystems).Union( cache.ServiceLocator.WritingSystems.CurrentPronunciationWritingSystems)) { var iso3Code = ws.GetIso3Code(); if (!string.IsNullOrEmpty(iso3Code)) { contentLanguages.Add(new ArchivingLanguage(iso3Code, ws.LanguageSubtag.Name)); } if (!string.IsNullOrEmpty(ws.DefaultFontName)) { softwareRequirements.Add(ws.DefaultFontName); } fWsUsesKeyman |= DoesWritingSystemUseKeyman(ws); } if (fWsUsesKeyman) { softwareRequirements.Add("Keyman"); } model.SetContentLanguages(contentLanguages); model.SetSoftwareRequirements(softwareRequirements); SilDomain domains = SilDomain.Linguistics; var cNotebookRecords = cache.LangProject.ResearchNotebookOA.AllRecords.Count(); if (cNotebookRecords > 0) { domains |= SilDomain.Anthropology; domains |= SilDomain.Anth_Ethnography; // Data notebook data is considered a (partial) ethnography. } var cLexicalEntries = cache.LangProject.LexDbOA.Entries.Count(); if (cLexicalEntries > 0) { domains |= SilDomain.Ling_Lexicon; } // Determine if there are any interlinearized texts if (cache.ServiceLocator.GetInstance <IWfiAnalysisRepository>().AllInstances().Any(a => a.OccurrencesInTexts.Any() && a.GetAgentOpinion(cache.LangProject.DefaultUserAgent) == Opinions.approves)) { domains |= SilDomain.Ling_InterlinearizedText; } var cTexts = cache.LangProject.Texts.Count(); if (cTexts > 0) { domains |= SilDomain.Ling_Text; } /* TODO: If files to include in archive includes a Lift file, set the correct schema */ //if (filesToArchive.Contains( FwFileExtensions.ksLexiconInterchangeFormat ) // model.SetSchemaConformance("LIFT"); /* TODO: If files to include in archive includes a grammar sketch, set the correct subdomain */ //if (filesToArchive.Contains(...) // domains |= SilDomain.Ling_GrammaticalDescription; model.SetDomains(domains); // get the information for DatasetExtent var datasetExtent = new StringBuilder(); const string delimiter = "; "; if (cNotebookRecords > 0) { datasetExtent.AppendLineFormat("{0} Notebook record{1}", new object[] { cNotebookRecords, (cNotebookRecords == 1) ? "" : "s" }, delimiter); } if (cLexicalEntries > 0) { datasetExtent.AppendLineFormat("{0} Lexical entr{1}", new object[] { cLexicalEntries, (cLexicalEntries == 1) ? "y" : "ies" }, delimiter); } if (cTexts > 0) { datasetExtent.AppendLineFormat("{0} Text{1}", new object[] { cTexts, (cTexts == 1) ? "" : "s" }, delimiter); } if (datasetExtent.Length > 0) { model.SetDatasetExtent(datasetExtent + "."); } }