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

Module dmrd

source code

Writing annotations in RDs.

This module provides the glue between annotations (typically in SIL) and the rest of the RDs. It provides the ResAnnotation struct, which contains the SIL, and the makeAttributeAnnotation function at is a factory for attribute annotations.

Classes
  SynthesizedRoles
DM annotation copied and adapted to a new table.
  DataModelRoles
an annotation of a table in terms of data models.
  DataModelRolesAttribute
an attribute allowing data model annotation using SIL.
Functions
 
makeAttributeAnnotation(container, instance, attName, attValue)
returns a typed annotation for attValue within container.
source code
 
getAnnotationMaker(container)
wraps makeAttributeAnnotationMaker such that names are resolved within container.
source code
Variables
  __package__ = 'gavo.dm'
Function Details

makeAttributeAnnotation(container, instance, attName, attValue)

source code 

returns a typed annotation for attValue within container.

When attValue is a literal, this is largely trivial. If it's a reference, this figures out what it points to and creates an annotation of the appropriate type (e.g., ColumnAnnotation, ParamAnnotation, etc).

container in current DaCHS should be a TableDef or something similar; this function expects at least a getByName function and an rd attribute.

instance is the root of the current annotation. Complex objects should keep a (weak) reference to that. We don't have parent links in our dm trees, and without a reference to the root there's no way we can go "up".

This is usually used as a callback from within sil.getAnnotation and expects Atom and Reference instances as used there.