Skip to main content

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 node.get(browseName).
  • This is a must-have for batch initializing 100+ paths API.

Signature​

public List<TranslateResult> translateBrowsePaths(
List<Map.Entry<String, String>> paths);

// Convenient Reloading from the Same Starting Point
public List<TranslateResult> translateBrowsePathsAt(
String startingNodeId, List<String> browsePaths);

TranslateResult field​

MethodsReturnNote
getNodeId()String (failure: null)As determined by the analysis, NodeId
getStatus()Enums.StatusCodeGood = Parsing successful

Usage​

Mixed Paths with Different Starting Points​

import java.util.AbstractMap;
import java.util.Arrays;

List<Map.Entry<String, String>> paths = Arrays.asList(
new AbstractMap.SimpleImmutableEntry<>("i=85" /* Objects */, "/Server/ServerStatus/CurrentTime"),
new AbstractMap.SimpleImmutableEntry<>("i=85", "/Server/ServerStatus/State"),
new AbstractMap.SimpleImmutableEntry<>("ns=2;s=Boiler1", "/Temperature"),
new AbstractMap.SimpleImmutableEntry<>("ns=2;s=Boiler1", "/Pressure"));

List<TranslateResult> results = ua.translateBrowsePaths(paths);
for (TranslateResult r : results) {
if (r.getStatus() == Enums.StatusCode.Good) {
System.out.println("OK: " + r.getNodeId());
} else {
System.out.println("Fail: " + r.getStatus());
}
}

Convenient Reloading from the Same Starting Point​

List<String> children = Arrays.asList(
"/Temperature", "/Pressure", "/FlowRate");
List<TranslateResult> results = ua.translateBrowsePathsAt("ns=2;s=Boiler1", children);

BrowsePath Segment Format​

FormatMeaning
BrowseNamens=0 Default
ns:BrowseNameSpecify NamespaceIndex
/seg1/seg2/seg3Multiple segments, separated by /

Example:

BrowsePathMeaning
/Serverns=0 Child node Server
/2:Boiler1ns=2 Child node Boiler1
/Server/2:Boilers/2:Boiler1/2:TemperatureMulti-layer Combination

Comparison with resolve​

APIRPC Number of timesApplicable
resolve(path)1 (Internal route— TranslateBrowsePaths single track)Occasional use, single path
translateBrowsePaths(paths)1100+ Paths in Bulk
Chained index: node.get(a).get(b).get(c)N (once per segment Browse)Exploratory

Initializing 100 tags: NodeId Parse them all at once translateBrowsePaths in a single batch RPC; resolve if you use a loop, process each tag one at a time RPC (see the table above). The amount of time saved varies depending on your network and server; test it in your own environment to determine the exact savings.

Next Step​