Example #1
0
		/// <summary>
		/// nb: this is used both for the headword of an article, but also for the target of a relation.
		/// </summary>
		private void WriteHeadWordField(LexEntry entry, string outputFieldName)
		{
			if (Template == null)
			{
				throw new InvalidOperationException("Expected a non-null Template");
			}
			MultiText headword = new MultiText();
			Field fieldControllingHeadwordOutput =
					Template.GetField(LexEntry.WellKnownProperties.Citation);
			if (fieldControllingHeadwordOutput == null || !fieldControllingHeadwordOutput.Enabled)
			{
				fieldControllingHeadwordOutput =
						Template.GetField(LexEntry.WellKnownProperties.LexicalUnit);
				if (fieldControllingHeadwordOutput == null)
				{
					throw new ArgumentException("Expected to find LexicalUnit in the view Template");
				}
			}
			//                headword.SetAlternative(HeadWordWritingSystemId, entry.GetHeadWordForm(HeadWordWritingSystemId));

			foreach (string writingSystemId in fieldControllingHeadwordOutput.WritingSystemIds)
			{
				headword.SetAlternative(writingSystemId, entry.GetHeadWordForm(writingSystemId));
			}
			WriteMultiTextAsArtificialField(outputFieldName, headword);
		}
Example #2
0
		private void CheckRelationOutput(LexEntry targetEntry, string relationName)
		{
			AssertXPathNotNullWithArgs(_outputPath,
									   "lift/entry/relation/field[@type='headword-of-target']/form[@lang='{1}']/text[text() = '{2}']",
									   relationName,
									   _headwordWritingSystem.Id,
									   targetEntry.GetHeadWordForm(_headwordWritingSystem.Id));
		}