Exemple #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Fill in a keyterm node in the database from a Term
        /// </summary>
        /// <param name="owner">CmPossibility that is above the term in the hierarchy (probably
        /// a category)</param>
        /// <param name="term">Term to get info from</param>
        /// <param name="localizations">The localizations.</param>
        /// ------------------------------------------------------------------------------------
        private void AddTerm(ICmPossibility owner, Term term,
                             IEnumerable <BiblicalTermsLocalization> localizations)
        {
            int hvoWs = (term.Language == "Hebrew") ? m_wsHebrew : m_wsGreek;
            // Strip off any sense numbers
            string lemma = term.Lemma.TrimEnd(
                '-', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
            IChkTerm newTerm = CreateChkTerm(term.Id, hvoWs, lemma, term.Including, owner);

            Debug.Assert(newTerm != null);

            foreach (BiblicalTermsLocalization loc in localizations)
            {
                TermLocalization termLoc = loc.FindTerm(term.Id);
                if (termLoc != null)
                {
                    // First "gloss" is the primary one and will become the name of the
                    // possibility. Susequent glosses will be stored in the SeeAlso field.
                    SetLocalizedGlossAndDescription(newTerm, termLoc, loc.WritingSystemHvo);
                }
            }

            // If there are references on this node then add them to the keyterm node
            AddRefsToKeyTerm(term.Id, newTerm, hvoWs, term.References,
                             term.Form ?? lemma);
        }
Exemple #2
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Sets the localized gloss, description, and "see also" information in the given
 /// writing system for a key term.
 /// </summary>
 /// <param name="term">The key term</param>
 /// <param name="termLoc">The localization information</param>
 /// <param name="ws">The HVO of the writing system</param>
 /// ------------------------------------------------------------------------------------
 private void SetLocalizedGlossAndDescription(IChkTerm term, TermLocalization termLoc, int ws)
 {
     string[] glosses = termLoc.Gloss.Split(new [] { ';' }, 2);
     SetLocalizedInfo(term, ws, glosses[0].Trim(), termLoc.DescriptionText == null ? null :
                      termLoc.DescriptionText.Trim().Trim('-'), (glosses.Length == 2) ? glosses[1].Trim() : null);
 }