Skip to content
olaurino edited this page May 2, 2014 · 4 revisions

Requirements and Design

Python VODML Specifications (Python specs).

A Python spec is a class definition created with a declarative approach, and used to perform VODML operations.

For instance:

class Galaxy(ObjectType):
  vodml_id = “Galaxy”
  model_id = “eg” # A fictitious model for extragalactic objects
  model_version = “1.0"
  name = Attribute(datatype=“ivoa:string”,
                              doc=“the common names of the galaxy. Array.”,
                              vodml_id=“Galaxy.names”,
                              multiplicity=(0,-1))
  classification = Enumeration(datatype=“GalaxyClassEnum",
                              doc=“the Hubble class of the galaxy”,
                              vodml_id=“Galaxy.class”)
  redshift = Composition(datatype=“Redshift”,
                         doc=“the galaxy’s redshift. Multiple redshifts are allowed.”,
                         vodml_id=“Galaxy.redshifts”,
                         multiplicity=(0,-1))

can be a simple example of a Python spec for a type in a fictitious model. The Python spec does not contain any methods, only attribute definitions. A class can indeed contain both a Python spec and methods, as well as non-vodml field declarations. In such cases the Python spec is “embedded” in the more generic Python class definition, and only the Python spec is used when VODML operations are applied (e.g. for serialization).

The above code is just an example of a possible format for the Python spec. The requirement is that the spec must be purely declarative, and that a Python spec can be embedded in a common Python class.

Requirements

VODML/XML generation:

  • Given a Python VODML specification, generate the corresponding VODML/XML instance(s).

Code Generation:

  • Given a VODML/XML description, generate corresponding Python specifications.
  • Resolve model dependencies and generate code for the imported models.
  • VODML fields shall be transparent when the user gets or sets the corresponding value.
  • VODML fields shall be "smart" and check the constraints of the values set by the users, to enforce data consistency.

Serialization I/O:

  • For a defined serialization mapping, and assuming that classes representing a model are in the Python path, instantiate objects corresponding to the serialization mapping selected.
  • When deserializing an interoperable instance, if the models declared in the instance are not present in the Python path, VOLIB shall create the code in a directory inside the Python path.
  • For a defined serialization mapping, given a Python instance of a VODML class, create a file, or set of files, that comply with the serialization mapping.
  • Serialization mappings: VOTable

Constraints

Model IDs are assumed globally unique, so they unambiguously identify a model.

Useful links

VODML WD

Mapping to VOTable WD