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:
15 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: 736
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1524
Posts: 6450
Newest Members:
kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley, ThomassnismModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0
Administrators: admin: 1