Package gavo :: Package dm :: Module common
[frames] | no frames]

Module common

source code

Common code for new-style Data Model support.

In particular, this defines a hierachy of Annotation objects. The annotation of DaCHS tables is an ObjectAnnotation, the other Annotation classes (conceptually, all are key-value pairs) make up their inner structure.

Classes
  AnnotationBase
A base class for of structs.
  TableRelativeAnnotation
A base class for annotations that must be adapted or discarded when an annotation is copied.
  AtomicAnnotation
An annotation of an atomic value, i.e., a key-value pair.
  DatatypeAnnotation
An annotation for a datatype.
  ObjectAnnotation
An annotation for an object.
  CollectionAnnotation
A collection contains 0..n things of the same type.
Functions
 
containerTypeSet(*args, **kwds)
a context manager to control the type currently serialised in a VOTable.
source code
 
completeVODMLId(ctx, roleName)
completes roleName to a full (standard) vo-dml id.
source code
 
parseTypeName(typename)
returns modelname, package (None for the empty package), name for a VO-DML type name.
source code
Variables
  VODML_NAME = 'vo-dml'
  __package__ = 'gavo.dm'
Function Details

containerTypeSet(*args, **kwds)

source code 

a context manager to control the type currently serialised in a VOTable.

ctx is a VOTable serialisation context (that we liberally hack into).

Decorators:
  • @contextlib.contextmanager

completeVODMLId(ctx, roleName)

source code 

completes roleName to a full (standard) vo-dml id.

This is based on what the containerTypeSet context manager leaves in the VOTable serialisation context ctx.

parseTypeName(typename)

source code 

returns modelname, package (None for the empty package), name for a VO-DML type name.

Malformed names raise a ValueError.

>>> parseTypeName("dm:type")
('dm', None, 'type')
>>> parseTypeName("dm:pck.type")
('dm', 'pck', 'type')
>>> parseTypeName(":malformed.typeid")
Traceback (most recent call last):
ValueError: ':malformed.typeid' is not a valid VO-DML type name