/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create minimal test data required for every test.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			base.CreateTestData();
			m_inMemoryCache.InitializeWritingSystemEncodings();
			m_inMemoryCache.InitializeLexDb();
			m_helper = new DiscourseTestHelper(Cache);
			m_firstPara = m_helper.FirstPara;
			m_stText = m_firstPara.Owner as StText;
			//// We want a real action handler so we can test Undo/Redo.
			//m_originalHandler = m_inMemoryCache.Cache.ActionHandlerAccessor;
			//((NewFdoCache)(m_inMemoryCache.Cache)).ActionHandler = ActionHandlerClass.Create();
			//// Make the key annotationdefns.
			ICmPossibilityList defns = Cache.LangProject.AnnotationDefsOA;
			if (defns == null)
			{
				defns = new CmPossibilityList();
				Cache.LangProject.AnnotationDefsOA = defns;
			}
			MakeAnnDefn(defns, LangProject.kguidAnnWordformInContext);
			MakeAnnDefn(defns, LangProject.kguidConstituentChartRow);
			MakeAnnDefn(defns, LangProject.kguidConstituentChartAnnotation);
		}
Example #2
0
		public void UpgradeWhenExistingListHasRenderings()
		{
			CheckDisposed();

			ILangProject lp = m_fdoCache.LangProject;

			IWfiWordform abc = lp.WordformInventoryOA.AddRealWordform("abc", lp.DefaultVernacularWritingSystem);
			IWfiWordform def = lp.WordformInventoryOA.AddRealWordform("def", lp.DefaultVernacularWritingSystem);
			IWfiWordform ghi = lp.WordformInventoryOA.AddRealWordform("ghi", lp.DefaultVernacularWritingSystem);

			ICmPossibilityList oldKeyTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(oldKeyTermsList);
			ChkTerm term = new ChkTerm();
			oldKeyTermsList.PossibilitiesOS.Append(term);
			term.Name.SetAlternative("Abba", m_wsEn);
			term.Description.SetAlternative("Daddy", m_wsEn);
			AddOccurrenceToOldStyleSense(term, 41014036, abc, "abba", KeyTermRenderingStatus.Assigned);
			AddOccurrenceToOldStyleSense(term, 45008015, abc, "abba", KeyTermRenderingStatus.AutoAssigned);
			AddOccurrenceToOldStyleSense(term, 48004006, null, "abba"); // Not rendered
			AddOccurrenceToOldStyleSense(term, 48004007, abc, "abba"); // This one is not in new list

			term = new ChkTerm();
			oldKeyTermsList.PossibilitiesOS.Append(term);
			term.Name.SetAlternative("Angel", m_wsEn);
			ChkTerm subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("Heavenly being", m_wsEn);
			subsense.Description.SetAlternative("Supernatural being sent as a messenger from God", m_wsEn);
			AddOccurrenceToOldStyleSense(subsense, 040001020, def, "aggelos");
			AddOccurrenceToOldStyleSense(subsense, 040001024, ghi, "aggelos");
			AddOccurrenceToOldStyleSense(subsense, 040002013, null, "aggelos", KeyTermRenderingStatus.Ignored);

			subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("Demon", m_wsEn);
			subsense.Description.SetAlternative("A fallen angel", m_wsEn);
			AddOccurrenceToOldStyleSense(subsense, 040007022, null, "daimonion");

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba; father", null, null, 4101403603, 4500801516, 4800400618));
			terms.KeyTerms.Add(new Term(21, "KT", "\u1F04\u03B3\u03B3\u03B5\u03BB\u03BF\u03C2", "Greek",
				"angel", null, null, 04000102006, 04000102413, 04000201305));
			terms.KeyTerms.Add(new Term(363, "KT", "\u03B4\u03B1\u03B9\u03BC\u1F79\u03BD\u03B9\u03BF\u03BD-1",
				"Greek", "demon", "\u03B4\u03B1\u03B9\u03BC\u1F79\u03BD\u03B9\u03BF\u03BD",
				"\u03B4\u03B1\u03B9\u03BC\u03BF\u03BD\u1F77\u03B6\u03BF\u03BC\u03B1\u03B9, \u03B4\u03B1\u03B9\u03BC\u03BF\u03BD\u03B9\u1F7D\u03B4\u03B7\u03C2, \u03B4\u03B1\u1F77\u03BC\u03C9\u03BD",
				04000702219));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(1);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Terms.Add(new TermLocalization(3, "abba; father", "title for God, literally dad"));
			localizations.Add(loc);

			// Load the terms
			ICmPossibilityList newChkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(newChkTermsList);
			DummyTeKeyTermsInit.CallLoadKeyTerms(oldKeyTermsList, newChkTermsList, terms,
				localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");

			// Make sure the old list has been blown away
			// We can't do this now because we delete the list asynchronously
			// Assert.IsFalse(oldKeyTermsList.IsValidObject());
			oldKeyTermsList = null;

			// Make sure there is one category (possibility) in the new list
			ICmPossibility ktCategory = newChkTermsList.PossibilitiesOS[0];
			Assert.AreEqual("KT", ktCategory.Abbreviation.GetAlternative(m_wsEn));

			// Make sure there are three keyterms in that category
			Assert.AreEqual(3, ktCategory.SubPossibilitiesOS.Count);

			// Check the ChkTerm and ChkRefs for "abba"
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(3, keyterm.TermId);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("title for God, literally dad",
				keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("father", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(1, keyterm.RenderingsOC.Count);
			ChkRendering abbaRendering = new ChkRendering(m_fdoCache, keyterm.RenderingsOC.HvoArray[0]);
			Assert.AreEqual(abc, abbaRendering.SurfaceFormRA);
			Assert.AreEqual(3, keyterm.OccurrencesOS.Count, "There should be 3 references for abba");
			Assert.AreEqual(KeyTermRenderingStatus.Assigned, keyterm.OccurrencesOS[0].Status);
			Assert.AreEqual(abc, keyterm.OccurrencesOS[0].RenderingRA);
			Assert.AreEqual(KeyTermRenderingStatus.AutoAssigned, keyterm.OccurrencesOS[1].Status);
			Assert.AreEqual(abc, keyterm.OccurrencesOS[1].RenderingRA);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[2].Status);
			Assert.AreEqual(0, keyterm.OccurrencesOS[2].RenderingRAHvo);

			// Check the ChkRefs for "angel"
			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[1];
			Assert.AreEqual(21, keyterm.TermId);
			Assert.AreEqual(2, keyterm.RenderingsOC.Count);
			bool fFoundDEF = false;
			bool fFoundGHI = false;
			foreach (IChkRendering rendering in keyterm.RenderingsOC)
			{
				fFoundDEF |= (rendering.SurfaceFormRAHvo == def.Hvo);
				fFoundGHI |= (rendering.SurfaceFormRAHvo == ghi.Hvo);
			}
			Assert.IsTrue(fFoundDEF);
			Assert.IsTrue(fFoundGHI);
			Assert.AreEqual(3, keyterm.OccurrencesOS.Count);
			Assert.AreEqual(KeyTermRenderingStatus.Assigned, keyterm.OccurrencesOS[0].Status);
			Assert.AreEqual(def, keyterm.OccurrencesOS[0].RenderingRA);
			Assert.AreEqual(KeyTermRenderingStatus.Assigned, keyterm.OccurrencesOS[1].Status);
			Assert.AreEqual(ghi, keyterm.OccurrencesOS[1].RenderingRA);
			Assert.AreEqual(KeyTermRenderingStatus.Ignored, keyterm.OccurrencesOS[2].Status);
			Assert.IsNull(keyterm.OccurrencesOS[2].RenderingRA);

			// Check the ChkRefs for "demon"
			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[2];
			Assert.AreEqual(363, keyterm.TermId);
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);
			Assert.AreEqual(1, keyterm.OccurrencesOS.Count);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[0].Status);
			Assert.AreEqual(0, keyterm.OccurrencesOS[0].RenderingRAHvo);
		}
Example #3
0
		public void SimpleUpgradeWhenExistingListHasNoRenderings()
		{
			CheckDisposed();

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList oldKeyTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(oldKeyTermsList);
			ChkTerm term = new ChkTerm();
			oldKeyTermsList.PossibilitiesOS.Append(term);
			term.Name.SetAlternative("Abba", m_wsEn);
			term.Description.SetAlternative("Daddy", m_wsEn);
			AddOccurrenceToOldStyleSense(term, 41014036, null, "abba");

			term = new ChkTerm();
			oldKeyTermsList.PossibilitiesOS.Append(term);
			term.Name.SetAlternative("Angel", m_wsEn);
			ChkTerm subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("Heavenly being", m_wsEn);
			subsense.Description.SetAlternative("Supernatural being sent as a messenger from God", m_wsEn);
			AddOccurrenceToOldStyleSense(subsense, 040001020, null, "aggelos");

			subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("Demon", m_wsEn);
			subsense.Description.SetAlternative("A fallen angel", m_wsEn);
			AddOccurrenceToOldStyleSense(subsense, 040007022, null, "daimonion");

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba; father", null, null, 4101403603, 4500801516, 4800400618));
			terms.KeyTerms.Add(new Term(21, "KT", "\u1F04\u03B3\u03B3\u03B5\u03BB\u03BF\u03C2-1", "Greek",
				"angel", null, null, 040001020));
			terms.KeyTerms.Add(new Term(363, "KT", "\u03B4\u03B1\u03B9\u03BC\u1F79\u03BD\u03B9\u03BF\u03BD",
				"Greek", "demon", "\u1F04\u03B3\u03B3\u03B5\u03BB\u03BF\u03C2",
				"\u03B4\u03B1\u03B9\u03BC\u03BF\u03BD\u1F77\u03B6\u03BF\u03BC\u03B1\u03B9, \u03B4\u03B1\u03B9\u03BC\u03BF\u03BD\u03B9\u1F7D\u03B4\u03B7\u03C2, \u03B4\u03B1\u1F77\u03BC\u03C9\u03BD",
				040007022));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(1);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Terms.Add(new TermLocalization(3, "abba; father", "title for God, literally dad"));
			localizations.Add(loc);

			// Load the terms
			ICmPossibilityList newChkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(newChkTermsList);
			DummyTeKeyTermsInit.CallLoadKeyTerms(oldKeyTermsList, newChkTermsList, terms, localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");

			// Make sure the old list has been blown away
			// We can't do this now because we delete the list asynchronously
			// Assert.IsFalse(oldKeyTermsList.IsValidObject());
			oldKeyTermsList = null;

			// Make sure there is one category (possibility) in the new list
			Assert.AreEqual(1, newChkTermsList.PossibilitiesOS.Count);
			ICmPossibility ktCategory = newChkTermsList.PossibilitiesOS[0];
			Assert.AreEqual("KT", ktCategory.Abbreviation.GetAlternative(m_wsEn));

			// Make sure there are three keyterms in that category
			Assert.AreEqual(3, ktCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the first ChkTerm
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(3, keyterm.TermId);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("title for God, literally dad",
				keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("father", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);
			Assert.AreEqual(3, keyterm.OccurrencesOS.Count, "There should be 3 references for abba");
			Assert.AreEqual(0, keyterm.OccurrencesOS[0].RenderingRAHvo);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[0].Status);
			Assert.AreEqual(0, keyterm.OccurrencesOS[1].RenderingRAHvo);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[1].Status);
			Assert.AreEqual(0, keyterm.OccurrencesOS[2].RenderingRAHvo);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[2].Status);

			// Briefly check the other two ChkTerms
			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[1];
			Assert.AreEqual(21, keyterm.TermId);
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);
			Assert.AreEqual(1, keyterm.OccurrencesOS.Count);
			Assert.AreEqual(0, keyterm.OccurrencesOS[0].RenderingRAHvo);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[0].Status);

			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[2];
			Assert.AreEqual(363, keyterm.TermId);
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);
			Assert.AreEqual(1, keyterm.OccurrencesOS.Count);
			Assert.AreEqual(0, keyterm.OccurrencesOS[0].RenderingRAHvo);
			Assert.AreEqual(KeyTermRenderingStatus.Unassigned, keyterm.OccurrencesOS[0].Status);

			bool fFoundResource = false;
			foreach (CmResource resource in lp.TranslatedScriptureOA.ResourcesOC)
			{
				if (resource.Name == "BiblicalTerms")
				{
					Assert.AreEqual(terms.Version, resource.Version);
					fFoundResource = true;
				}
			}
			Assert.IsTrue(fFoundResource);
		}
Example #4
0
		public void MultipleLocalizations()
		{
			CheckDisposed();

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba; father", null, null, 4101403603));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(2);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(1);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Terms.Add(new TermLocalization(3, "abba; father", "title for God, literally dad"));
			localizations.Add(loc);
			loc = new BiblicalTermsLocalization(1);
			int wsEs = m_wsf.GetWsFromStr("es");
			loc.WritingSystemHvo = wsEs;
			loc.Categories.Add(new CategoryLocalization("KT", "Palabras claves"));
			loc.Terms.Add(new TermLocalization(3, "abba; padre", "t\u00EDtulo de Dios, literalmente pap\u00E1"));
			localizations.Add(loc);

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList chkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(chkTermsList);

			// Load the term
			DummyTeKeyTermsInit.CallLoadKeyTerms(chkTermsList, terms, localizations);

			// Make sure there is one category (possibility)
			Assert.AreEqual(1, chkTermsList.PossibilitiesOS.Count);
			ICmPossibility ktCategory = chkTermsList.PossibilitiesOS[0];
			Assert.AreEqual("KT", ktCategory.Abbreviation.GetAlternative(m_wsEn));
			Assert.AreEqual("Key terms", ktCategory.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("Palabras claves", ktCategory.Name.GetAlternative(wsEs));

			// Make sure there is one keyterm in that category
			Assert.AreEqual(1, ktCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the ChkTerm
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(3, keyterm.TermId);
			// Check the English localization
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("title for God, literally dad",
				keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("father", keyterm.SeeAlso.GetAlternative(m_wsEn));

			// Check the Spanish localization
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(wsEs));
			Assert.AreEqual("t\u00EDtulo de Dios, literalmente pap\u00E1",
				keyterm.Description.GetAlternative(wsEs).Text);
			Assert.AreEqual("padre", keyterm.SeeAlso.GetAlternative(wsEs));
		}
Example #5
0
		public void TwoCategoriesChkTermInit()
		{
			CheckDisposed();

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			// Using asterisks to ensure that localizations are coming from localizations, not from
			// base key terms list.
			terms.KeyTerms.Add(new Term(1, "PN", "\u1F08\u03B1\u03C1\u1F7D\u03BD", "Greek",
				"Aaron***", null, null, 4200100522, 4400704003));
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba***; father***", null, null, 4101403603));
			terms.KeyTerms.Add(new Term(7325, "PN",
				"\u05DB\u05BC\u05B7\u05D1\u05BC\u05D5\u05B9\u05DF", "Hebrew",
				"Cabbon***", null, null, 601504001));

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList chkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(chkTermsList);

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(3);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Categories.Add(new CategoryLocalization("PN", "Proper names"));
			loc.Terms.Add(new TermLocalization(1, "Aaron", "the elder brother of Moses"));
			loc.Terms.Add(new TermLocalization(3, "abba; father", "title for God, literally dad"));
			loc.Terms.Add(new TermLocalization(7325, "Cabbon", "town; territory of Judah"));
			localizations.Add(loc);

			// Load the terms
			DummyTeKeyTermsInit.CallLoadKeyTerms(chkTermsList, terms, localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");
			int wsHebrew = m_wsf.GetWsFromStr("hbo");

			// Make sure there are two categories (possibilities)
			Assert.AreEqual(2, chkTermsList.PossibilitiesOS.Count);
			ICmPossibility ktCategory = null, pnCategory = null;
			foreach (ICmPossibility cat in chkTermsList.PossibilitiesOS)
			{
				string catNameEn = cat.Name.GetAlternative(m_wsEn);
				switch (catNameEn)
				{
					case "Key terms": ktCategory = cat; break;
					case "Proper names": pnCategory = cat; break;
					default: Assert.Fail("Unexpected category in the list: " + catNameEn); break;
				}
			}

			// ********* Key Term Category **********
			Assert.IsNotNull(ktCategory);
			// Make sure there is one keyterm (possibility)
			Assert.AreEqual(1, ktCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the ChkTerm
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(3, keyterm.TermId);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("father", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);

			// There should be 1 reference for this key term
			Assert.AreEqual(1, keyterm.OccurrencesOS.Count);

			IChkRef reference = keyterm.OccurrencesOS[0];
			Assert.AreEqual(41014036, reference.Ref);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", reference.KeyWord.Text);
			Assert.AreEqual(3, reference.Location);

			// ********* Proper Names Category **********
			Assert.IsNotNull(pnCategory);
			Assert.AreEqual("PN", pnCategory.Abbreviation.GetAlternative(m_wsEn));

			// Make sure there are two terms (possibilities)
			Assert.AreEqual(2, pnCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the first Proper Name
			IChkTerm pnAaron = (IChkTerm)pnCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(1, pnAaron.TermId);
			Assert.AreEqual("\u1F08\u03B1\u03C1\u1F7D\u03BD", pnAaron.Name.GetAlternative(wsGreek));
			Assert.AreEqual("Aaron", pnAaron.Name.GetAlternative(m_wsEn));
			Assert.IsNull(pnAaron.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, pnAaron.RenderingsOC.Count);

			// There should be 2 references for this key term
			Assert.AreEqual(2, pnAaron.OccurrencesOS.Count);

			reference = pnAaron.OccurrencesOS[0];
			Assert.AreEqual(42001005, reference.Ref);
			Assert.AreEqual("\u1F08\u03B1\u03C1\u1F7D\u03BD", reference.KeyWord.Text);
			Assert.AreEqual(22, reference.Location);

			reference = pnAaron.OccurrencesOS[1];
			Assert.AreEqual(44007040, reference.Ref);
			Assert.AreEqual("\u1F08\u03B1\u03C1\u1F7D\u03BD", reference.KeyWord.Text);
			Assert.AreEqual(3, reference.Location);

			// Look at the contents of the second Proper Name
			IChkTerm pnCabbon = (IChkTerm)pnCategory.SubPossibilitiesOS[1];
			Assert.AreEqual(7325, pnCabbon.TermId);
			Assert.AreEqual("\u05DB\u05BC\u05B7\u05D1\u05BC\u05D5\u05B9\u05DF",
				pnCabbon.Name.GetAlternative(wsHebrew));
			Assert.AreEqual("Cabbon", pnCabbon.Name.GetAlternative(m_wsEn));
			Assert.IsNull(pnCabbon.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, pnCabbon.RenderingsOC.Count);

			// There should be 1 reference for this key term
			Assert.AreEqual(1, pnCabbon.OccurrencesOS.Count);

			reference = pnCabbon.OccurrencesOS[0];
			Assert.AreEqual(6015040, reference.Ref);
			Assert.AreEqual("\u05DB\u05BC\u05B7\u05D1\u05BC\u05D5\u05B9\u05DF",
				reference.KeyWord.Text);
			Assert.AreEqual(1, reference.Location);
		}
Example #6
0
		public void KeyTermInit_NullDescription()
		{
			CheckDisposed();

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(56, "FA", "\u1F00\u03B5\u03C4\u1F79\u03C2", "Greek",
				"eagle; vulture", null, null,
				4002402809, 4201703717, 6600400728, 6600801306, 6601201409));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(1);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("FA", "Fauna"));
			loc.Terms.Add(new TermLocalization(56, "eagle; vulture", null));
			localizations.Add(loc);

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList chkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(chkTermsList);

			// Load the term
			DummyTeKeyTermsInit.CallLoadKeyTerms(chkTermsList, terms, localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");

			// Make sure there is one category (possibility)
			Assert.AreEqual(1, chkTermsList.PossibilitiesOS.Count);
			ICmPossibility faCategory = chkTermsList.PossibilitiesOS[0];
			Assert.AreEqual("FA", faCategory.Abbreviation.GetAlternative(m_wsEn));

			// Make sure there is one entry in the Fauna category
			Assert.AreEqual(1, faCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the ChkTerm
			IChkTerm keyterm = (IChkTerm)faCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(56, keyterm.TermId);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("eagle", keyterm.Name.GetAlternative(m_wsEn));
			Assert.IsNull(keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("vulture", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);

			// There should be 5 references for this key term
			Assert.AreEqual(5, keyterm.OccurrencesOS.Count);

			IChkRef reference = keyterm.OccurrencesOS[0];
			Assert.AreEqual(40024028, reference.Ref);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", reference.KeyWord.Text);
			Assert.AreEqual(9, reference.Location);

			reference = keyterm.OccurrencesOS[1];
			Assert.AreEqual(42017037, reference.Ref);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", reference.KeyWord.Text);
			Assert.AreEqual(17, reference.Location);

			reference = keyterm.OccurrencesOS[2];
			Assert.AreEqual(66004007, reference.Ref);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", reference.KeyWord.Text);
			Assert.AreEqual(28, reference.Location);

			reference = keyterm.OccurrencesOS[3];
			Assert.AreEqual(66008013, reference.Ref);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", reference.KeyWord.Text);
			Assert.AreEqual(6, reference.Location);

			reference = keyterm.OccurrencesOS[4];
			Assert.AreEqual(66012014, reference.Ref);
			Assert.AreEqual("\u1F00\u03B5\u03C4\u1F79\u03C2", reference.KeyWord.Text);
			Assert.AreEqual(9, reference.Location);

			bool fFoundResource = false;
			foreach (CmResource resource in lp.TranslatedScriptureOA.ResourcesOC)
			{
				if (resource.Name == "BiblicalTerms")
				{
					Assert.AreEqual(terms.Version, resource.Version);
					fFoundResource = true;
				}
			}
			Assert.IsTrue(fFoundResource);
		}
Example #7
0
		public void StripOffSenseNumbers()
		{
			CheckDisposed();

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(13, "KT", "\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2-1", "Greek",
				"good; goodness; good act",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2, \u1F00\u03B3\u03B1\u03B8\u03C9\u03C3\u1F7B\u03BD\u03B7",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F73\u03C9, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u03B9\u03B1, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F79\u03C2, \u1F00\u03B3\u03B1\u03B8\u03C9\u03C3\u1F7B\u03BD\u03B7, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C5\u03C1\u03B3\u03B5\u03C9",
				04000504518, 04001203405, 04001203502));
			terms.KeyTerms.Add(new Term(14, "KT", "\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2-2", "Greek",
				"do good; perform good deeds; good works",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u03B9\u03B1, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F73\u03C9, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C5\u03C1\u03B3\u03B5\u03C9",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F73\u03C9, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u03B9\u03B1, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F79\u03C2, \u1F00\u03B3\u03B1\u03B8\u03C9\u03C3\u1F7B\u03BD\u03B7, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C5\u03C1\u03B3\u03B5\u03C9",
				04200600913, 04200603304));
			terms.KeyTerms.Add(new Term(15, "KT", "\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2-3", "Greek",
				"one who does good; one who benefits others",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F79\u03C2",
				"\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F73\u03C9, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u03B9\u03B1, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F79\u03C2, \u1F00\u03B3\u03B1\u03B8\u03C9\u03C3\u1F7B\u03BD\u03B7, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C5\u03C1\u03B3\u03B5\u03C9",
				06000201412));
			terms.KeyTerms.Add(new Term(98, "PN", "\u1F08\u03BB\u1F73\u03BE\u03B1\u03BD\u03B4\u03C1\u03BF\u03C2-1",
				"Greek", "Alexander", null, null, 04101502112));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(3);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Terms.Add(new TermLocalization(13, "good; goodness; good act", "positive moral qualities of the most general nature"));
			loc.Terms.Add(new TermLocalization(14, "do good; perform good deeds; good works", "to engage in doing what is good"));
			loc.Terms.Add(new TermLocalization(15, "one who does good; one who benefits others", "one who customarily does good"));
			localizations.Add(loc);

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList chkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(chkTermsList);

			// Load the term
			DummyTeKeyTermsInit.CallLoadKeyTerms(chkTermsList, terms, localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");

			// Make sure there are two categories (possibilities)
			Assert.AreEqual(2, chkTermsList.PossibilitiesOS.Count);
			ICmPossibility ktCategory = null, pnCategory = null;
			foreach (ICmPossibility cat in chkTermsList.PossibilitiesOS)
			{
				string catNameEn = cat.Abbreviation.GetAlternative(m_wsEn);
				switch (catNameEn)
				{
					case "KT": ktCategory = cat; break;
					case "PN": pnCategory = cat; break;
					default: Assert.Fail("Unexpected category in the list: " + catNameEn); break;
				}
			}

			// Make sure there are three key terms in the KT category
			Assert.AreEqual(3, ktCategory.SubPossibilitiesOS.Count);

			// Look at the contents of each ChkTerm
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(13, keyterm.TermId);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("good", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("positive moral qualities of the most general nature",
				keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("goodness; good act", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);
			Assert.AreEqual(3, keyterm.OccurrencesOS.Count);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2, \u1F00\u03B3\u03B1\u03B8\u03C9\u03C3\u1F7B\u03BD\u03B7",
				keyterm.OccurrencesOS[0].KeyWord.Text);

			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[1];
			Assert.AreEqual(14, keyterm.TermId);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("do good", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual(2, keyterm.OccurrencesOS.Count);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u03B9\u03B1, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F73\u03C9, \u1F00\u03B3\u03B1\u03B8\u03BF\u03C5\u03C1\u03B3\u03B5\u03C9",
				keyterm.OccurrencesOS[0].KeyWord.Text);

			keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[2];
			Assert.AreEqual(15, keyterm.TermId);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C2", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("one who does good", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual(1, keyterm.OccurrencesOS.Count);
			Assert.AreEqual("\u1F00\u03B3\u03B1\u03B8\u03BF\u03C0\u03BF\u03B9\u1F79\u03C2",
				keyterm.OccurrencesOS[0].KeyWord.Text);

			// Make sure there is one term in the PN category
			Assert.AreEqual(1, pnCategory.SubPossibilitiesOS.Count);

			// Check the contents and occurrences of the ChkTerm
			IChkTerm pnTerm = (IChkTerm)pnCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(98, pnTerm.TermId);
			Assert.AreEqual("\u1F08\u03BB\u1F73\u03BE\u03B1\u03BD\u03B4\u03C1\u03BF\u03C2", pnTerm.Name.GetAlternative(wsGreek));
			Assert.AreEqual(1, pnTerm.OccurrencesOS.Count);
			Assert.AreEqual("\u1F08\u03BB\u1F73\u03BE\u03B1\u03BD\u03B4\u03C1\u03BF\u03C2",
				pnTerm.OccurrencesOS[0].KeyWord.Text);
		}
Example #8
0
		public void SimpleKeyTermInit()
		{
			CheckDisposed();

			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba; father", null, null,
				4101403603, 4500801516, 4800400618));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);
			BiblicalTermsLocalization loc = new BiblicalTermsLocalization(1);
			loc.WritingSystemHvo = m_wsEn;
			loc.Categories.Add(new CategoryLocalization("KT", "Key terms"));
			loc.Terms.Add(new TermLocalization(3, "abba; father", "title for God, literally dad"));
			localizations.Add(loc);

			ILangProject lp = m_fdoCache.LangProject;
			ICmPossibilityList chkTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(chkTermsList);

			// Load the term
			DummyTeKeyTermsInit.CallLoadKeyTerms(chkTermsList, terms, localizations);

			int wsGreek = m_wsf.GetWsFromStr("grc");

			// Make sure there is one category (possibility)
			Assert.AreEqual(1, chkTermsList.PossibilitiesOS.Count);
			ICmPossibility ktCategory = chkTermsList.PossibilitiesOS[0];
			Assert.AreEqual("KT", ktCategory.Abbreviation.GetAlternative(m_wsEn));

			// Make sure there is one keyterm in that category
			Assert.AreEqual(1, ktCategory.SubPossibilitiesOS.Count);

			// Look at the contents of the ChkTerm
			IChkTerm keyterm = (IChkTerm)ktCategory.SubPossibilitiesOS[0];
			Assert.AreEqual(3, keyterm.TermId);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", keyterm.Name.GetAlternative(wsGreek));
			Assert.AreEqual("abba", keyterm.Name.GetAlternative(m_wsEn));
			Assert.AreEqual("title for God, literally dad",
				keyterm.Description.GetAlternative(m_wsEn).Text);
			Assert.AreEqual("father", keyterm.SeeAlso.GetAlternative(m_wsEn));
			Assert.AreEqual(0, keyterm.RenderingsOC.Count);

			// There should be 3 references for this key term
			Assert.AreEqual(3, keyterm.OccurrencesOS.Count);

			IChkRef reference = keyterm.OccurrencesOS[0];
			Assert.AreEqual(41014036, reference.Ref);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", reference.KeyWord.Text);
			Assert.AreEqual(3, reference.Location);

			reference = keyterm.OccurrencesOS[1];
			Assert.AreEqual(45008015, reference.Ref);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", reference.KeyWord.Text);
			Assert.AreEqual(16, reference.Location);

			reference = keyterm.OccurrencesOS[2];
			Assert.AreEqual(48004006, reference.Ref);
			Assert.AreEqual("\u03b1\u03b2\u03b2\u03b1", reference.KeyWord.Text);
			Assert.AreEqual(18, reference.Location);

			bool fFoundResource = false;
			foreach (CmResource resource in lp.TranslatedScriptureOA.ResourcesOC)
			{
				if (resource.Name == "BiblicalTerms")
				{
					Assert.AreEqual(terms.Version, resource.Version);
					fFoundResource = true;
				}
			}
			Assert.IsTrue(fFoundResource);
		}
Example #9
0
		/// <summary>
		/// Create a CmPossibility based on an XML specification of a constituent chart template.
		/// See CreateDefaultTemplate for an example.
		/// </summary>
		/// <param name="spec"></param>
		/// <returns></returns>
		public CmPossibility CreateChartTemplate(XmlNode spec)
		{
			// Make sure we have the containing objects; if not create them.
			IDsDiscourseData dData = m_cache.LangProject.DiscourseDataOA;
			if (dData == null)
			{
				dData = new DsDiscourseData();
				m_cache.LangProject.DiscourseDataOA = dData;
			}
			// Also make sure it has a templates list
			ICmPossibilityList templates = dData.ConstChartTemplOA;
			if (templates == null)
			{
				templates = new CmPossibilityList();
				dData.ConstChartTemplOA = templates;
			}
			CmPossibility template = new CmPossibility();
			m_cache.LangProject.DiscourseDataOA.ConstChartTemplOA.PossibilitiesOS.Append(template);
			SetNameAndChildColumns(template, spec);
			return template;
		}
Example #10
0
		/// <summary>
		/// Create other required elements.
		/// </summary>
		public override void InitNewInternal()
		{
			base.InitNewInternal();
			PartsOfSpeechOA = new CmPossibilityList();
			PartsOfSpeechOA.ItemClsid = PartOfSpeech.kClassId;
		}
Example #11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Shows the Chooser dialog to allow the user to select a single possibility.
		/// </summary>
		/// <remarks>Used for filtering</remarks>
		/// <param name="list">The possibility list used to populate the tree</param>
		/// <param name="hvoPoss">The HVO of the possibility to check initially, or 0 to
		/// show with no initial selection</param>
		/// <returns>HVO of a single chosen CmPossibility, or 0 if user cancels or chooses
		/// nothing.</returns>
		/// ------------------------------------------------------------------------------------
		public int GetPossibility(CmPossibilityList list, int hvoPoss)
		{
			//CheckDisposed();

			//m_initiallySelectedHvos = new List<int>(1);
			//m_initiallySelectedHvos.Add(hvoPoss);

			//if (list != (CmPossibilityList)m_list)
			//{
			//    m_list = list;
			//    SetTitle();
			//}

			//tvPossibilities.Load(m_list, m_initiallySelectedHvos);
			//if (ShowDialog() != DialogResult.OK)
			//    return 0;

			//List<int> newHvos = tvPossibilities.SelectedHvos;
			//return (newHvos != null && newHvos.Count > 0 ? newHvos[0] : 0);

			// REVIEW: Currently, the chooser tree doesn't allow the user to select
			// only one possibility. If this method and single node selection is ever
			// necessary, then this method will need to be rewritten.
			return 0;
		}
Example #12
0
		public void FindCorrespondingChkRef()
		{
			CheckDisposed();

			// First, create a possibility list with the old key terms and set some ChkRefs to
			// have renderings.
			ILangProject lp = m_fdoCache.LangProject;
			IWfiWordform abc = lp.WordformInventoryOA.AddRealWordform("abc", lp.DefaultVernacularWritingSystem);
			IWfiWordform def = lp.WordformInventoryOA.AddRealWordform("def", lp.DefaultVernacularWritingSystem);
			IWfiWordform ghi = lp.WordformInventoryOA.AddRealWordform("ghi", lp.DefaultVernacularWritingSystem);
			IWfiWordform jkl = lp.WordformInventoryOA.AddRealWordform("jkl", lp.DefaultVernacularWritingSystem);
			IWfiWordform mno = lp.WordformInventoryOA.AddRealWordform("mno", lp.DefaultVernacularWritingSystem);

			ICmPossibilityList oldKeyTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(oldKeyTermsList);
			ChkTerm term = new ChkTerm();
			oldKeyTermsList.PossibilitiesOS.Append(term);
			term.Name.SetAlternative("Adultery", m_wsEn);
			ChkTerm subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("The act of sexual unfaithfulness", m_wsEn);
			ChkRef chkrefMoicheuw040005027 = AddOccurrenceToOldStyleSense(subsense, 040005027, abc, "moicheuw");
			ChkRef chkrefMoicheuw040005028 = AddOccurrenceToOldStyleSense(subsense, 040005028, abc, "moicheuw");
			ChkRef chkrefMoichaomai040005032 = AddOccurrenceToOldStyleSense(subsense, 040005032, def, "moichaomai");
			ChkRef chkrefMoicheia040015019 = AddOccurrenceToOldStyleSense(subsense, 040015019, ghi, "moicheia");
			ChkRef chkrefMoichaomai040019009 = AddOccurrenceToOldStyleSense(subsense, 040019009, def, "moichaomai");

			subsense = new ChkTerm();
			term.SubPossibilitiesOS.Append(subsense);
			subsense.Name.SetAlternative("One who sexually violates marriage vows", m_wsEn);

			ChkTerm subsubsense = new ChkTerm();
			subsense.SubPossibilitiesOS.Append(subsubsense);
			subsubsense.Name.SetAlternative("Masculine offenders", m_wsEn);
			ChkRef chkrefMoichos042018011 = AddOccurrenceToOldStyleSense(subsubsense, 042018011, jkl, "moichos");
			ChkRef chkrefMoichos046006009 = AddOccurrenceToOldStyleSense(subsubsense, 046006009, jkl, "moichos");
			ChkRef chkrefMoichos058013004 = AddOccurrenceToOldStyleSense(subsubsense, 058013004, jkl, "moichos");

			subsubsense = new ChkTerm();
			subsense.SubPossibilitiesOS.Append(subsubsense);
			subsubsense.Name.SetAlternative("Feminine offenders", m_wsEn);
			ChkRef chkrefMoichalis045007003 = AddOccurrenceToOldStyleSense(subsubsense, 045007003, mno, "moichalis");
			ChkRef chkrefMoichalis061002014 = AddOccurrenceToOldStyleSense(subsubsense, 061002014, mno, "moichalis");

			// Next, load the new list of Biblicalk terms
			BiblicalTermsList terms = new BiblicalTermsList();
			terms.Version = Guid.NewGuid();
			terms.KeyTerms = new List<Term>();
			terms.KeyTerms.Add(new Term(3, "KT", "\u03b1\u03b2\u03b2\u03b1", "Greek",
				"abba; father", null, null, 4101403603, 4500801516, 4800400618));
			string sGrkMoichaomai = "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9";
			terms.KeyTerms.Add(new Term(1139, "KT", "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9-1",
				"Greek", "commit adultery", sGrkMoichaomai,
				"\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1, \u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9, \u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2, \u03BC\u03BF\u03B9\u03C7\u1F79\u03C2",
				04000503223, 04001900917, 04101001123, 04101001210));
			string sGrkMoicheia = "\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1";
			terms.KeyTerms.Add(new Term(1140, "KT", "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9-2",
				"Greek", "adultery", sGrkMoicheia,
				"\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1, \u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9, \u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2, \u03BC\u03BF\u03B9\u03C7\u1F79\u03C2",
				04001501909, 04300800310));
			string sGrkMoicheuw = "\u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9";
			terms.KeyTerms.Add(new Term(1141, "KT", "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9-3",
				"Greek", "commit adultery", sGrkMoicheuw,
				"\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1, \u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9, \u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2, \u03BC\u03BF\u03B9\u03C7\u1F79\u03C2",
				04000502705, 04000502708, 04000502815, 04001901812, 04101001907, 04201601810, 04201601817,
				04201802005, 04300800410, 04500202204, 04500202205, 04501300904, 05900201105, 05900201113,
				06600202208));
			string sGrkMoichalis = "\u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2";
			terms.KeyTerms.Add(new Term(1142, "KT", "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9-4",
				"Greek", "adulterous; adulteress", sGrkMoichalis,
				"\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1, \u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9, \u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2, \u03BC\u03BF\u03B9\u03C7\u1F79\u03C2",
				04001203909, 04001600404, 04100803815, 04500700306, 04500700326, 05900400401, 06100201404));
			string sGrkMoichos = "\u03BC\u03BF\u03B9\u03C7\u1F79\u03C2";
			terms.KeyTerms.Add(new Term(1143, "KT", "\u03BC\u03BF\u03B9\u03C7\u1F71\u03BF\u03BC\u03B1\u03B9-5",
				"Greek", "adulterer", sGrkMoichos,
				"\u03BC\u03BF\u03B9\u03C7\u03B5\u1F77\u03B1, \u03BC\u03BF\u03B9\u03C7\u03B5\u1F7B\u03C9, \u03BC\u03BF\u03B9\u03C7\u03B1\u03BB\u1F77\u03C2, \u03BC\u03BF\u03B9\u03C7\u1F79\u03C2",
				04201801122, 04600600917));

			List<BiblicalTermsLocalization> localizations = new List<BiblicalTermsLocalization>(1);

			ICmPossibilityList newBiblicalTermsList = new CmPossibilityList();
			lp.CheckListsOC.Add(newBiblicalTermsList);
			DummyTeKeyTermsInit.CallLoadKeyTerms(newBiblicalTermsList, terms, localizations);

			ICmPossibility newKtList = null;
			foreach (ICmPossibility category in newBiblicalTermsList.PossibilitiesOS)
			{
				if (category.Abbreviation.GetAlternative(m_wsEn) == "KT")
					newKtList = category;
			}
			Assert.IsNotNull(newKtList);

			// Now check to make sure FindCorrespondingChkRefs works
			List<IChkRef> chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichalis045007003);
			Assert.AreEqual(2, chkRefs.Count);
			Assert.AreEqual(sGrkMoichalis, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(045007003, chkRefs[0].Ref);
			Assert.AreEqual(6, chkRefs[0].Location);
			Assert.AreEqual(sGrkMoichalis, chkRefs[1].KeyWord.Text);
			Assert.AreEqual(045007003, chkRefs[1].Ref);
			Assert.AreEqual(26, chkRefs[1].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichalis061002014);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoichalis, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(061002014, chkRefs[0].Ref);
			Assert.AreEqual(4, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichaomai040005032);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoichaomai, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(040005032, chkRefs[0].Ref);
			Assert.AreEqual(23, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichaomai040019009);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoichaomai, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(040019009, chkRefs[0].Ref);
			Assert.AreEqual(17, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoicheia040015019);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoicheia, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(040015019, chkRefs[0].Ref);
			Assert.AreEqual(9, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoicheuw040005027);
			Assert.AreEqual(2, chkRefs.Count);
			Assert.AreEqual(sGrkMoicheuw, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(040005027, chkRefs[0].Ref);
			Assert.AreEqual(5, chkRefs[0].Location);
			Assert.AreEqual(sGrkMoicheuw, chkRefs[1].KeyWord.Text);
			Assert.AreEqual(040005027, chkRefs[1].Ref);
			Assert.AreEqual(8, chkRefs[1].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoicheuw040005028);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoicheuw, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(040005028, chkRefs[0].Ref);
			Assert.AreEqual(15, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichos042018011);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoichos, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(042018011, chkRefs[0].Ref);
			Assert.AreEqual(22, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichos046006009);
			Assert.AreEqual(1, chkRefs.Count);
			Assert.AreEqual(sGrkMoichos, chkRefs[0].KeyWord.Text);
			Assert.AreEqual(046006009, chkRefs[0].Ref);
			Assert.AreEqual(17, chkRefs[0].Location);

			chkRefs = ChkRefMatcher.FindCorrespondingChkRefs(newKtList,
				chkrefMoichos058013004);
			Assert.AreEqual(0, chkRefs.Count, "We removed this reference from the new list to test the case where no match is found");
		}
Example #13
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="lexDb"></param>
		/// ------------------------------------------------------------------------------------
		private void AddMorphTypes(LexDb lexDb)
		{
			int hvoMorphTypesList = m_cacheBase.NewHvo(CmPossibilityList.kClassId);
			lexDb.MorphTypesOAHvo = hvoMorphTypesList;
			CmPossibilityList morphTypesList = new CmPossibilityList(Cache, hvoMorphTypesList);

			for (int i = 1; i <= MoMorphTypeCollection.kmtLimit; i++)
			{
				int hvoMorphType = m_cacheBase.NewHvo(MoMorphType.kClassId);
				MoMorphType morphType = new MoMorphType(Cache, hvoMorphType);
				switch (i)
				{
					case 1:
						InitMorphType(new Guid(MoMorphType.kguidMorphBoundRoot), "*", null, 2, morphType);
						break;
					case 2:
						InitMorphType(new Guid(MoMorphType.kguidMorphBoundStem), "*", null, 2, morphType);
						break;
					case 3:
						InitMorphType(new Guid(MoMorphType.kguidMorphCircumfix), null, null, 1, morphType);
						break;
					case 4:
						InitMorphType(new Guid(MoMorphType.kguidMorphEnclitic), "=", null, 7, morphType);
						break;
					case 5:
						InitMorphType(new Guid(MoMorphType.kguidMorphInfix), "-", "-", 5, morphType);
						break;
					case 6:
						InitMorphType(new Guid(MoMorphType.kguidMorphParticle), null, null, 1, morphType);
						break;
					case 7:
						InitMorphType(new Guid(MoMorphType.kguidMorphPrefix), null, "-", 3, morphType);
						break;
					case 8:
						InitMorphType(new Guid(MoMorphType.kguidMorphProclitic), null, "=", 4, morphType);
						break;
					case 9:
						InitMorphType(new Guid(MoMorphType.kguidMorphRoot), null, null, 1, morphType);
						break;
					case 10:
						InitMorphType(new Guid(MoMorphType.kguidMorphSimulfix), "=", "=", 5, morphType);
						break;
					case 11:
						InitMorphType(new Guid(MoMorphType.kguidMorphStem), null, null, 1, morphType);
						break;
					case 12:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuffix), "-", null, 6, morphType);
						break;
					case 13:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuprafix), "~", "~", 5, morphType);
						break;
					case 14:
						InitMorphType(new Guid(MoMorphType.kguidMorphInfixingInterfix), "-", "-", 0, morphType);
						break;
					case 15:
						InitMorphType(new Guid(MoMorphType.kguidMorphPrefixingInterfix), null, "-", 0, morphType);
						break;
					case 16:
						InitMorphType(new Guid(MoMorphType.kguidMorphSuffixingInterfix), "-", null, 0, morphType);
						break;
					case 17:
						InitMorphType(new Guid(MoMorphType.kguidMorphPhrase), null, null, 0, morphType);
						break;
					case 18:
						InitMorphType(new Guid(MoMorphType.kguidMorphDiscontiguousPhrase), null, null, 0, morphType);
						break;
					case 19:
						InitMorphType(new Guid(MoMorphType.kguidMorphClitic), null, null, 0, morphType);
						break;
				}
				m_cacheBase.SetBasicProps(hvoMorphType, hvoMorphTypesList, (int)MoMorphType.kClassId,
					(int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities, i);
				m_cacheBase.AppendToFdoVector(hvoMorphTypesList,
					(int)CmPossibilityList.CmPossibilityListTags.kflidPossibilities, hvoMorphType);
			}
		}
		/// <summary>
		/// Convenient for ensuring any annotation defns we need have been created.
		/// </summary>
		protected int EnsureAnnDefn(string guid)
		{
			int result = Cache.GetIdFromGuid(guid);
			if (result == 0)
			{
				if (Cache.LangProject.AnnotationDefsOA == null)
				{
					CmPossibilityList annDefs = new CmPossibilityList();
					Cache.LangProject.AnnotationDefsOA = annDefs;
				}
				CmAnnotationDefn annotationDefn = new CmAnnotationDefn();
				Cache.LangProject.AnnotationDefsOA.PossibilitiesOS.Append(annotationDefn);
				m_inMemoryCache.CacheAccessor.CacheGuidProp(annotationDefn.Hvo, (int)CmObjectFields.kflidCmObject_Guid,
					new Guid(guid));
				return annotationDefn.Hvo;
			}
			return result;
		}