Package gavo :: Package adql :: Module annotations
[frames] | no frames]

Module annotations

source code

Adding field infos to columns and other objects in an ADQL parse tree.

When we want to generate VOTables from ADQL queries, we must know types, units, ucds, and the like, and we need to know STC information for all columns in a query.

To do that, we traverse the parse tree postorder looking for nodes that have an addFieldInfos method (note the plural). These then get called, which causes one of the classes in adql.fieldinfos to be constructed and assigned to the node's fieldInfos attribute. The source for these infos is either an AnnotationContext (and thus typically the user-supplied retrieveFieldInfos function) or derived annotations. These are computed by the nodes themselves, using their addFieldInfo (singular!) method.

Classes
  AnnotationContext
An context object for the annotation process.
Functions
 
annotate(node, context)
adds annotations to all nodes wanting some.
source code
 
dumpFieldInfoedTree(tree)
dumps an ADQL parse tree, giving the computed annotations.
source code
Variables
  __package__ = 'gavo.adql'
Function Details

annotate(node, context)

source code 

adds annotations to all nodes wanting some.

This is done by a postorder traversal of the tree, identifying all annotable objects.

context can be an AnnotationContext instance. You can also just pass in a adql.FieldInfoGetter instance. In that case, annotation runs with the default stc equivalence policy.

The function returns the context used in any case.

dumpFieldInfoedTree(tree)

source code 

dumps an ADQL parse tree, giving the computed annotations.

For debugging.