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, EEST
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, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 491
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, EEST
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, EEST
Avatar
Matti Siponen
Moderator
Members

Moderators
Forum Posts: 8
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, EEST
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: 267

Currently Online:
11 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 93

pramanj: 86

ibrahim: 69

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

Thomas Reuther: 26

Member Stats:

Guest Posters: 0

Members: 990

Moderators: 13

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 945

Posts: 3987

Newest Members:

jerrodharness1, chandrahollis, kandimilano0008, deonbracewell, swati kulha, muoipoupinel64, lannybroadway, 12315544121666, Joel Mariadasan, alfonsobarringto

Moderators: Jouni Aro: 837, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 491, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 18, Markus Johansson: 11, Matti Siponen: 8

Administrators: admin: 0