NameSpace API

A names pace makes content from an odML document available in other documents. A name space object therefore provided an URI to the odML document to include and a prefix. The prefix can be used to address content from the included document from the referencing one.

class odml2.NameSpace(prefix, uri)

Create a new namespace object.

Parameters:
  • prefix (str) – The prefix used to reference the linked document.
  • uri (str) – The URI or path to the linked document.
copy(prefix=None, uri=None)

Since instances of NameSpace should be treated as immutable objects the copy() method can be used as an alternative to change the objects attributes.

Just reassign a modified copy:

ns = doc.namespaces["gnode"]
doc.namespaces["gnode"] = ns.copy(uri="gnode-terms.yml")
Parameters:
  • prefix (str) – The prefix used to reference the linked document.
  • uri (str) – The URI or path to the linked document.
Returns:

A (modified) copy of the name space.

get_document()

Try to open the document the uri of the name space points to.

Returns:The odML document the uri points to.
Return type:Document
prefix

The prefix used to reference the linked document.

Type:str
uri

The uri to the linked document.

Type:str

Navigation