/// ------------------------------------------------------------------------------------ internal PaVariant(ILexEntryRef lxEntryRef) { var lx = lxEntryRef.OwnerOfClass <ILexEntry>(); xVariantForm = PaMultiString.Create(lx.LexemeFormOA.Form, lxEntryRef.Cache.ServiceLocator); xVariantInfo = new PaVariantOfInfo(lxEntryRef); }
/// ------------------------------------------------------------------------------------ private PaCmPossibility(ICmPossibility poss) { var svcloc = poss.Cache.ServiceLocator; xAbbreviation = PaMultiString.Create(poss.Abbreviation, svcloc); xName = PaMultiString.Create(poss.Name, svcloc); }
/// ------------------------------------------------------------------------------------ internal PaMediaFile(ICmMedia mediaFile) { OriginalPath = mediaFile.MediaFileRA.OriginalPath; AbsoluteInternalPath = mediaFile.MediaFileRA.AbsoluteInternalPath; InternalPath = mediaFile.MediaFileRA.InternalPath; xLabel = PaMultiString.Create(mediaFile.Label, mediaFile.Cache.ServiceLocator); }
/// ------------------------------------------------------------------------------------ internal static PaComplexFormInfo Create(ILexEntryRef lxEntryRef) { if (lxEntryRef.RefType != LexEntryRefTags.krtComplexForm) { return(null); } var pcfi = new PaComplexFormInfo(); pcfi.xComplexFormComment = PaMultiString.Create(lxEntryRef.Summary, lxEntryRef.Cache.ServiceLocator); pcfi.xComplexFormType = lxEntryRef.ComplexEntryTypesRS.Select(x => PaCmPossibility.Create(x)).ToList(); foreach (var component in lxEntryRef.ComponentLexemesRS) { if (component is ILexEntry) { pcfi.xComponents.Add(((ILexEntry)component).HeadWord.Text); } else if (component is ILexSense) { var lxSense = (ILexSense)component; var text = lxSense.Entry.HeadWord.Text; if (lxSense.Entry.SensesOS.Count > 1) { text += string.Format(" {0}", lxSense.IndexInOwner + 1); } pcfi.xComponents.Add(text); } } return(pcfi); }
/// ------------------------------------------------------------------------------------ internal PaLexSense(ILexSense lxSense) { var svcloc = lxSense.Cache.ServiceLocator; xAnthropologyNote = PaMultiString.Create(lxSense.AnthroNote, svcloc); xBibliography = PaMultiString.Create(lxSense.Bibliography, svcloc); xDefinition = PaMultiString.Create(lxSense.Definition, svcloc); xDiscourseNote = PaMultiString.Create(lxSense.DiscourseNote, svcloc); xEncyclopedicInfo = PaMultiString.Create(lxSense.EncyclopedicInfo, svcloc); xGeneralNote = PaMultiString.Create(lxSense.GeneralNote, svcloc); xGloss = PaMultiString.Create(lxSense.Gloss, svcloc); xGrammarNote = PaMultiString.Create(lxSense.GrammarNote, svcloc); xPhonologyNote = PaMultiString.Create(lxSense.PhonologyNote, svcloc); xRestrictions = PaMultiString.Create(lxSense.Restrictions, svcloc); xSemanticsNote = PaMultiString.Create(lxSense.SemanticsNote, svcloc); xSociolinguisticsNote = PaMultiString.Create(lxSense.SocioLinguisticsNote, svcloc); xReversalEntries = lxSense.ReversalEntriesRC.Select(x => PaMultiString.Create(x.ReversalForm, svcloc)).ToList(); xGuid = lxSense.Guid; ImportResidue = lxSense.ImportResidue.Text; Source = lxSense.Source.Text; ScientificName = lxSense.ScientificName.Text; xAnthroCodes = lxSense.AnthroCodesRC.Select(x => PaCmPossibility.Create(x)).ToList(); xDomainTypes = lxSense.DomainTypesRC.Select(x => PaCmPossibility.Create(x)).ToList(); xUsages = lxSense.UsageTypesRC.Select(x => PaCmPossibility.Create(x)).ToList(); xSemanticDomains = lxSense.SemanticDomainsRC.Select(x => PaCmPossibility.Create(x)).ToList(); xStatus = PaCmPossibility.Create(lxSense.StatusRA); xSenseType = PaCmPossibility.Create(lxSense.SenseTypeRA); ICmPossibility poss = null; var msa = lxSense.MorphoSyntaxAnalysisRA; if (msa is IMoDerivAffMsa) { poss = ((IMoDerivAffMsa)msa).FromPartOfSpeechRA; } else if (msa is IMoDerivStepMsa) { poss = ((IMoDerivStepMsa)msa).PartOfSpeechRA; } else if (msa is IMoInflAffMsa) { poss = ((IMoInflAffMsa)msa).PartOfSpeechRA; } else if (msa is IMoStemMsa) { poss = ((IMoStemMsa)msa).PartOfSpeechRA; } else if (msa is IMoUnclassifiedAffixMsa) { poss = ((IMoUnclassifiedAffixMsa)msa).PartOfSpeechRA; } if (poss != null) { xPartOfSpeech = PaCmPossibility.Create(poss); } }
/// ------------------------------------------------------------------------------------ internal PaLexPronunciation(ILexPronunciation lxPro) { xForm = PaMultiString.Create(lxPro.Form, lxPro.Cache.ServiceLocator); xLocation = PaCmPossibility.Create(lxPro.LocationRA); CVPattern = lxPro.CVPattern.Text; Tone = lxPro.Tone.Text; xGuid = lxPro.Guid; xMediaFiles = (from x in lxPro.MediaFilesOS where x != null && x.MediaFileRA != null select new PaMediaFile(x)).ToList(); }
/// <summary> /// Append to the PaMultiString the contents of the tsMultiString. /// For each writing system the contents will end up in a comma seperated list /// </summary> public static void Append(PaMultiString paMultiString, ITsMultiString tsMultiString, IFdoServiceLocator svcloc) { for (int i = 0; i < tsMultiString.StringCount; ++i) { int hvoWs; var tss = tsMultiString.GetStringFromIndex(i, out hvoWs); // hvoWs should *always* be found in AllWritingSystems. var ws = svcloc.WritingSystems.AllWritingSystems.SingleOrDefault(w => w.Handle == hvoWs); paMultiString.AddString(ws == null ? null : ws.Id, tss.Text); } }
/// ------------------------------------------------------------------------------------ internal PaLexEntry(ILexEntry lxEntry) { var svcloc = lxEntry.Cache.ServiceLocator; DateCreated = lxEntry.DateCreated; DateModified = lxEntry.DateModified; //ExcludeAsHeadword = lxEntry.ExcludeAsHeadword; remove ExcludeAsHeadword = false; // MDL: remove when IPaLexEntry is updated // ShowMainEntryIn = lxEntry.ShowMainEntryIn.Select(x => new PaLexShowMainEntryIn(x)).ToList(); // MDL: uncomment when IPaLexEntry is updated ImportResidue = lxEntry.ImportResidue.Text; xPronunciations = lxEntry.PronunciationsOS.Select(x => new PaLexPronunciation(x)).ToList(); xSenses = lxEntry.SensesOS.Select(x => new PaLexSense(x)).ToList(); xComplexForms = lxEntry.ComplexFormEntries.Where(x => x.LexemeFormOA != null).Select(x => PaMultiString.Create(x.LexemeFormOA.Form, svcloc)).ToList(); xAllomorphs = lxEntry.AllAllomorphs.Select(x => PaMultiString.Create(x.Form, svcloc)).ToList(); xLexemeForm = lxEntry.LexemeFormOA != null?PaMultiString.Create(lxEntry.LexemeFormOA.Form, svcloc) : null; xMorphType = PaCmPossibility.Create(lxEntry.PrimaryMorphType); xCitationForm = PaMultiString.Create(lxEntry.CitationForm, svcloc); xNote = PaMultiString.Create(lxEntry.Comment, svcloc); xLiteralMeaning = PaMultiString.Create(lxEntry.LiteralMeaning, svcloc); xBibliography = PaMultiString.Create(lxEntry.Bibliography, svcloc); xRestrictions = PaMultiString.Create(lxEntry.Restrictions, svcloc); xSummaryDefinition = PaMultiString.Create(lxEntry.SummaryDefinition, svcloc); xVariantOfInfo = lxEntry.VariantEntryRefs.Select(x => new PaVariantOfInfo(x)).ToList(); xVariants = lxEntry.VariantFormEntryBackRefs.Select(x => new PaVariant(x)).ToList(); xGuid = lxEntry.Guid; // append all etymology forms together separated by commas if (lxEntry.EtymologyOS.Count > 0) { xEtymology = new PaMultiString(); foreach (var etymology in lxEntry.EtymologyOS) { PaMultiString.Append(xEtymology, etymology.Form, svcloc); } } xComplexFormInfo = (from eref in lxEntry.EntryRefsOS let pcfi = PaComplexFormInfo.Create(eref) where pcfi != null select pcfi).ToList(); }
/// ------------------------------------------------------------------------------------ internal PaVariantOfInfo(ILexEntryRef lxEntryRef) { xVariantComment = PaMultiString.Create(lxEntryRef.Summary, lxEntryRef.Cache.ServiceLocator); xVariantType = lxEntryRef.VariantEntryTypesRS.Select(x => PaCmPossibility.Create(x)).ToList(); }