Chapter 1. Purpose of this document.

This document recapitulates the entities defined in the Alma Science Data Model (ASDM) from a programmer's perspective. For each attribute of each ASDM entity, it provides its name , its types in the C++ and Java implementations. When this attribute happens to be an array, the shape (i.e. the sizes of all dimensions) is also provided as long as it can be expressed in a simple way.

How to read the catalog.

Types.

A type is expressed by using the exact syntaxes of Java and C++ :

  • In Java, it consists of a basic type or class name possibly followed by a number of '[]' pairs when the attribute is an array; the number of '[]' pairs gives the number of dimensions of the array.
  • In C++, it's a basic type or class name for scalar attributes. Arrays are implemented as vectors; a 1D array of T (T being a basic type or class name) is declared as vector <T>, a 2D array of T as <vector<vector T> > and so on as the number of dimensions grows up.

Shapes.

A shape is a comma separated list, possibly empty, of arithmetic expressions whose operands can be integer values, names of attributes of the same entity or names of attributes of another entity; in the latter case, the attribute name is prefixed by the entity name. Examples of shapes are "2" or "numPoly+1,2" or "Feed.numReceptors, numPoly".

A shape must be understood as the list of dimensions sizes read from the left to the right. For example a shape "numPoly+1,2" for an array of int defined for some attribute of an entity A corresponds to :

  • a Java array of numPoly+1 arrays of 2 int,
  • a C++ vector of numPoly+1 vectors of 2 int.

Note that in that case numPoly refers to an attribute of A.

When a shape refers to an attribute of the same entity.

This is the simplest case; the get method defined for that attribute on the entity's instance returns its value and the array's size is known. The Feed entity's attribute receiverId is an illustration of such a case :
NameJava typeC++ typeArray's shape
numReceptorsintint 
....
....
receiverIdint[]vector < int >numReceptors
the method getNumReceptors() applied on the entity's instance returns the value of the attribute numReceptors for that instance and therefore the size of the (1D array) attribute receiverId.

When a shape refers to an attribute of another entity.

When a shape defined for an attribute of an entity A refers to an attribute which belongs to another entity B, it's always possible to retrieve which instance of entity B must be considered since amongst its attributes the entity A always have the ones which form the key of entity B. As an example consider the Main entity and its attribute stateId :

NameJava typeC++ typeArray's shape
configDescriptionIdTagTag 
....
....
stateIdTag[]vector < Tag >ConfigDescription.numAntenna

stateId is a 1D array of Tag and its size is specified as "ConfigDescription.numAntenna"; but one can also see that the Main entity has a configDescriptionId attribute, key of the ConfigDescription entity. Using the value of this configDescriptionId attribute it's possible to retrieve the relevant ConfigDescription instance (using the getRowByKey method of the ConfigDescriptionTable) and finally the value of its numAntenna attribute.

Examples.

Example 1.1. A simple example without a shape.

In the DataDescrition entity we find :
NameJava typeC++ typeArray's shape
spectralWindowIdTagTag 
In that example, spectralWindowId attribute of the DataDescription entity is of type Tag in Java and C++; it is scalar hence the empty shape.

Example 1.2. A shape referring to an attribute of the same entity.

In the Polarization entity we find :
NameJava typeC++ typeArray's shape
numCorrintint 
corrTypeint[]vector < int >numCorr
corrProductint[][]vector < vector < int > >numCorr,2
In this example a scalar integer attribute numCorr is firstly described and then two attributes corrType and corrProduct respectively 1D and 2D arrays of integer.

The shape of corrType refers to numProduct which is an attribute of the same entity, in other words the following logical expressions in Java and in C++ :

// -----------------Java------------------------------------
// Let's assume that pRow is a Java instance of PolarizationRow 
// added to the PolarizationTable of an ASDM.
pRow.getCorrType().length == pRow.getNumCorr();

// -----------------C++------------------------------------					
// Let's assume that pRow is a C++ instance of PolarizationRow 
// added to the PolarizationTable of an ASDM.
pRow.getCorrType().size() == pRow.getNumCorr();
					

should both evaluate to true.

The shape of CorrProduct refers to numProd as being the size of its first dimension, 2 being the size of the second. Upon execution of the following snippets of Java and C++ code:

// -----------------Java------------------------------------
// Let's assume that pRow is a Java instance of PolarizationRow 
// added to the PolarizationTable of an ASDM.
boolean sameSize1 = pRow.getCorrProduct().length == pRow.getNumCorr();
boolean sameSize2 = true;
for (int i = 0; i < pRow.getCorrProduct().length; i++)
	sameSize2 = sameSize2 && (pRow.getCorrProduct()[i].length == 2);
			
// -----------------C++------------------------------------		
// Let's assume that pRow is a C++ instance of PolarizationRow 
// added to the PolarizationTable of an ASDM.
bool sameSize1 = pRow.getCorrProduct().size() == pRow.getNumCorr();
bool sameSize2 = true;
for (int i = 0; i < pRow.getCorrProduct().size(); i++)
	sameSize2 = sameSize2 && (pRow.getCorrProduct().at(i).size() == 2);
					

the two logical variables sameSize1 and sameSize2 should evaluate to true.

Example 1.3. A shape referring to an attribute of another entity.

In the CalDevice entity we find :
NameJava typeC++ typeArray's shape
antennaIdTagTag 
feedIdintint 
spectralWindowIdTagTag 
timeIntervalArrayTimeIntervalArrayTimeInterval 
numCalloadintint 
calEfffloat[][]vector < vector < float > >numCalload, Feed.numReceptors
The calEff attribute is a 2D array of float, its shape describes the size of its first dimension as equal to numCalload which is also an attribute of CalDevice, and the size of its second dimension equal to the attribute numReceptors of an instance of Feed entity; note that CalDevice's attributes antennaId, feedId, spectralWindowId and timeInterval are exactly the components of the key of the Feed entity; the following snippets of Java and C++ show how to retrieve which Feed instance is associated to this CalDevice instance, and consequently the size of the second dimension of calEff :

// -----------------Java------------------------------------
// Let's assume that cdRow is a Java instance of CalDeviceRow
// added to the CalDeviceTable of an ASDM.
// Let's retrieve the value of the numReceptors  attribute 
// in the associated FeedRow.
int numReceptors = cdRow.getTable()
                        .getContainer()
                        .getFeed()
                        .getRowByKey(cdRow.getFeedId(),
                                     cdRow.getAntennaId(), 
                                     cdRow.getSpectralWindowId(),
                                     cdRow.getTimeInterval())
                        .getNumReceptors();

boolean sameSize1 = cdRow.getCalEff.length == cdRow.getNumCalload();                                                                        
boolean sameSize2 = true; 
for (int i = 0; i < cdRow.getCalEff.length; i++) {
    sameSize2 = sameSize2 && (cdRow.getCalEff()[i].length == numReceptors);
}

// -----------------C++------------------------------------
// Let's assume that cdRow is an instance of CalDeviceRow 
// added to the CalDeviceTable of an ASDM.

// Let's retrieve the value of the numReceptors attribute 
// in the associated FeedRow.
int numReceptors = cdRow.getTable()
                        .getContainer()
			.getFeed()
			.getRowByKey(cdRow.getFeedId(),
			             cdRow.getAntennaId(), 
                                     cdRow.getSpectralWindowId(),
	                             cdRow.getTimeInterval())
                        ->getNumReceptors();

bool sameSize1 = cdRow.getCalEff().size() == cdRow.getNumCalload();                                                                        
bool sameSize2 = true; 
for (int i = 0; i < cdRow.getCalEff().size(); i++) {
    sameSize2 = sameSize2 && (cdRow.getCalEff()[i].size() == numReceptors);
} 

the two logical variables sameSize1 and sameSize2 should both evaluate to true.