/// <summary> /// Gets the CDRID (definition term) for the language toggle using the current defintion term in the URL. /// If a friendly name is given, it determines the CDRID from it. /// </summary> private string GetCDRIDForLanguageToggle(string translationLang) { string cdridForLangToggle = CdrID; if (!string.IsNullOrEmpty(this.GetDefinitionParam())) { // Get friendly name to CDRID mappings string dictionaryMappingFilepath = null; dictionaryMappingFilepath = this.DictionaryConfiguration.Files.Single(a => a.Locale == translationLang).Filepath; if (!string.IsNullOrEmpty(dictionaryMappingFilepath)) { TerminologyMapping map = TerminologyMapping.GetMappingForFile(dictionaryMappingFilepath); // If pretty name is in label mappings, set CDRID if (map.MappingContainsCDRID(cdridForLangToggle)) { cdridForLangToggle = map.GetFriendlyNameFromCDRID(cdridForLangToggle); } } } return(cdridForLangToggle); }
/// <summary> /// Gets the CDRID (definition term) from the URL. /// If a friendly name is given, it determines the CDRID from it. /// </summary> private void GetDefinitionTerm() { if (!string.IsNullOrEmpty(this.GetDefinitionParam())) { string param = this.GetDefinitionParam(); // Get friendly name to CDRID mappings string dictionaryMappingFilepath = null; dictionaryMappingFilepath = this.DictionaryConfiguration.Files.Single(a => a.Locale == CultureInfo.CurrentUICulture.TwoLetterISOLanguageName).Filepath; if (!string.IsNullOrEmpty(dictionaryMappingFilepath)) { TerminologyMapping map = TerminologyMapping.GetMappingForFile(dictionaryMappingFilepath); // If pretty name is in label mappings, set CDRID if (map.MappingContainsFriendlyName(param)) { CdrID = map.GetCDRIDFromFriendlyName(param); } else { CdrID = param; } } else { CdrID = param; } } }
public void DefaultMatchIsUnknown() { var mapping = new TerminologyMapping(); Assert.IsTrue(mapping.IsValidMatchCode()); Assert.IsTrue(mapping.IsUnknown()); Assert.IsFalse(mapping.IsBroader()); Assert.IsFalse(mapping.IsEquivalent()); Assert.IsFalse(mapping.IsNarrower()); }
private static TerminologyMapping Map(this TERM_MAPPING model) { var termMapping = new TerminologyMapping { Purpose = model.purpose.Map(), Target = model.target.Map() }; Match match; Enum.TryParse(model.match, true, out match); termMapping.Match = match; return(termMapping); }
/// <summary> /// Gets the friendly name of the given CDRID, if it exists. /// Otherwise, returns the CDRID. /// </summary> public string GetFriendlyName(DictionaryInfo info, string cdrId) { // Get CDRID to friendly name mappings string dictionaryMappingFilepath = null; dictionaryMappingFilepath = info.FriendlyNameMapping; if (!string.IsNullOrEmpty(dictionaryMappingFilepath)) { TerminologyMapping map = TerminologyMapping.GetMappingForFile(dictionaryMappingFilepath); // If pretty name is in label mappings, set CDRID if (map.MappingContainsCDRID(cdrId)) { return(map.GetFriendlyNameFromCDRID(cdrId)); } } return(cdrId); }
/// <summary> /// Gets the friendly name of the given CDRID param, if it exists. /// Otherwise, returns the CDRID param. /// </summary> public string GetFriendlyName(string cdrId) { // Get CDRID to friendly name mappings string dictionaryMappingFilepath = null; dictionaryMappingFilepath = this.DictionaryConfiguration.Files.Single(a => a.Locale == CultureInfo.CurrentUICulture.TwoLetterISOLanguageName).Filepath; if (!string.IsNullOrEmpty(dictionaryMappingFilepath)) { TerminologyMapping map = TerminologyMapping.GetMappingForFile(dictionaryMappingFilepath); // If pretty name is in label mappings, set CDRID if (map.MappingContainsCDRID(cdrId)) { return(map.GetFriendlyNameFromCDRID(cdrId)); } } return(cdrId); }