OPC Studio User's Guide and Reference
UABrowsePath Class
Members  Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.Navigation Namespace : UABrowsePath Class
OPC-UA absolute browse path. A starting node, and sequence of browse path elements that denotes a path from the starting node in the OPC-UA address space.
Object Model
UABrowsePath ClassUABrowsePathElementCollection ClassUABrowsePathElement ClassUABrowsePath ClassUANodeDescriptor ClassUANodeId Class
Syntax
'Declaration
 
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath)>
<ComVisibleAttribute(True)>
<GuidAttribute("0FC7DFD3-0C59-46D2-BEDD-9514964943CF")>
<TypeConverterAttribute(OpcLabs.EasyOpc.UA.Navigation.Implementation.UABrowsePathConverter)>
<CLSCompliantAttribute(True)>
<ValueControlAttribute("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.455.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=False, 
   Export=True, 
   PageId=10001)>
<SerializableAttribute()>
Public NotInheritable Class UABrowsePath 
   Inherits OpcLabs.BaseLib.Info
   Implements LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable 
'Usage
 
Dim instance As UABrowsePath
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath)]
[ComVisible(true)]
[Guid("0FC7DFD3-0C59-46D2-BEDD-9514964943CF")]
[TypeConverter(OpcLabs.EasyOpc.UA.Navigation.Implementation.UABrowsePathConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.455.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public sealed class UABrowsePath : OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath)]
[ComVisible(true)]
[Guid("0FC7DFD3-0C59-46D2-BEDD-9514964943CF")]
[TypeConverter(OpcLabs.EasyOpc.UA.Navigation.Implementation.UABrowsePathConverter)]
[CLSCompliant(true)]
[ValueControl("OpcLabs.BaseLib.Forms.Common.ObjectSerializationControl, OpcLabs.BaseLibForms, Version=5.81.455.1, Culture=neutral, PublicKeyToken=6faddca41dacb409", 
   DefaultReadWrite=false, 
   Export=true, 
   PageId=10001)]
[Serializable()]
public ref class UABrowsePath sealed : public OpcLabs.BaseLib.Info, LINQPad.ICustomMemberProvider, OpcLabs.BaseLib.ComTypes._Info, OpcLabs.BaseLib.ComTypes._Object2, OpcLabs.EasyOpc.UA.Navigation.ComTypes._UABrowsePath, System.ICloneable, System.Runtime.Serialization.ISerializable, System.Xml.Serialization.IXmlSerializable  
Remarks

This object is filled in and returned e.g. when you browse the OPC server's address space.

There are implicit conversions from this type to:

 

Browse Paths In General

An alternative way (to using a node ID) of specifying a node in OPC address space is using a browse path. The browse path is a sequence of node names, starting from a known location (e.g. the root of the OPC address space). The browse path can also be expressed as a string, where the individual node names are separated by delimiters (e.g. “/”, a slash).

Browse paths can be absolute (starting from a specified node), or relative.

The advantage of the browse paths is that you can construct them yourself, with just knowledge of the node names, without knowing the full node IDs. In the end, each item must be addressed by its node ID, and OPC Studio components will resolve the browse path to a node ID as necessary.

OPC UA Browse Paths Specifics

In OPC Unified Architecture, each element of the browse path is not a simple string, but instead, it is a structured object (UABrowsePathElement) which contains more information that allows identifying the child node.

The OPC-UA browse path element contains a qualified name of the child node (a name qualified with a namespace URI), in the UABrowsePathElement.TargetName property. This allows ensuring the uniqueness of browse path elements in complex OPC-UA servers, such as when the address space is aggregated from multiple sources.

Because in OPC-UA there may be various references that lead from the parent node to a child node, the OPC-UA browse paths need to specify which type of reference should be used. This is done by the UABrowsePathElement.ReferenceTypeId property; in addition, it is possible to specify whether the reference should be followed in reverse direction (UABrowsePathElement.ReferenceIsInverse), and whether subtypes of the given reference type should also be considered.

An absolute browse path for OPC-UA is contained in a UABrowsePath object. The starting node of an OPC-UA browse path is contained in the UABrowsePath.StartingNodeId property. Browse paths are commonly specified by the BrowsePath property of the UANodeDescriptor object.

The UABrowsePath can be a null browse path, in case its StartingNodeId is a null node ID. A null browse path is used to specify that no browse path is known or given. Note that passing a null browse path object is different from passing a null reference to UABrowsePath (which is not allowed in most places).

If a non-null NodeId is specified in the descriptor, OPC Data Client will use this node Id and ignore the browse path. If NodeId is null, OPC Studio will attempt to resolve the browse path contained in the BrowsePath property of the descriptor. Either node ID, or browse path (or both) must be specified. 

 

Example
// This example shows how to read a Low state of a limit alarm. Note that you should not normally read a state of an alarm
// from inside its event notification, because the state might have already changed. Instead, include the information you
// need in the Select clauses when subscribing for the event.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
// OPC client and subscriber examples in C# on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-CSharp .
// Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
// a commercial license in order to use Online Forums, and we reply to every post.

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.AddressSpace;
using OpcLabs.EasyOpc.UA.Navigation;

namespace UADocExamples.AlarmsAndConditions
{
    class ReadAlarmState
    {
        public static void Main1()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer";

            UANodeDescriptor alarmNodeDescriptor = new UANodeId(
                namespaceUriString:"http://opcfoundation.org/Quickstarts/AlarmCondition", 
                identifier:"1:Colours/EastTank?Yellow");

            // Knowing the alarm node, and the fact that is an instance of NonExclusiveLevelAlarmType (or its subtype),
            // determine what is its LowState/Id node.
            UANodeDescriptor lowStateIdNodeDescriptor = new UABrowsePath(alarmNodeDescriptor,
                new []
                {
                    UABrowsePathElement.CreateSimple("ns=0;s=LowState"),
                    UABrowsePathElement.CreateSimple("ns=0;s=Id")
                });

            // Instantiate the client object.
            var client = new EasyUAClient();

            Console.WriteLine("Reading alarm state...");
            var lowStateId = (bool)client.ReadValue(endpointDescriptor, lowStateIdNodeDescriptor);

            Console.WriteLine($"Id of LowState: {lowStateId}");
        }
    }
}
' This example shows how to read a Low state of a limit alarm. Note that you should not normally read a state of an alarm
' from inside its event notification, because the state might have already changed. Instead, include the information you
' need in the Select clauses when subscribing for the event.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
' OPC client and subscriber examples in VB.NET on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-VBNET .
' Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
' a commercial license in order to use Online Forums, and we reply to every post.

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.AddressSpace
Imports OpcLabs.EasyOpc.UA.Navigation

Namespace AlarmsAndConditions
    Friend Class ReadAlarmState
        Public Shared Sub Main1()
            Dim endpointDescriptor As UAEndpointDescriptor =
                "opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer"

            Dim alarmNodeDescriptor As UANodeDescriptor = New UANodeId(
                namespaceUriString:="http://opcfoundation.org/Quickstarts/AlarmCondition",
                identifier:="1:Colours/EastTank?Yellow")

            ' Knowing the alarm node, and the fact that is an instance of NonExclusiveLevelAlarmType (or its subtype),
            ' determine what is its LowState/Id node.
            Dim lowStateIdNodeDescriptor As UANodeDescriptor = New UABrowsePath(alarmNodeDescriptor,
                New UABrowsePathElement() {
                    UABrowsePathElement.CreateSimple("ns=0;s=LowState"),
                    UABrowsePathElement.CreateSimple("ns=0;s=Id")
                })

            ' Instantiate the client object.
            Dim client = New EasyUAClient()

            Console.WriteLine("Reading alarm state...")
            Dim lowStateId = CBool(client.ReadValue(endpointDescriptor, lowStateIdNodeDescriptor))

            Console.WriteLine($"Id of LowState: {lowStateId}")
        End Sub
    End Class
End Namespace
# This example shows how to read a Low state of a limit alarm. Note that you should not normally read a state of an alarm
# from inside its event notification, because the state might have already changed. Instead, include the information you
# need in the Select clauses when subscribing for the event.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# Missing some example? Ask us for it on our Online Forums, https://www.opclabs.com/forum/index ! You do not have to own
# a commercial license in order to use Online Forums, and we reply to every post.
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.AddressSpace.Standard import *
from OpcLabs.EasyOpc.UA.AlarmsAndConditions import *
from OpcLabs.EasyOpc.UA.OperationModel import *


def eventNotification(sender, eventArgs):
    print()
    # Display the event.
    if eventArgs.EventData is None:
        print(eventArgs)
        return
    baseEventObject = eventArgs.EventData.BaseEvent
    print('Source name: ', baseEventObject.SourceName, sep='')
    print('Message: ', baseEventObject.Message, sep='')
    print('Severity: ', baseEventObject.Severity, sep='')


# Define which server we will work with.
endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:62544/Quickstarts/AlarmConditionServer')

# Instantiate the client object and hook events.
client = EasyUAClient()
client.EventNotification += eventNotification

print('Subscribing...')
IEasyUAClientExtension.SubscribeEvent(
    client,
    endpointDescriptor,
    UANodeDescriptor(UAObjectIds.Server),
    1000)

print('Processing event notifications for 30 seconds...')
time.sleep(30)

print('Unsubscribing...')
client.UnsubscribeAllMonitoredItems()

print('Waiting for 5 seconds...')
time.sleep(5)

print('Finished.')
Inheritance Hierarchy

System.Object
   OpcLabs.BaseLib.Object2
      OpcLabs.BaseLib.Info
         OpcLabs.EasyOpc.UA.Navigation.UABrowsePath

Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also