19:59, EEST
June 2, 2019
Hi,
Went through the tutorials of OPCUA. Not very clear with the above method and its outcome.
If i have a tree of Root>Objects>Crane>XX>YY, , with YY being the final leaf node, what will TranslateBrowsePathToNodeID give me if i put it in a below mentioned way?
BrowsePath [] results = client.getAddressSpace().translateBrowsePathToNodeId(Identifiers.ObjectsFolder,
new RelativePathElement(Identifiers.HierarchicalReferences,false,true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url),”XX”)),
new RelativePathElement(
Identifiers.HierarchicalReferences,
false, true, new QualifiedName(
client.getAddressSpace().getNamespaceTable().getIndex(url), “YY”)));
Looking forward for a supportive response
14:11, EEST
April 3, 2012
Hi,
It will give the NodeIds that matched the request. You can look at the extact logic given in the OPC UA Specification 1.04 Part 4 section 5.8.4 TranslateBrowsePathsToNodeIds (https://opcfoundation.org/developer-tools/specifications-unified-architecture).
10:03, EEST
April 3, 2012
Exactly like that it would not compile as the return type would be BrowsePathTarget[]. Also you are missing the “Crane” step so you would not get results.
Assuming you’ll fix it to something like this, and the url is the equivalent namespaceuri for the QualifiedNames of the nodes, it will return all possible targets having that path (assuming you have only a single YY node below XX, it would return one result):
new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "Crane")),
new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "XX")),
new RelativePathElement(Identifiers.HierarchicalReferences, false, true,
new QualifiedName(client.getAddressSpace().getNamespaceTable().getIndex(url), "YY")));
ExpandedNodeId target = results[0].getTargetId();
Most of the time working with the JavaSDK, you shouldn’t need to use that method often. Most likely normally you would know the NodeId of the Crane node in this case, and you could use e.g. (Assuming XX is attached via HasComponent Reference to the Crane node and YY via HasProperty to the XX, and the idx would be the correct namespaceindex for the namespace in which they are):
UaNode xx = objects.getComponent(new QualifiedName(idx, "XX"));
UaNode yy = objects.getProperty(new QualifiedName(idx, "YY"));
And then operate on the UaNode objects.
Most Users Ever Online: 1919
Currently Online:
34 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 729
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1