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
Is it possible to get the ObjectTypes NodeID by Objects NodeID
March 3, 2020
12:30, EET
Avatar
c70015@gmail.com
Member
Members
Forum Posts: 6
Member Since:
January 7, 2020
sp_UserOfflineSmall Offline

Hi all,
If I would like use [A ParameterSet] NodeID to get [ParameterSet ] ObjectTypes NodeID, but it seem like doesn’t store such information.

Is it possible to get the ObjectTypes NodeID by Objects NodeID? How to do it? Thanks.

For example:

Root —
———-|
———-Objects —
———————– |
———————–AAA (MotionDeviceType) —
————————————————————|
———————————————————-A ParameterSet —-
———————————————————————————– |
———————————————————————————–SpeedOverride

———- Types —
———————–|
———————– ObjectTypes —
——————————————- |
——————————————-MotionDeviceType —-
———————————————————————-|
———————————————————————- ParameterSet —-
———————————————————————————————-|
———————————————————————————————-SpeedOverride

March 3, 2020
15:41, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1027
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Please clarify the “picture” with some numeric ids, i.e. specifically from which node to which you would like to go. Also is this client or server side?

Anyway in either case assuming you meant that you want to know the TypeDefintion of an instance of that type, then assuming you have the UaNode for that instance, you can cast the UaNode to UaInstance and call UaInstance.getTypeDefinition() or getTypeDefinitionId() for it.

March 3, 2020
18:13, EET
Avatar
c70015@gmail.com
Member
Members
Forum Posts: 6
Member Since:
January 7, 2020
sp_UserOfflineSmall Offline

Hi ,
I have created AAA Object with type definition MotionDeviceType by client SDK, and it will generate mandatory properties (such as ParameterSet and SpeedOverride) in Objects folder. If I get the node ID of AAA Object and query its type definition, it will return the nodeID of MotionDeviceType below ObjectsTypes folder. But if I get the node ID of ParameterSet Object and query its type definition, it will return the BaseObjectType or PropertyType, NOT the Node ID of ObjectType.

March 4, 2020
9:42, EET
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 346
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline

Hello,

The ObjectType of ParameterSet is BaseObjectType. Instead of trying to find the NodeId of the ObjectType of an Object Node, could it be that what you actually want to find is the NodeId of the InstanceDeclaration of the Node called “A ParameterSet” in your figure?

Complex ObjectTypes, such as MotionDeviceType, can declare References to other Nodes with predetermined BrowseNames and TypeDefinitions. While these InstanceDeclaration Nodes can be Referenced by ObjectTypes and VariableTypes, they themselves are not ObjectType or VariableType Nodes.

If you wish to find the NodeId of the InstanceDeclaration that “A ParameterSet” is based on, you need to take the following steps:

1. Store the BrowseName of “A ParameterSet”, you will need it later for comparison. You can get the BrowseName with AAA.getParameterSetNode().getBrowseName().
2. Find the ObjectType Node targeted by “AAA” with HasTypeDefinition Reference. You can do this with AAA.getTypeDefinition().
3. Browse the MotionDeviceType for References with AAA.getTypeDefinition().getReferences().
4. Find a Node amongst the References with the same BrowseName as “A ParameterSet”. You can compare BrowseNames with equals().
5. This Node is the InstanceDeclaration you’re looking for and you can get its NodeId with getNodeId().

This is how you would do it in your specific case. However, the general case of finding an InstanceDeclaration’s NodeId based on a NodeId of its instance is a complex algorithm to implement especially when subtyping is involved.

Are you looking for the general algorithm or just a solution for this specific case?

BR,

Matti

March 4, 2020
12:26, EET
Avatar
c70015@gmail.com
Member
Members
Forum Posts: 6
Member Since:
January 7, 2020
sp_UserOfflineSmall Offline

Matti Siponen said
Hello,

The ObjectType of ParameterSet is BaseObjectType. Instead of trying to find the NodeId of the ObjectType of an Object Node, could it be that what you actually want to find is the NodeId of the InstanceDeclaration of the Node called “A ParameterSet” in your figure?

Complex ObjectTypes, such as MotionDeviceType, can declare References to other Nodes with predetermined BrowseNames and TypeDefinitions. While these InstanceDeclaration Nodes can be Referenced by ObjectTypes and VariableTypes, they themselves are not ObjectType or VariableType Nodes.

If you wish to find the NodeId of the InstanceDeclaration that “A ParameterSet” is based on, you need to take the following steps:

1. Store the BrowseName of “A ParameterSet”, you will need it later for comparison. You can get the BrowseName with AAA.getParameterSetNode().getBrowseName().
2. Find the ObjectType Node targeted by “AAA” with HasTypeDefinition Reference. You can do this with AAA.getTypeDefinition().
3. Browse the MotionDeviceType for References with AAA.getTypeDefinition().getReferences().
4. Find a Node amongst the References with the same BrowseName as “A ParameterSet”. You can compare BrowseNames with equals().
5. This Node is the InstanceDeclaration you’re looking for and you can get its NodeId with getNodeId().

This is how you would do it in your specific case. However, the general case of finding an InstanceDeclaration’s NodeId based on a NodeId of its instance is a complex algorithm to implement especially when subtyping is involved.

Are you looking for the general algorithm or just a solution for this specific case?

BR,

Matti  

Hi,
Thanks for your suggestion. Finally , we decide to solve this problem after adding new node and do something.
1. I got the MotionDeviceType Object type to create AAA object and save this Object type Node ID in HasDescription Reference type.
2. Query all subtype of this Object type ID recursively that I will get it’s all references and save them as well.
3. Compare the browse name of A ParameterSet and speedoverride properties and save the object type ID in HasDescription Reference type of them as well.

It works for me. Thanks.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
52 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: 739

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6453

Newest Members:

shaylamaggard4, rickyjuarez140, jonathonmcintyre, fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons

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

Administrators: admin: 1