Skip to content

Commit

Permalink
Add a warning that the AS contains nodes orphaned and inaccessible fo…
Browse files Browse the repository at this point in the history
…r browsing starting from the Root node #529

- prototyping with XMLModelsProblemsToReportUnitTest.cs
- Added errors to signal that nodes have been duplicated (have same NodeId)
- working copy
  • Loading branch information
mpostol committed Feb 21, 2021
1 parent dc53d36 commit 808969e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ internal class NodeFactoryBase : NodesContainer, INodeFactory
/// <value>The BrowseName of the node.</value>
public string BrowseName
{
set { }
set; get;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ public void eoursel510Test()
List<IUANodeContext> orphanedNodes = new List<IUANodeContext>();
foreach (IUANodeContext item in allNodes)
{
if (!nodesDictionary.ContainsKey(item.BrowseName.Name))
if (!nodesDictionary.ContainsKey(item.BrowseName.ToString()))
{
orphanedNodes.Add(item);
Debug.WriteLine($"The following node has been removed from the model: {item.ToString()}");
}
}
Debug.WriteLine($"After removing inherited and instance declaration nodes the recovered information model contains {nodes.Count<NodeFactoryBase>()}");
Debug.WriteLine($"The recovered information model contains {nodes.Count<NodeFactoryBase>()} nodes");
Debug.WriteLine($"The source information model contains {allNodes.Count<IUANodeContext>()} nodes");
Debug.WriteLine($"Number of nodes not considered for export {orphanedNodes.Count<IUANodeContext>()}");
}
}

Expand Down
10 changes: 8 additions & 2 deletions SemanticData/UANodeSetValidation/AddressSpaceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,14 @@ private Uri ImportNodeSet(UANodeSet model)
IUAModelContext _modelContext = model.ParseUAModelContext(m_NamespaceTable, m_TraceEvent.TraceEvent);
m_TraceEvent.TraceEvent(TraceMessage.DiagnosticTraceMessage($"Entering AddressSpaceContext.ImportNodeSet - starting import {_modelContext}."));
m_TraceEvent.TraceEvent(TraceMessage.DiagnosticTraceMessage("AddressSpaceContext.ImportNodeSet - the context for the imported model is created and starting import nodes."));
foreach (UANode _nd in model.Items)
ImportUANode(_nd);
Dictionary<string, UANode> itemsDictionary = new Dictionary<string, UANode>();
foreach (UANode node in model.Items)
{
if (itemsDictionary.ContainsKey(node.NodeId.ToString()))
m_TraceEvent.TraceEvent(TraceMessage.BuildErrorTraceMessage(BuildError.NotSupportedFeature, $"{node.ToString()} has been duplicated in the imported model and is removed from further processing"));
else
ImportUANode(node);
}
m_TraceEvent.TraceEvent(TraceMessage.DiagnosticTraceMessage($"Finishing AddressSpaceContext.ImportNodeSet - imported {model.Items.Length} nodes."));
return _modelContext.ModelUri;
}
Expand Down

0 comments on commit 808969e

Please sign in to comment.