TranslateBrowsePaths
TranslateBrowsePathsToNodeIds The service parses the "BrowsePath string" in batches NodeIdin a single pass RPC; a loop, on Resolve the other hand, processes each tag one at a time RPC.
Prerequisite Reading
- For chained exploration, we recommend using OpcUaNode Indexer.
- Use this method when parsing a batch of paths at once ( API single RPC); if
Resolveyou send them one by one RPC, the number of round trips will skyrocket when there are many paths.
Signature
public IReadOnlyList<TranslateResult> TranslateBrowsePaths(
IReadOnlyList<(string startingNodeId, string browsePath)> paths);
TranslateResult field
public sealed class TranslateResult
{
public string NodeId { get; init; } // null when parsing fails
public StatusCode Status { get; init; }
}
Usage
var paths = new[]
{
("i=85" /* Objects */, "/Server/ServerStatus/CurrentTime"),
("i=85", "/Server/ServerStatus/State"),
("ns=2;s=Boiler1", "/Temperature"),
("ns=2;s=Boiler1", "/Pressure"),
};
var results = ua.TranslateBrowsePaths(paths);
foreach (var r in results)
{
if (r.Status == StatusCode.Good)
Console.WriteLine($"OK: {r.NodeId}");
else
Console.WriteLine($"Fail: {r.Status}");
}
BrowsePath Segment Format
| Format | Meaning |
|---|---|
| BrowseName | ns=0 Default |
| ns:BrowseName | Specify NamespaceIndex (2:Boiler1 Boiler1 under = ns=2) |
| /seg1/seg2/seg3 | Multiple lines; lines beginning / with / are ignored, and consecutive are also // ignored |
Example:
| BrowsePath | Meaning |
|---|---|
| /Server | ns=0 Child node Server |
| /2:Boiler1 | ns=2 Child node Boiler1 |
| /Server/2:Boilers/2:Boiler1/2:Temperature | Multi-layer Combination |
Implementation Restrictions (Listed Accurately, Item by Item)
- The citation type for each section isHard-coded:
HierarchicalReferences (i=33)+IsInverse=false+IncludeSubtypes=true. Does not support reverse references; does not support specifying other reference types - A passage that only recognizesFirst Targets that match exactly; intermediate results that are cut off before the path is completed do not count as hits.
- Longest Name in a Single Segment 255 Characters, exceededThis path Parsing failed (does not affect other items in the same batch)
- Results and Input ParametersEqual in Length and Order; The term that cannot be factored
NodeIdisnull, checkStatusto find out why - If the initial NodeId string cannot be parsed locally, a placeholder SDK will be used NodeId to send the request; the final result for this item is determined
Statusby the server's response. Items for which the server did not return a status areBadNodeIdInvalid - Only discard if the entire batch RPC fails
OpcUaException; do not discard if a single item fails.
Comparison with Resolve
| API | RPC Number of times | Applicable |
|---|---|---|
| Resolve(path) | The number of segments in the path equals the number of times Browse (Segment by segment analysis; skipping this part TranslateBrowsePaths) | Used occasionally; the path is very short |
| TranslateBrowsePaths(paths[]) | 1 (regardless of the number of paths or their depth) | Multiple paths / Deep path structure |
| Chain Indexer node[a][b][c] | N (once per segment Browse) | Exploratory |
Initial parsing of a batch of tags can be completed RPC in a single TranslateBrowsePaths batch, reducing the number of round trips from "number of entries × number of segments" to 1. The amount of time saved varies depending on the network and server; please test this in your own environment.