Exemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        public void SetAdditionalMetsData(RampArchivingDlgViewModel model)
        {
            foreach (var session in GetAllSessions())
            {
                model.SetScholarlyWorkType(ScholarlyWorkType.PrimaryData);
                model.SetDomains(SilDomain.Ling_LanguageDocumentation);

                var value = session.MetaDataFile.GetStringValue(SessionFileType.kDateFieldName, null);
                if (!string.IsNullOrEmpty(value))
                {
                    model.SetCreationDate(value);
                }

                // Return the session's note as the abstract portion of the package's description.
                value = session.MetaDataFile.GetStringValue(SessionFileType.kSynopsisFieldName, null);
                if (!string.IsNullOrEmpty(value))
                {
                    model.SetAbstract(value, string.Empty);
                }

                // Set contributors
                var contributions = session.MetaDataFile.GetValue("contributions", null) as ContributionCollection;
                if (contributions != null && contributions.Count > 0)
                {
                    model.SetContributors(contributions);
                }

                // Return total duration of source audio/video recordings.
                TimeSpan totalDuration = session.GetTotalDurationOfSourceMedia();
                if (totalDuration.Ticks > 0)
                {
                    model.SetAudioVideoExtent(string.Format("Total Length of Source Recordings: {0}", totalDuration.ToString()));
                }

                //First session details are enough for "Archive RAMP (SIL)..." from Project menu
                break;
            }
        }
Exemplo n.º 2
0
        /// ------------------------------------------------------------------------------------
        public void SetAdditionalMetsData(RampArchivingDlgViewModel model)
        {
            model.SetScholarlyWorkType(ScholarlyWorkType.PrimaryData);
            model.SetDomains(SilDomain.Ling_LanguageDocumentation);

            var value = MetaDataFile.GetStringValue(SessionFileType.kDateFieldName, null);

            if (!string.IsNullOrEmpty(value))
            {
                model.SetCreationDate(value);
            }

            // Return the session's note as the abstract portion of the package's description.
            value = MetaDataFile.GetStringValue(SessionFileType.kSynopsisFieldName, null);
            if (!string.IsNullOrEmpty(value))
            {
                model.SetAbstract(value, string.Empty);
            }

            // Set contributors
            var contributions = MetaDataFile.GetValue(SessionFileType.kContributionsFieldName, null) as ContributionCollection;

            if (contributions != null && contributions.Count > 0)
            {
                model.SetContributors(contributions);
            }

            // Return total duration of source audio/video recordings.
            TimeSpan totalDuration = GetTotalDurationOfSourceMedia();

            if (totalDuration.Ticks > 0)
            {
                model.SetAudioVideoExtent(string.Format("Total Length of Source Recordings: {0}", totalDuration.ToString()));
            }

            //model.SetSoftwareRequirements("SayMore");
        }
Exemplo n.º 3
0
        /// ------------------------------------------------------------------------------------
        /// <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 + ".");
            }
        }