コード例 #1
0
        private void UpdateAttributeType(Attribute attribute, string value)
        {
            if (attribute.Type == AttributeTypeEnum.Sku)
            {
                if (AttributeTypeEnum.Global.ToString().ToLower().StartsWith(value.ToLower()))
                {
                    attribute.AttributeType = AttributeTypeEnum.Global.ToString();
                    return;
                }

                if (AttributeTypeEnum.Derived.ToString().ToLower().StartsWith(value.ToLower()))
                {
                    attribute.AttributeType = AttributeTypeEnum.Derived.ToString();
                    var existingEntities = attribute.EntityDatas.Where(ed => ed.Active).ToList();

                    if (existingEntities.Any())
                    {
                        var msg =
                            string.Format(
                                "There are {0} existing values connected to this attribute. Do you want to permanently delete them?",
                                existingEntities.Count);
                        if (existingEntities.Count > 0 &&
                            MessageBox.Show(msg, @"Delete linked entities?", MessageBoxButtons.YesNo) == DialogResult.No)
                        {
                            return;
                        }

                        existingEntities.ForEach(ed => ed.Active = false);
                    }
                }
            }
        }
コード例 #2
0
        public static string GetMetaAttributeValue(Attribute attribute, Attribute metaAttribute, TaxonomyInfo taxonomy)
        {
            try
            {
                var si = taxonomy.SchemaInfos.FirstOrDefault(a => a.Attribute == attribute);
                //var si = Arya.SchemaInfos.Where(t => t.TaxonomyID == Guid.Empty && t.Attribute == attribute ).FirstOrDefault();
                //if (si == null)
                //    return null;

                var smi = si.SchemaMetaInfos.FirstOrDefault(mi => mi.MetaAttributeID == metaAttribute.ID);

                //if (smi == null)
                //    return null;

                var smd = smi.SchemaMetaDatas.FirstOrDefault(a => a.Active);

                //if (smd == null)
                //    return null;
                //else
                return(smd.Value);
            }
            catch (NullReferenceException)
            {
                return(null);
            }
        }
コード例 #3
0
        private void UpdateAttributeGroup(Attribute attribute, string value)
        {
            attribute.Group = value;
            _attributeGroups.Add(value);

            InitAttributeGroups();
        }
コード例 #4
0
        private static SchemaAttribute GetMetaAttributeType(Attribute attribute)
        {
            var attributeName = attribute.AttributeName.ToLower();

            return(attributeName.StartsWith("is ") || attributeName.StartsWith("in ")
                ? new SchemaAttribute(attribute, typeof(bool))
                : new SchemaAttribute(attribute, typeof(string)));
        }
コード例 #5
0
 private IEnumerable <string> GetLovs(Attribute attribute, TaxonomyInfo taxonomy)
 {
     return(AryaTools.Instance.InstanceData.Dc.ExecuteQuery <string>(
                @"SELECT distinct ed.Value
                             FROM EntityData ed
                             INNER JOIN EntityInfo ei ON ed.Active = 1 AND ed.EntityID = ei.ID AND ed.AttributeID = {0}
                             INNER JOIN SkuInfo si ON si.Active = 1 AND ei.SkuID = si.SkuID AND si.TaxonomyID = {1}",
                attribute.ID, taxonomy.ID).OrderBy(p => p, new CompareForAlphaNumericSort()).ToList());
 }
コード例 #6
0
ファイル: TaxAttValueCalculator.cs プロジェクト: ewin66/Arya
        public EntityData ProcessCalculatedAttribute(Attribute att, TaxonomyInfo tax,
                                                     bool getDefaultForNullTaxonomy = true)
        {
            if (tax == null)
            {
                var globalDerivedAttribute = att.DerivedAttributes.FirstOrDefault(p => p.TaxonomyID == Guid.Empty);

                if (globalDerivedAttribute != null)
                {
                    return(ProcessCalculatedAttribute(globalDerivedAttribute.Expression,
                                                      globalDerivedAttribute.MaxResultLength));
                }

                tax = _sku.Taxonomy;
                if (tax == null || !getDefaultForNullTaxonomy)
                {
                    return new EntityData(false)
                           {
                               Value = String.Empty
                           }
                }
                ;
            }

            var calculatedAttribute =
                att.DerivedAttributes.FirstOrDefault(da => da.TaxonomyInfo != null && da.TaxonomyID == tax.ID);

            if (calculatedAttribute == null && att.DerivedAttributes.Any(da => da.TaxonomyInfo == null))
            {
                calculatedAttribute = att.DerivedAttributes.First(da => da.TaxonomyInfo == null);
            }

            //I wonder why we are setting the calculatedAttribute to NULL if an Active InSchema SchemaData exists
            //if (calculatedAttribute != null)
            //{
            //    if (sourceTaxonomy != null)
            //    {
            //        var schemaInfo = sourceTaxonomy.SchemaInfos.SingleOrDefault(p => p.AttributeID == att.ID);
            //        if (schemaInfo != null && !schemaInfo.SchemaDatas.Any(sd => sd.Active && sd.InSchema))
            //            calculatedAttribute = null;
            //    }
            //}

            if (calculatedAttribute == null)
            {
                return(ProcessCalculatedAttribute(att, tax.TaxonomyData.ParentTaxonomyInfo, false));
            }

            return(ProcessCalculatedAttribute(calculatedAttribute.Expression, calculatedAttribute.MaxResultLength));
        }
コード例 #7
0
        private void PopulateLov(bool overwrite)
        {
            // determine location
            Attribute    attribute = SchemaInfo.Attribute;
            TaxonomyInfo taxonomy  = SchemaInfo.TaxonomyInfo;

            Guid waitkey =
                FrmWaitScreen.ShowMessage(string.Format("Populating LOVs - {0} - {1}", taxonomy.NodeName,
                                                        attribute.AttributeName));

            // get values from database
            var listOfValues = GetLovs(attribute, taxonomy);

            SchemaInfo schemaInfo = taxonomy.SchemaInfos.FirstOrDefault(si => si.Attribute.Equals(attribute));

            if (schemaInfo != null)
            {
                if (overwrite)
                {
                    // assign database values to list of values
                    schemaInfo.ActiveListOfValues = listOfValues;
                }
                else
                {
                    // compare current list of values to database and add
                    // missing database values to list of values
                    var currentLov = schemaInfo.ActiveListOfValues.ToList();
                    foreach (var lov in listOfValues)
                    {
                        if (!currentLov.Contains(lov))
                        {
                            currentLov.Add(lov);
                        }
                    }
                    schemaInfo.ActiveListOfValues = currentLov;
                }
            }

            // save new list of values
            AryaTools.Instance.SaveChangesIfNecessary(false, false);
            FrmWaitScreen.HideMessage(waitkey);

            // refresh list of values form
            AryaTools.Instance.Forms.ListofValuesForm.SchemaInfo = schemaInfo;
        }
コード例 #8
0
        public static void UnmapNodeAttribute(TaxonomyInfo taxonomy, Attribute attribute)
        {
            var schemaInfo = taxonomy.SchemaInfos.FirstOrDefault(si => si.Attribute.Equals(attribute));

            if (schemaInfo == null)
            {
                return;
            }

            schemaInfo.SchemaMetaInfos.SelectMany(smi => smi.SchemaMetaDatas)
            .Where(md => md.Active)
            .ForEach(md => md.Active = false);

            if (schemaInfo.SchemaData != null)
            {
                schemaInfo.SchemaData.Active = false;
            }
        }
コード例 #9
0
        // Public Methods (5)
        public static void GetAttributeOrders(Attribute attribute, TaxonomyInfo taxonomy, out decimal navAttOrder,
                                              out decimal dispAttOrder, out bool inSchema)
        {
            navAttOrder  = 0;
            dispAttOrder = 0;
            inSchema     = false;

            if (taxonomy == null || attribute == null)
            {
                return;
            }

            inSchema = GetValue(taxonomy, attribute, SchemaAttributeInSchema) != null;

            var nav = GetValue(taxonomy, attribute, SchemaAttributeNavigationOrder);

            navAttOrder = nav != null ? (decimal)nav : 0;

            var disp = GetValue(taxonomy, attribute, SchemaAttributeDisplayOrder);

            dispAttOrder = disp != null ? (decimal)disp : 0;
        }
コード例 #10
0
        private void dgvAllAttributes_CellValuePushed(object sender, DataGridViewCellValueEventArgs e)
        {
            if (e.Value == null)
            {
                return;
            }

            var value = e.Value.ToString();

            if (string.IsNullOrWhiteSpace(value) ||
                string.Equals(value, Resources.NewAttributeName, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            switch (dgvAttributes.Columns[e.ColumnIndex].HeaderText)
            {
            case ColumnAttributeName:
                if (e.RowIndex == _visibleAttributes.Count)
                {
                    var existingAttribute = Attribute.GetAttributeFromName(value, false);
                    if (existingAttribute != null)
                    {
                        MessageBox.Show(@"Attribute already exists!");
                    }
                    else
                    {
                        var newAttribute = Attribute.GetAttributeFromName(value, true);
                        _allAttributes.Add(newAttribute);
                        _visibleAttributes.Add(newAttribute);
                        dgvAttributes.RowCount++;
                    }
                }
                else
                {
                    if (!_visibleAttributes[e.RowIndex].AttributeName.ToLower().Equals(value.ToLower()))
                    {
                        MessageBox.Show(@"Only Capitalization can be fixed in the Attribute Farm");
                    }
                    else
                    {
                        _visibleAttributes[e.RowIndex].AttributeName = value;
                    }
                }
                break;

            case ColumnAttributeType:
                if (e.RowIndex < _visibleAttributes.Count)
                {
                    int rowIndex = e.RowIndex;
                    UpdateAttributeType(_visibleAttributes[rowIndex], value);
                }
                break;

            case ColumnAttributeGroup:
                if (e.RowIndex < _visibleAttributes.Count)
                {
                    int rowIndex = e.RowIndex;
                    UpdateAttributeGroup(_visibleAttributes[rowIndex], value);
                }
                break;
            }
            AryaTools.Instance.SaveChangesIfNecessary(false, false);
        }
コード例 #11
0
 public SchemaAttribute(Attribute metaAttribute, Type dataType)
 {
     MetaSchemaAttribute = metaAttribute;
     DataType            = dataType;
 }
コード例 #12
0
        public static string SetValue(TaxonomyInfo taxonomy, Attribute attribute, bool autoMapSchema,
                                      SchemaAttribute schematus, object value, bool suppressAutoMapMessage = false)
        {
            var schemaInfo    = taxonomy.SchemaInfos.FirstOrDefault(si => si.Attribute.Equals(attribute));
            var newSchemaInfo = false;

            if (schemaInfo == null)
            {
                if (suppressAutoMapMessage)
                {
                    return(null);
                }
                if (!autoMapSchema &&
                    MessageBox.Show(
                        String.Format("Attribute [{0}] is not mapped in Node [{1}]. Do you want to map it?", attribute,
                                      taxonomy.TaxonomyData.NodeName), @"Add to Schema", MessageBoxButtons.YesNo)
                    == DialogResult.No)
                {
                    return(null);
                }
                schemaInfo = new SchemaInfo {
                    Attribute = attribute
                };
                taxonomy.SchemaInfos.Add(schemaInfo);
                newSchemaInfo = true;
            }

            if (schematus == null)
            {
                //Create/Update Schema Info only
                var currentSchemaData = schemaInfo.SchemaData;
                var newSchemaData     = new SchemaData();
                if (value != null && value is SchemaData)
                {
                    var fromSchemaData = (SchemaData)value;
                    if (currentSchemaData != null && currentSchemaData.Equals(fromSchemaData))
                    {
                        return(null);
                    }

                    newSchemaData.DataType        = fromSchemaData.DataType;
                    newSchemaData.DisplayOrder    = fromSchemaData.DisplayOrder;
                    newSchemaData.NavigationOrder = fromSchemaData.NavigationOrder;
                    newSchemaData.InSchema        = fromSchemaData.InSchema;
                }

                if (currentSchemaData != null)
                {
                    currentSchemaData.Active = false;
                }
                schemaInfo.SchemaDatas.Add(newSchemaData);
                return(null);
            }

            var activeSd = schemaInfo.SchemaData;

            switch (schematus.AttributeType)
            {
            case SchemaAttributeType.Primary:
                var reallyNewSd  = false;
                var reorderRanks = false;

                SchemaData newSchemaData;
                if (activeSd == null)
                {
                    reallyNewSd   = true;
                    newSchemaData = new SchemaData();
                }
                else
                {
                    //activeSd.DeletedBy = AryaTools.Instance.InstanceData.CurrentUser.ID;
                    activeSd.DeletedByUser = AryaTools.Instance.InstanceData.CurrentUser;
                    //fixes Object not found error
                    activeSd.DeletedOn = DateTime.Now;
                    newSchemaData      = new SchemaData
                    {
                        DataType        = activeSd.DataType,
                        InSchema        = activeSd.InSchema,
                        NavigationOrder = activeSd.NavigationOrder,
                        DisplayOrder    = activeSd.DisplayOrder
                    };
                }

                var propertyName = schematus.PrimarySchemaAttribute.Replace(" ", String.Empty);

                var valueProperty = newSchemaData.GetType().GetProperty(propertyName);
                var propertyType  = valueProperty.PropertyType;

                if (propertyType == typeof(string))
                {
                    var stringValue = value ?? String.Empty;
                    if (propertyName == "DataType")
                    {
                        stringValue = ValidateDataType(stringValue);
                    }

                    if (!(valueProperty.GetValue(newSchemaData, null) ?? String.Empty).Equals(stringValue))
                    {
                        reallyNewSd = true;
                        valueProperty.SetValue(newSchemaData, stringValue.ToString(), null);
                    }
                }
                else if (propertyType == typeof(bool))
                {
                    var    boolValue = value ?? false;
                    string firstCharacter;
                    try
                    {
                        firstCharacter = boolValue.ToString().Substring(0, 1).ToLower();
                    }
                    catch (Exception)
                    {
                        firstCharacter = "f";
                    }

                    var newValue = firstCharacter.Equals("t") || firstCharacter.Equals("y") ||
                                   firstCharacter.Equals("1");

                    if (!((bool)valueProperty.GetValue(newSchemaData, null)).Equals(newValue))
                    {
                        reallyNewSd = true;
                        valueProperty.SetValue(newSchemaData, newValue, null);
                    }
                }
                else if (propertyType == typeof(decimal))
                {
                    var     decimalValue = value ?? 0.0;
                    decimal newDecimalValue;
                    if (Decimal.TryParse(decimalValue.ToString(), out newDecimalValue))
                    {
                        if (!((decimal)valueProperty.GetValue(newSchemaData, null)).Equals(newDecimalValue))
                        {
                            reallyNewSd = true;
                            valueProperty.SetValue(newSchemaData, newDecimalValue, null);
                            reorderRanks = SchemaDataGridView.AutoOrderRanks;
                        }
                    }
                    else
                    {
                        return(String.Format("Invalid value [{0}] for [{1}] - [{2}].{3}Expected a decimal value.",
                                             decimalValue, taxonomy.NodeName, attribute, Environment.NewLine));
                    }
                }
                else
                {
                    return(String.Format("Unknown data type for value [{0}] for [{1}] - [{2}]",
                                         value ?? String.Empty, taxonomy.NodeName, attribute));
                }

                if (reallyNewSd)
                {
                    if (activeSd != null)
                    {
                        activeSd.Active = false;
                    }
                    schemaInfo.SchemaDatas.Add(newSchemaData);

                    if (reorderRanks)
                    {
                        AutoOrderRanks(newSchemaData.SchemaInfo.TaxonomyInfo, newSchemaData);
                    }
                }

                return(null);

            case SchemaAttributeType.Meta:
                var reallyNewSmd = false;

                if (schematus.DataType == typeof(bool))
                {
                    value = value.ToString().StartsWith("y", StringComparison.OrdinalIgnoreCase) ? "Yes" : "No";
                }
                //First check if there is an active SchemaData
                if (activeSd == null)
                {
                    if (suppressAutoMapMessage)
                    {
                        return(null);
                    }

                    if (!newSchemaInfo && !autoMapSchema &&
                        MessageBox.Show(
                            String.Format("Attribute [{0}] is not mapped in Node [{1}]. Do you want to map it?",
                                          attribute, taxonomy.TaxonomyData.NodeName), "Add to Schema", MessageBoxButtons.YesNo)
                        == DialogResult.No)
                    {
                        return(null);
                    }

                    schemaInfo.SchemaDatas.Add(new SchemaData());
                    reallyNewSmd = true;
                }

                var activeSmi =
                    (from mi in schemaInfo.SchemaMetaInfos
                     where mi.Attribute.Equals(schematus.MetaSchemaAttribute)
                     select mi).FirstOrDefault();

                if (activeSmi == null)
                {
                    activeSmi = new SchemaMetaInfo {
                        Attribute = schematus.MetaSchemaAttribute
                    };
                    schemaInfo.SchemaMetaInfos.Add(activeSmi);
                    reallyNewSmd = true;
                }

                var activeSmd = activeSmi.SchemaMetaData;

                if (activeSmd == null)
                {
                    reallyNewSmd = true;
                }
                else if (value == null || !activeSmd.Value.Equals(value))
                {
                    reallyNewSmd     = true;
                    activeSmd.Active = false;
                }

                if (reallyNewSmd && value != null && !String.IsNullOrEmpty(value.ToString()))
                {
                    activeSmi.SchemaMetaDatas.Add(new SchemaMetaData {
                        Value = value.ToString()
                    });
                    SchemaDataGridView.UpdateAutoCompleteSource(schematus.MetaSchemaAttribute, value.ToString());
                }

                return(null);

            default:
                return("Unknown Meta-attribute Type! Weird!!!");
            }
        }
コード例 #13
0
        public static object GetValue(TaxonomyInfo taxonomy, Attribute attribute, SchemaAttribute schematus)
        {
            if (taxonomy == null && attribute == null)
            {
                return(schematus);
            }

            if (taxonomy == null)
            {
                return(attribute);
            }

            if (attribute == null)
            {
                return(taxonomy);
            }

            var schemaInfo =
                taxonomy.SchemaInfos.FirstOrDefault(si => si.Attribute != null && si.Attribute.Equals(attribute));

            if (schematus == null || schemaInfo == null)
            {
                return(null);
            }

            switch (schematus.AttributeType)
            {
            case SchemaAttributeType.Primary:
                var activeSchemaData = schemaInfo.SchemaDatas.FirstOrDefault(sd => sd.Active);
                if (activeSchemaData == null)
                {
                    return(null);
                }

                var valueProperty =
                    activeSchemaData.GetType()
                    .GetProperty(schematus.PrimarySchemaAttribute.Replace(" ", String.Empty));
                return(valueProperty.GetValue(activeSchemaData, null));

            case SchemaAttributeType.Meta:
                var metaSchemaData = (from mi in schemaInfo.SchemaMetaInfos
                                      where mi.Attribute.Equals(schematus.MetaSchemaAttribute) && mi.SchemaMetaData != null
                                      select mi.SchemaMetaData).FirstOrDefault();
                if (schematus.MetaSchemaAttribute.AttributeName == Framework.Properties.Resources.SchemaEnrichmentImageAttributeName)
                {
                    if (metaSchemaData == null || string.IsNullOrEmpty(metaSchemaData.Value))
                    {
                        return(metaSchemaData);
                    }

                    Guid guidValue;
                    var  isGuid = Guid.TryParse(metaSchemaData.Value, out guidValue);
                    return(isGuid ? GetImageName(taxonomy, new Guid(metaSchemaData.Value)) : metaSchemaData.Value);
                    //AryaTools.Instance.InstanceData.Dc.Skus.First(sk => sk.ID.ToString() == metaSchemaData.ToString()).EntityInfos.Where(ei => ei.EntityDatas.Where(ed => ed.Attribute.AttributeName == "Image FileName"));
                    //Sku imageSku = taxonomy.SkuInfos.FirstOrDefault(si => si.Sku.SkuType == Framework.Data.AryaDb.Sku.ItemType.EnrichmentImage.ToString()).Sku;
                }

                return(metaSchemaData);

            case SchemaAttributeType.Special:
                if (schematus.SpecialSchemaAttribute.Equals(SpecialSchematusIsMapped))
                {
                    var activeSd = schemaInfo.SchemaDatas.FirstOrDefault(sd => sd.Active);
                    if (activeSd != null)
                    {
                        return("x");
                    }
                }

                if (schematus.SpecialSchemaAttribute.Equals(SpecialSchematusAttributeType))
                {
                    if (attribute.AttributeType == "Sku")
                    {
                        return("Product");
                    }
                    return(attribute.Type);
                }


                if (schematus.SpecialSchemaAttribute.Equals(SpecialSchematusListOfValues))
                {
                    var listOfValues = schemaInfo.ListOfValues.Where(lov => lov.Active).Select(lov => lov).ToList();
                    if (listOfValues.Any())
                    {
                        var listSep =
                            AryaTools.Instance.InstanceData.CurrentProject.ProjectPreferences.ListSeparator
                            ?? "; ";
                        return
                            (listOfValues.OrderBy(val => val.DisplayOrder)
                             .ThenBy(val => val.Value)
                             .Select(val => val.Value)
                             .Aggregate((current, lov) => current + listSep + lov));
                    }
                    return(null);
                }
                return(null);

            case SchemaAttributeType.FillRate:
                var fillRate = AryaTools.Instance.AllFillRates.GetFillRate(taxonomy, attribute,
                                                                           schematus.FillRateSchemaAttribute);
                if (fillRate == Double.MinValue)
                {
                    SchemaDataGridView.RefreshGridView = true;
                    return("Calculating...");
                }

                return(fillRate);

            default:
                return(null);
            }
        }
コード例 #14
0
ファイル: TaxAttValueCalculator.cs プロジェクト: ewin66/Arya
            private void CalculateValue(IEnumerable <Token> existingTokens)
            {
                var token = _expression;

                if (tokenType == TokenType.Attribute || tokenType == TokenType.AttributeValueOnly)
                {
                    var entities =
                        _sku.EntityInfos.SelectMany(ei => ei.EntityDatas.Where(ed => ed.Active))
                        .Where(
                            ed =>
                            ed.Attribute.AttributeName != null &&
                            ed.Attribute.AttributeName.Equals(token, StringComparison.OrdinalIgnoreCase))
                        .OrderBy(ed => ed.Value)
                        .ToList();

                    if (entities.Count == 0)
                    {
                        var attribute = Attribute.GetAttributeFromName(token, false);
                        if (attribute != null && attribute.AttributeType == AttributeTypeEnum.Derived.ToString())
                        {
                            entities = new List <EntityData>
                            {
                                new TaxAttValueCalculator(_sku)
                                .ProcessCalculatedAttribute(attribute, _sku.Taxonomy)
                            };
                        }
                    }

                    if (entities.Count == 0)
                    {
                        return;
                    }

                    if (entities.Count == 1)
                    {
                        var ed = entities[0];
                        _value = ed.Value ?? string.Empty;
                        if (tokenType == TokenType.Attribute && !string.IsNullOrEmpty(ed.Uom))
                        {
                            Value += ed.Uom;
                        }
                        Uom = ed.Uom;
                        return;
                    }

                    var value   = string.Empty;
                    var allUoms = new HashSet <string>();
                    foreach (var entityData in entities)
                    {
                        value += (string.IsNullOrEmpty(value) ? string.Empty : ", ") + entityData.Value;
                        allUoms.Add(entityData.Uom);
                        if (!string.IsNullOrEmpty(entityData.Uom))
                        {
                            if (tokenType == TokenType.Attribute)
                            {
                                value += entityData.Uom;
                            }
                        }
                    }

                    Value = value;

                    if (allUoms.Count == 1)
                    {
                        Uom = allUoms.First();
                    }

                    return;
                }

                if (tokenType == TokenType.Uom)
                {
                    var allUomValues =
                        _sku.EntityInfos.SelectMany(ei => ei.EntityDatas.Where(ed => ed.Active))
                        .Where(
                            ed =>
                            ed.Attribute.AttributeName != null &&
                            ed.Attribute.AttributeName.Equals(token, StringComparison.OrdinalIgnoreCase))
                        .Select(p => p.Uom)
                        .Distinct()
                        .ToList();

                    Value = allUomValues.Count == 1 ? allUomValues[0] : string.Empty;
                    return;
                }

                if (tokenType == TokenType.Constant)
                {
                    Value = token.Substring(1, token.Length - 2).Replace("\"\"", "\"");
                    return;
                }

                if (tokenType == TokenType.Special)
                {
                    if (token.Equals(NewTaxonomyExpression))
                    {
                        var tax = _sku.Taxonomy;
                        Value = tax != null?tax.ToString() : string.Empty;

                        return;
                    }

                    if (token.Equals(OldTaxonomyExpression))
                    {
                        Value = _sku.OldTaxonomy;
                        return;
                    }

                    if (token.Equals(UomExpression))
                    {
                        var allUoms =
                            existingTokens.Where(
                                p =>
                                p._id != _id && p.CurrentTokenType == TokenType.Attribute &&
                                !string.IsNullOrEmpty(p.Value)).Select(p => p.Uom).Distinct().ToList();
                        Value = allUoms.Count == 1 ? allUoms[0] : null;
                        return;
                    }

                    if (token.Equals(NodeNameExpression))
                    {
                        var tax = _sku.Taxonomy;
                        Value = tax != null ? tax.TaxonomyData.NodeName : string.Empty;
                    }
                }
            }