Avatar

Please consider registering
guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Related to TranslateBrowsePathToNodeID method
June 13, 2019
19:59, EEST
Avatar
Rakshan
Member
Members
Forum Posts: 30
Member Since:
June 2, 2019
sp_UserOfflineSmall Offline

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

June 14, 2019
14:11, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

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).

June 14, 2019
15:55, EEST
Avatar
Rakshan
Member
Members
Forum Posts: 30
Member Since:
June 2, 2019
sp_UserOfflineSmall Offline

Just to add on, Is the sequence given above correct? I am not able to figure out what will the return be?
The nodeid’s of Objects,crane,XX,YY?

I am not clear with the understanding. Even the material provided has not made it clear for me. Sorry

June 17, 2019
10:03, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

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):

BrowsePathTarget[] results = client.getAddressSpace().translateBrowsePathToNodeId(Identifiers.ObjectsFolder,

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 objects = client.getAddressSpace().getNode(craneNodeId);
UaNode xx = objects.getComponent(new QualifiedName(idx, "XX"));
UaNode yy = objects.getProperty(new QualifiedName(idx, "YY"));

And then operate on the UaNode objects.

Forum Timezone: Europe/Helsinki

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, Thomassnism

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1