gavo.votable.modelgroups module

Legacy data model related code.

This is legacy stuff. Cool folks would use the stuff from gavo.dm. When there’s actually something useful to be done with it.

This is intended for STC groups and possibly similarly handled data models.

Basically, these come in groups with certain utypes; these in turn contain FIELDRefs and INFOs specifying utype-value pairs.

The idea here is to have [un]marshal_DMNAME functions in here that expect some defined top-level element. In the case of STC, that top-level element is the table, but other elements are conceivable.

To keep the library working even without the STC package, the stc import is protected by a try…except clause. You can check the availability of STC by inspecting modelgroups.stcAvailable.

gavo.votable.modelgroups.marshal_STC(ast, getIdFor)[source]

returns an stc:CatalogEntryLocation group for ast.

ast is an AST object from GAVO’s STC library.

getIdFor must be a function returning the id for an stc.ColRef object. The main issue here is that the STC library deals with unqualified column names. These may clash when several tables are combined within a VOTable. Thus, you will have to have some mechanism to generate unique ids for the FIELDs (e.g. using utils.IdManagerMixin). getIdFor must resolve ColRefs (with column names in their dest) to unique ids.

gavo.votable.modelgroups.unmarshal_STC(tableNode)[source]

iterates over pairs of (colInfo, system) pairs of STC information on tableNode.

system are STC ASTs; colInfo maps column ids to the column utype in system.