nineml.abstraction_layer.component.NamespaceAddress

class nineml.abstraction_layer.component.NamespaceAddress(loc)
__init__(loc)

Methods

__init__(loc)
concat(*args) Concatenates all the Namespace Addresses.
create_root() Returns a empty (root) namespace address
get_local_name() Returns the local reference; i.e.
get_parent_addr() Return the address of an namespace higher
get_str_prefix([join_char]) Returns the same as getstr, but prepends the join_char to the end of the string, so that the string can be used to prefix variables.
get_subns_addr(component_name) Returns the address of a subcomponent at this address.
getstr([join_char]) Returns the namespace address as a string.
is_root_namespace()
classmethod concat(*args)

Concatenates all the Namespace Addresses.

This method take all the arguments supplied, converts each one into a namespace object, then, produces a new namespace object which is the concatenation of all the arguments’ namespaces.

For example:

>>> NamespaceAddress.concat('first.second','third.forth','fifth.sixth')
    NameSpaceAddress: '/first/second/third/forth/fifth/sixth'
classmethod create_root()

Returns a empty (root) namespace address

>>> nineml.abstraction_layer.NamespaceAddress.create_root()
NameSpaceAddress: '//'    
get_local_name()

Returns the local reference; i.e. the last field in the address, as a string

get_parent_addr()

Return the address of an namespace higher

>>> a = NamespaceAddress('level1.level2.level3')
>>> a
NameSpaceAddress: '/level1/level2/level3/'
>>> a.get_parent_addr()
NameSpaceAddress: '/level1/level2/'
get_str_prefix(join_char='_')

Returns the same as getstr, but prepends the join_char to the end of the string, so that the string can be used to prefix variables.

Parameters:join_char – The character used to join the levels in the address.
get_subns_addr(component_name)

Returns the address of a subcomponent at this address.

For example:

>>> a = NamespaceAddress('level1.level2.level3')
>>> a.get_subns_addr('subcomponent')
NameSpaceAddress: '/level1/level2/level3/subcomponent/'
getstr(join_char='_')

Returns the namespace address as a string.

Parameters:join_char – The character used to join the levels in the address.
is_root_namespace()