Common code for new-style Data Model support.

In particular, this defines a hierarchy 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.

class, instance)[source]

Bases: object

A base class for of structs.

Basically, these are pairs of a role name and something else, which depends on the actual subclass (e.g., an atomic value, a reference, a sequence of key-value pairs, a sequence of other objects, …).

They have a method getVOT(ctx, instance) -> xmlstan, which, using a votablewrite.Context ctx, will return mapping-document conformant VOTable xmlstan; instance is the rsc/rscdef structure the annotation is produced for.

Use asSIL() to retrieve a simple string representation.

Compound annotations (sequences, key-value pairs) should use add(thing) to build themselves up.

AnnotationBase is abstract and doesn’t implement some of these methods.

getVOT(ctx, instance)[source]
class, value=None, unit=None, ucd=None, instance=None)[source]


An annotation of an atomic value, i.e., a key-value pair.

These can take optional metadata.

getVOT(ctx, instance)[source]
class, type, instance)[source]


A collection contains 0..n things of the same type.

getVOT(ctx, instance)[source]
class, type, instance)[source]


An annotation for a datatype.

Datatypes are essentially simple groups of attributes; they are used within objects (e.g., to group photometry points, or positions, or the like.

class, type, instance)[source]


An annotation for an object.

Objects are used for actual DM instances. In particular, every annotation of a DaCHS table is rooted in an object.

class, instance)[source]


A base class for annotations that must be adapted or discarded when an annotation is copied., roleName)[source]

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., typeName)[source]

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

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

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