public void UpdateAttributeValue(Attributes.Attribute attribute, object value) { var attributeCollectionDecorator = _collectionDecoratorFactory.Create(attribute.Type); if (attributeCollectionDecorator == null) { throw new DomainException($"Can't create AttributeCollectionDecorator by attribute type {attribute.Type.Name}"); } attributeCollectionDecorator.UpdateAttributeValue(Id, attribute, value); }
private static IReadOnlyList <Node> PathToNode(List <string> path) { List <Node> list = new List <Node>(); foreach (string pathValue in path) { Attributes.Attribute attr = new Attributes.Attribute(Path, pathValue); Node node = StructNode.Create("node1", new Attributes(attr)); list.Add(node); } return(list.AsReadOnly()); }
private static IReadOnlyList <Node> ResolutionToString(string resolution) { List <Node> list = new List <Node>(); string[] path = resolution.SplitLines(); foreach (string pathValue in path) { Attributes.Attribute attr = new Attributes.Attribute(Path, pathValue.NormalizeInclude());; Node node = StructNode.Create("node1", new Attributes(attr)); list.Add(node); } return(list.AsReadOnly()); }
public static NodeMapData GetNode(NodeViewModelBase uiNodeVM) { NodeMapData objNode; if (uiNodeVM.GetType().Equals(typeof(IconNodeViewModel))) { objNode = new IconNodeMapData(uiNodeVM.ParentNode.ID); // Property IconNodeViewModel iconNodeVM = (IconNodeViewModel)uiNodeVM; if (iconNodeVM.ImageSource != null) { ((IconNodeMapData)objNode).ImageSource = new System.Uri(iconNodeVM.ImageSource, UriKind.Relative); } } else { objNode = new TextNodeMapData(uiNodeVM.ParentNode.ID); } // Properties objNode.Description = uiNodeVM.Description; objNode.Label = uiNodeVM.DisplayValue; Size dimension = new Size(uiNodeVM.Width, uiNodeVM.Height); objNode.Dimension = dimension; objNode.Position = uiNodeVM.Position; objNode.IsHidden = uiNodeVM.IsHidden; objNode.BackgroundColor = uiNodeVM.BackgroundColor.Color; objNode.SelectionColor = uiNodeVM.SelectionColor.Color; // Attributes foreach (KeyValuePair <string, AttributeValue> uiNodeVMAttrKVP in uiNodeVM.ParentNode.Attributes) { Attributes.Attribute uiNodeVMAttribute = GlobalAttributeCollection.GetInstance(uiNodeVM.Scope).GetAttribute(uiNodeVMAttrKVP.Key); AttributeMapData objNodeAttribute = new AttributeMapData(uiNodeVMAttrKVP.Key, uiNodeVMAttrKVP.Value.Value); objNode.Attributes.Add(objNodeAttribute.Name, objNodeAttribute); objNodeAttribute.SemanticType = uiNodeVMAttribute.SemanticType; objNodeAttribute.SimilarityMeasure = uiNodeVMAttribute.PreferredSimilarityMeasure; objNodeAttribute.IsHidden = !uiNodeVMAttribute.Visible; } return(objNode); }
public List <Attributes> UpdateStatus(List <Attributes> statusList, Attributes.Attribute targetStatus, int duration) { var found = false; for (int i = 0; i < statusList.Count; i++) { var status = statusList[i]; if (status.Effect == targetStatus) { status.Duration += duration; statusList[i] = status; found = true; break; } } if (!found) { statusList.Add(new Attributes(targetStatus, duration)); } return(statusList); }
/*/// <summary> /// Gets the default edge type (direction) to be used in the /// event that the 'directed' attribute of an edge is not included /// </summary> /// <param name="defaultEdgeType">The value of the edgedefault attribute</param> private static GraphType GetDefaultEdgeType(string defaultEdgeType) { GraphType determinedEdgeType = GraphType.Undirected; if (defaultEdgeType != null && defaultEdgeType.ToLower().Equals("directed")) { determinedEdgeType = GraphType.Directed; } return determinedEdgeType; }*/ /// <summary> /// Reads an XML node from the specified XmlReader /// </summary> /// <param name="reader">Reader from which to read the node from</param> private NodeMapData ReadNode(XmlReader reader, NodeTypes defaultNodeType) { NodeMapData objNode; string nodeId = reader.GetAttribute("id"); if (defaultNodeType == NodeTypes.Icon) { objNode = new IconNodeMapData(nodeId); } else { objNode = new TextNodeMapData(nodeId); } if (reader.ReadToDescendant("data")) { Attributes.Attribute newAttribute = null; AttributeValue newAttributeValue = null; // Loop over all data elements. These are the attributes do { // Record the attributes string dataKey = reader.GetAttribute("key"); string dataValue = reader.ReadElementContentAsString(); // Determine if we are dealing with a node property if (dataKey.StartsWith(NODE_PROPERTY_PREFIX)) { string propName = dataKey.Substring(NODE_PROPERTY_PREFIX.Length); switch (propName) { case "Description": objNode.Description = dataValue; break; case "DisplayValue": objNode.Label = dataValue; break; case "SelectionColor": SolidColorBrush selectionColor = Conversion.HexColorToBrush(dataValue); objNode.SelectionColor = selectionColor.Color; break; case "ImageSource": ((IconNodeMapData)objNode).ImageSource = new Uri(dataValue, UriKind.RelativeOrAbsolute); break; case "Height": double height = double.Parse(dataValue); objNode.Dimension = new Size(objNode.Dimension.Width, height); break; case "Width": double width = double.Parse(dataValue); objNode.Dimension = new Size(width, objNode.Dimension.Height); break; case "Position": string[] splitPosition = dataValue.Split(','); objNode.Position = new Point(double.Parse(splitPosition[0]), double.Parse(splitPosition[1])); break; case "IsHidden": objNode.IsHidden = bool.Parse(dataValue); break; case "BackgroundColor": SolidColorBrush backgroundColor = Conversion.HexColorToBrush(dataValue); objNode.BackgroundColor = backgroundColor.Color; break; default: // TODO prop is for a different version of SnagL break; } // TODO do we only want to do whats above when what is commented out below fails? /*// Attempt to set the node propety if ((SetExportablePropertyValue(dataKey, objNode, dataValue))) _logger.WriteLogEntry(LogLevel.INFO, string.Format("The Node property [{0}] was set to '{1}'", dataKey, dataValue), null, null); else { // The property might be for the view model so try // and set the view model if ((SetExportablePropertyValue(dataKey, objNode, dataValue))) _logger.WriteLogEntry(LogLevel.INFO, string.Format("The NodeVM property [{0}] was set to '{1}'", dataKey, dataValue), null, null); else _logger.WriteLogEntry(LogLevel.ERROR, string.Format("Unable to set the property [{0}] to the specified value [{1}]", dataKey, dataValue), null, null); }*/ } else // Determine if we are dealing with an attribute { if (dataKey.StartsWith(NODE_ATTRIBUTE_PREFIX)) { // Determine if we are dealing with a descriptor or a value if (dataKey.EndsWith(ATTRIBUTE_DESCRIPTOR_SUFFIX)) newAttribute = CreateAttribute(dataValue); else if (dataKey.EndsWith(ATTRIBUTE_VALUE_SUFFIX)) { newAttributeValue = new AttributeValue(dataValue); } } else // If we are here, we are not dealing with SnagL formatted GraphML { // We are dealing with an unknown data element so we // are going to treat it like a new attribute // Determine if we are dealing with a descriptor or a value newAttribute = new Attributes.Attribute(dataKey); newAttributeValue = new AttributeValue(dataValue); } // Check if we have a valid Attribute and AttributeValue class if (newAttribute != null && newAttributeValue != null) { AttributeMapData objAttribute = new AttributeMapData(newAttribute.Name, newAttributeValue.Value); objNode.Attributes.Add(objAttribute.Name, objAttribute); objAttribute.SemanticType = newAttribute.SemanticType; objAttribute.SimilarityMeasure = newAttribute.PreferredSimilarityMeasure; objAttribute.IsHidden = !newAttribute.Visible; newAttribute = null; newAttributeValue = null; } } } while (reader.LocalName == "data" || (string.IsNullOrEmpty(reader.LocalName) && reader.ReadToNextSibling("data"))); } return objNode; }
/// <summary> /// Adds the specificed edge /// </summary> /// <param name="graphComponents">The Graph that data is being imported into</param> /// <param name="creationType">The specified CreationType</param> /// <param name="objEdge">Edge to be added</param> public static void AddEdge(GraphComponents graphComponents, CreationType creationType, EdgeMapData objEdge) { INode uiSourceNode = graphComponents.Data.GetNode(objEdge.Source); if (uiSourceNode == null && creationType == CreationType.Imported) { throw new Exception("Missing Source Node"); } else if (uiSourceNode == null)// && creationType == CreationType.Live { uiSourceNode = new GhostNode(objEdge.Source); } INode uiTargetNode = graphComponents.Data.GetNode(objEdge.Target); if (uiTargetNode == null && creationType == CreationType.Imported) { throw new Exception("Missing Target Node"); } else if (uiTargetNode == null)// && creationType == CreationType.Live { uiTargetNode = new GhostNode(objEdge.Target); } if (string.IsNullOrEmpty(objEdge.Label) && objEdge.Attributes.Count == 0) { Berico.SnagL.Model.Edge uiEdge = new Berico.SnagL.Model.Edge(uiSourceNode, uiTargetNode); uiEdge.SourceMechanism = creationType; // Properties uiEdge.Type = objEdge.Type; // the EdgeViewModel must be created after uiEdge has had a Type specified IEdgeViewModel uiEdgeVM = EdgeViewModelBase.GetEdgeViewModel(uiEdge, graphComponents.Scope); graphComponents.AddEdgeViewModel(uiEdgeVM); } else { DataEdge uiEdge = new DataEdge(uiSourceNode, uiTargetNode); uiEdge.SourceMechanism = creationType; // Properties uiEdge.Type = objEdge.Type; uiEdge.DisplayValue = objEdge.Label; // the EdgeViewModel must be created after uiEdge has had a Type specified IEdgeViewModel uiEdgeVM = EdgeViewModelBase.GetEdgeViewModel(uiEdge, graphComponents.Scope); graphComponents.AddEdgeViewModel(uiEdgeVM); uiEdgeVM.Thickness = objEdge.Thickness; uiEdgeVM.Color = new SolidColorBrush(objEdge.Color); uiEdgeVM.EdgeLine.Text = objEdge.Label; uiEdgeVM.EdgeLine.LabelTextUnderline = objEdge.IsLabelTextUnderlined; uiEdgeVM.EdgeLine.LabelBackgroundColor = new SolidColorBrush(objEdge.LabelBackgroundColor); uiEdgeVM.EdgeLine.LabelForegroundColor = new SolidColorBrush(objEdge.LabelForegroundColor); uiEdgeVM.EdgeLine.LabelFontStyle = objEdge.LabelFontStyle; uiEdgeVM.EdgeLine.LabelFontWeight = objEdge.LabelFontWeight; if (objEdge.LabelFont != null) { uiEdgeVM.EdgeLine.LabelFont = objEdge.LabelFont; } // Attributes foreach (KeyValuePair<string, AttributeMapData> objEdgeAttrKVP in objEdge.Attributes) { Attributes.Attribute uiEdgeAttribute = new Attributes.Attribute(objEdgeAttrKVP.Value.Name); AttributeValue uiEdgeAttributeValue = new AttributeValue(objEdgeAttrKVP.Value.Value); uiEdge.Attributes.Add(uiEdgeAttribute.Name, uiEdgeAttributeValue); //GlobalAttributeCollection.GetInstance(graphComponents.Scope).Add(uiEdgeAttribute, uiEdgeAttributeValue); uiEdgeAttribute.SemanticType = objEdgeAttrKVP.Value.SemanticType; uiEdgeAttribute.PreferredSimilarityMeasure = objEdgeAttrKVP.Value.SimilarityMeasure; uiEdgeAttribute.Visible = !objEdgeAttrKVP.Value.IsHidden; } } }
/// <summary> /// Adds the specificed node /// </summary> /// <param name="graphComponents">The Graph that data is being imported into</param> /// <param name="creationType">The specified CreationType</param> /// <param name="objNode">Node to be added</param> public static void AddNode(GraphComponents graphComponents, CreationType creationType, NodeMapData objNode) { // Create new node Node uiNode = new Node(objNode.Id); uiNode.SourceMechanism = creationType; // TODO as NodeMapData types expands, this needs to be adjusted NodeTypes uiNodeType = NodeTypes.Simple; if (objNode is IconNodeMapData) { uiNodeType = NodeTypes.Icon; } else if (objNode is TextNodeMapData) { uiNodeType = NodeTypes.Text; } NodeViewModelBase uiNodeVM = NodeViewModelBase.GetNodeViewModel(uiNodeType, uiNode, graphComponents.Scope); // Properties if (uiNodeType == NodeTypes.Icon) { IconNodeMapData objIconNode = (IconNodeMapData)objNode; if (objIconNode.ImageSource != null) { ((IconNodeViewModel)uiNodeVM).ImageSource = objIconNode.ImageSource.ToString(); } } uiNodeVM.Description = objNode.Description; uiNodeVM.DisplayValue = objNode.Label; uiNodeVM.Width = objNode.Dimension.Width; uiNodeVM.Height = objNode.Dimension.Height; uiNodeVM.Position = objNode.Position; uiNodeVM.IsHidden = objNode.IsHidden; SolidColorBrush uiBackgroundColorBrush = new SolidColorBrush(objNode.BackgroundColor); uiNodeVM.BackgroundColor = uiBackgroundColorBrush; SolidColorBrush uiSelectionColorBrush = new SolidColorBrush(objNode.SelectionColor); uiNodeVM.SelectionColor = uiSelectionColorBrush; if (uiNodeVM.Height == 0) { uiNodeVM.Height = 45; } if (uiNodeVM.Width == 0) { uiNodeVM.Width = 45; } // Add the node to the graph graphComponents.AddNodeViewModel(uiNodeVM); // Attributes foreach (KeyValuePair<string, AttributeMapData> objNodeAttrKVP in objNode.Attributes) { Attributes.Attribute uiNodeAttribute = new Attributes.Attribute(objNodeAttrKVP.Value.Name); AttributeValue uiNodeAttributeValue = new AttributeValue(objNodeAttrKVP.Value.Value); uiNode.Attributes.Add(uiNodeAttribute.Name, uiNodeAttributeValue); GlobalAttributeCollection.GetInstance(graphComponents.Scope).Add(uiNodeAttribute, uiNodeAttributeValue); uiNodeAttribute.SemanticType = objNodeAttrKVP.Value.SemanticType; uiNodeAttribute.PreferredSimilarityMeasure = objNodeAttrKVP.Value.SimilarityMeasure; uiNodeAttribute.Visible = !objNodeAttrKVP.Value.IsHidden; } }
/// <summary> /// Adds the specificed node /// </summary> /// <param name="graphComponents">The Graph that data is being imported into</param> /// <param name="creationType">The specified CreationType</param> /// <param name="objNode">Node to be added</param> public static void AddNode(GraphComponents graphComponents, CreationType creationType, NodeMapData objNode) { // Create new node Node uiNode = new Node(objNode.Id); uiNode.SourceMechanism = creationType; // TODO as NodeMapData types expands, this needs to be adjusted NodeTypes uiNodeType = NodeTypes.Simple; if (objNode is IconNodeMapData) { uiNodeType = NodeTypes.Icon; } else if (objNode is TextNodeMapData) { uiNodeType = NodeTypes.Text; } NodeViewModelBase uiNodeVM = NodeViewModelBase.GetNodeViewModel(uiNodeType, uiNode, graphComponents.Scope); // Properties if (uiNodeType == NodeTypes.Icon) { IconNodeMapData objIconNode = (IconNodeMapData)objNode; if (objIconNode.ImageSource != null) { ((IconNodeViewModel)uiNodeVM).ImageSource = objIconNode.ImageSource.ToString(); } } uiNodeVM.Description = objNode.Description; uiNodeVM.DisplayValue = objNode.Label; uiNodeVM.Width = objNode.Dimension.Width; uiNodeVM.Height = objNode.Dimension.Height; uiNodeVM.Position = objNode.Position; uiNodeVM.IsHidden = objNode.IsHidden; SolidColorBrush uiBackgroundColorBrush = new SolidColorBrush(objNode.BackgroundColor); uiNodeVM.BackgroundColor = uiBackgroundColorBrush; SolidColorBrush uiSelectionColorBrush = new SolidColorBrush(objNode.SelectionColor); uiNodeVM.SelectionColor = uiSelectionColorBrush; if (uiNodeVM.Height == 0) { uiNodeVM.Height = 45; } if (uiNodeVM.Width == 0) { uiNodeVM.Width = 45; } // Add the node to the graph graphComponents.AddNodeViewModel(uiNodeVM); // Attributes foreach (KeyValuePair <string, AttributeMapData> objNodeAttrKVP in objNode.Attributes) { Attributes.Attribute uiNodeAttribute = new Attributes.Attribute(objNodeAttrKVP.Value.Name); AttributeValue uiNodeAttributeValue = new AttributeValue(objNodeAttrKVP.Value.Value); uiNode.Attributes.Add(uiNodeAttribute.Name, uiNodeAttributeValue); GlobalAttributeCollection.GetInstance(graphComponents.Scope).Add(uiNodeAttribute, uiNodeAttributeValue); uiNodeAttribute.SemanticType = objNodeAttrKVP.Value.SemanticType; uiNodeAttribute.PreferredSimilarityMeasure = objNodeAttrKVP.Value.SimilarityMeasure; uiNodeAttribute.Visible = !objNodeAttrKVP.Value.IsHidden; } }
/// <summary> /// Adds the specificed edge /// </summary> /// <param name="graphComponents">The Graph that data is being imported into</param> /// <param name="creationType">The specified CreationType</param> /// <param name="objEdge">Edge to be added</param> public static void AddEdge(GraphComponents graphComponents, CreationType creationType, EdgeMapData objEdge) { INode uiSourceNode = graphComponents.Data.GetNode(objEdge.Source); if (uiSourceNode == null && creationType == CreationType.Imported) { throw new Exception("Missing Source Node"); } else if (uiSourceNode == null)// && creationType == CreationType.Live { uiSourceNode = new GhostNode(objEdge.Source); } INode uiTargetNode = graphComponents.Data.GetNode(objEdge.Target); if (uiTargetNode == null && creationType == CreationType.Imported) { throw new Exception("Missing Target Node"); } else if (uiTargetNode == null)// && creationType == CreationType.Live { uiTargetNode = new GhostNode(objEdge.Target); } if (string.IsNullOrEmpty(objEdge.Label) && objEdge.Attributes.Count == 0) { Berico.SnagL.Model.Edge uiEdge = new Berico.SnagL.Model.Edge(uiSourceNode, uiTargetNode); uiEdge.SourceMechanism = creationType; // Properties uiEdge.Type = objEdge.Type; // the EdgeViewModel must be created after uiEdge has had a Type specified IEdgeViewModel uiEdgeVM = EdgeViewModelBase.GetEdgeViewModel(uiEdge, graphComponents.Scope); graphComponents.AddEdgeViewModel(uiEdgeVM); } else { DataEdge uiEdge = new DataEdge(uiSourceNode, uiTargetNode); uiEdge.SourceMechanism = creationType; // Properties uiEdge.Type = objEdge.Type; uiEdge.DisplayValue = objEdge.Label; // the EdgeViewModel must be created after uiEdge has had a Type specified IEdgeViewModel uiEdgeVM = EdgeViewModelBase.GetEdgeViewModel(uiEdge, graphComponents.Scope); graphComponents.AddEdgeViewModel(uiEdgeVM); uiEdgeVM.Thickness = objEdge.Thickness; uiEdgeVM.Color = new SolidColorBrush(objEdge.Color); uiEdgeVM.EdgeLine.Text = objEdge.Label; uiEdgeVM.EdgeLine.LabelTextUnderline = objEdge.IsLabelTextUnderlined; uiEdgeVM.EdgeLine.LabelBackgroundColor = new SolidColorBrush(objEdge.LabelBackgroundColor); uiEdgeVM.EdgeLine.LabelForegroundColor = new SolidColorBrush(objEdge.LabelForegroundColor); uiEdgeVM.EdgeLine.LabelFontStyle = objEdge.LabelFontStyle; uiEdgeVM.EdgeLine.LabelFontWeight = objEdge.LabelFontWeight; if (objEdge.LabelFont != null) { uiEdgeVM.EdgeLine.LabelFont = objEdge.LabelFont; } // Attributes foreach (KeyValuePair <string, AttributeMapData> objEdgeAttrKVP in objEdge.Attributes) { Attributes.Attribute uiEdgeAttribute = new Attributes.Attribute(objEdgeAttrKVP.Value.Name); AttributeValue uiEdgeAttributeValue = new AttributeValue(objEdgeAttrKVP.Value.Value); uiEdge.Attributes.Add(uiEdgeAttribute.Name, uiEdgeAttributeValue); //GlobalAttributeCollection.GetInstance(graphComponents.Scope).Add(uiEdgeAttribute, uiEdgeAttributeValue); uiEdgeAttribute.SemanticType = objEdgeAttrKVP.Value.SemanticType; uiEdgeAttribute.PreferredSimilarityMeasure = objEdgeAttrKVP.Value.SimilarityMeasure; uiEdgeAttribute.Visible = !objEdgeAttrKVP.Value.IsHidden; } } }
/*/// <summary> * /// Gets the default edge type (direction) to be used in the * /// event that the 'directed' attribute of an edge is not included * /// </summary> * /// <param name="defaultEdgeType">The value of the edgedefault attribute</param> * private static GraphType GetDefaultEdgeType(string defaultEdgeType) * { * GraphType determinedEdgeType = GraphType.Undirected; * * if (defaultEdgeType != null && defaultEdgeType.ToLower().Equals("directed")) * { * determinedEdgeType = GraphType.Directed; * } * * return determinedEdgeType; * }*/ /// <summary> /// Reads an XML node from the specified XmlReader /// </summary> /// <param name="reader">Reader from which to read the node from</param> private NodeMapData ReadNode(XmlReader reader, NodeTypes defaultNodeType) { NodeMapData objNode; string nodeId = reader.GetAttribute("id"); if (defaultNodeType == NodeTypes.Icon) { objNode = new IconNodeMapData(nodeId); } else { objNode = new TextNodeMapData(nodeId); } if (reader.ReadToDescendant("data")) { Attributes.Attribute newAttribute = null; AttributeValue newAttributeValue = null; // Loop over all data elements. These are the attributes do { // Record the attributes string dataKey = reader.GetAttribute("key"); string dataValue = reader.ReadElementContentAsString(); // Determine if we are dealing with a node property if (dataKey.StartsWith(NODE_PROPERTY_PREFIX)) { string propName = dataKey.Substring(NODE_PROPERTY_PREFIX.Length); switch (propName) { case "Description": objNode.Description = dataValue; break; case "DisplayValue": objNode.Label = dataValue; break; case "SelectionColor": SolidColorBrush selectionColor = Conversion.HexColorToBrush(dataValue); objNode.SelectionColor = selectionColor.Color; break; case "ImageSource": ((IconNodeMapData)objNode).ImageSource = new Uri(dataValue, UriKind.RelativeOrAbsolute); break; case "Height": double height = double.Parse(dataValue); objNode.Dimension = new Size(objNode.Dimension.Width, height); break; case "Width": double width = double.Parse(dataValue); objNode.Dimension = new Size(width, objNode.Dimension.Height); break; case "Position": string[] splitPosition = dataValue.Split(','); objNode.Position = new Point(double.Parse(splitPosition[0]), double.Parse(splitPosition[1])); break; case "IsHidden": objNode.IsHidden = bool.Parse(dataValue); break; case "BackgroundColor": SolidColorBrush backgroundColor = Conversion.HexColorToBrush(dataValue); objNode.BackgroundColor = backgroundColor.Color; break; default: // TODO prop is for a different version of SnagL break; } // TODO do we only want to do whats above when what is commented out below fails? /*// Attempt to set the node propety * if ((SetExportablePropertyValue(dataKey, objNode, dataValue))) * _logger.WriteLogEntry(LogLevel.INFO, string.Format("The Node property [{0}] was set to '{1}'", dataKey, dataValue), null, null); * else * { * // The property might be for the view model so try * // and set the view model * if ((SetExportablePropertyValue(dataKey, objNode, dataValue))) * _logger.WriteLogEntry(LogLevel.INFO, string.Format("The NodeVM property [{0}] was set to '{1}'", dataKey, dataValue), null, null); * else * _logger.WriteLogEntry(LogLevel.ERROR, string.Format("Unable to set the property [{0}] to the specified value [{1}]", dataKey, dataValue), null, null); * }*/ } else // Determine if we are dealing with an attribute { if (dataKey.StartsWith(NODE_ATTRIBUTE_PREFIX)) { // Determine if we are dealing with a descriptor or a value if (dataKey.EndsWith(ATTRIBUTE_DESCRIPTOR_SUFFIX)) { newAttribute = CreateAttribute(dataValue); } else if (dataKey.EndsWith(ATTRIBUTE_VALUE_SUFFIX)) { newAttributeValue = new AttributeValue(dataValue); } } else // If we are here, we are not dealing with SnagL formatted GraphML { // We are dealing with an unknown data element so we // are going to treat it like a new attribute // Determine if we are dealing with a descriptor or a value newAttribute = new Attributes.Attribute(dataKey); newAttributeValue = new AttributeValue(dataValue); } // Check if we have a valid Attribute and AttributeValue class if (newAttribute != null && newAttributeValue != null) { AttributeMapData objAttribute = new AttributeMapData(newAttribute.Name, newAttributeValue.Value); objNode.Attributes.Add(objAttribute.Name, objAttribute); objAttribute.SemanticType = newAttribute.SemanticType; objAttribute.SimilarityMeasure = newAttribute.PreferredSimilarityMeasure; objAttribute.IsHidden = !newAttribute.Visible; newAttribute = null; newAttributeValue = null; } } } while (reader.LocalName == "data" || (string.IsNullOrEmpty(reader.LocalName) && reader.ReadToNextSibling("data"))); } return(objNode); }