SchemaMapping Class Reference

Public class that respresents schema mapping configuration. More...

#include <CifSchemaMap.h>

List of all members.

Public Member Functions

 SchemaMapping (const string &schemaFile=String::Empty, const string &schemaFileOdb=String::Empty, bool verbose=false)
virtual ~SchemaMapping ()
void SetReviseSchemaMode (bool mode=true)
bool GetReviseSchemaMode ()
void ReviseSchemaMap (const string &revisedSchemaFile)
void updateSchemaMapDetails (SchemaMapping &revSchMap)
void CreateTables (CifFile &cifFile, const string &blockName)
void GetTableNames (vector< string > &tableNames)
ISTable * CreateTableInfo ()
ISTable * CreateColumnInfo ()
void GetAttributeNames (vector< string > &attributes, const string &tableName)
void GetAttributesInfo (vector< AttrInfo > &attrInfo, const string &tableName)
void GetMappedAttributesInfo (vector< vector< string > > &mappedAttrInfo, const string &tableName)
void GetMappedConditions (vector< vector< string > > &mappedConditions, const string &tableName)
void GetTableNameAbbrev (string &abbrev, string target)
void GetAttributeNameAbbrev (string &abbrev, string targetTable, string targetAttribute)
void getSchemaMapDetails (const string &tableName, const string &attribName, string &dataType, string &indexFlag, string &nullFlag, string &width, string &precision, string &populated)
void UpdateAttributeDef (const string &tableName, const string &columnName, int type, int iWidth, int newWidth)
void GetAttributeInfo (vector< ATTRIBINFO > &aI, ISTable *tIn)
void GetAllAttributeInfo (vector< ATTRIBINFO > &aI, string tableName)
void GetMasterIndexAttribName (string &masterIndexAttribName)

Static Public Member Functions

static bool AreAttributesMandatory (const vector< string > &row, const vector< ATTRIBINFO > &aI)
static bool IsTablePopulated (const vector< AttrInfo > &attrInfo)
static int CheckIndexAttributes (const vector< string > &row, const vector< ATTRIBINFO > &aI)

Static Public Attributes

static const int _TYPE_CODE_INT = 1
static const int _TYPE_CODE_FLOAT = 2
static const int _TYPE_CODE_STRING = 3
static const int _TYPE_CODE_TEXT = 4
static const int _TYPE_CODE_DATETIME = 5
static const int _TYPE_CODE_BIGINT = 6
static const int _MAX_LINE_LENGTH = 255

Private Member Functions

void _AssignAttribIndices (void)
void GetGroupNames (vector< string > &groupNames)
void Clear ()

Private Attributes

bool _verbose
string _schemaFile
string _schemaFileOdb
CifFile * _fobjS
ISTable * _tableSchema
ISTable * _attribSchema
ISTable * _schemaMap
ISTable * _mapConditions
ISTable * _tableAbbrev
ISTable * _attributeAbbrev
bool _reviseSchemaMode
int _compatibilityMode


Detailed Description

Public class that respresents schema mapping configuration.

This class encapsulates schema mapping functionality. Schema mapping defines how mmCIF data gets converted into the database data. Schema mapping information is stored in a number of configuration tables that are located in a configuration CIF file. This class provides methods for reading the schema mapping information from the ASCII CIF file or serialized (binary) configuration CIF file, for revising the schema mapping information (based on the data), updating the schema mapping information, accessing the attributes information.


Constructor & Destructor Documentation

SchemaMapping::SchemaMapping ( const string &  schemaFile = String::Empty,
const string &  schemaFileOdb = String::Empty,
bool  verbose = false 
)

Constructs a schema mapping object.

Parameters:
[in] schemaFile - optional parameter that indicates the name of the ASCII CIF file, which holds the schema mapping configuration information. If specified, schemaFile file is parsed and the schema mapping configuration information is taken from it.
[in] schemaFileOdb - optional parameter that indicates the name of the serialized CIF file, which holds the schema mapping configuration information. If schemaFile is not specified, schemaFileOdb is de-serialized and the schema mapping configuration information is taken from it. If both schemaFile and schemaFileOdb are specified, schemaFile is parsed, the schema mapping configuration information is taken from it and then serialized to schemaFileOdb file, at the end of processing.
[in] verbose - optional parameter that indicates whether logging should be turned on (if true) or off (if false). If verbose is not specified, logging is turned off.
Returns:
Not applicable
Precondition:
schemaFile and schemaFileOdb cannot both be empty.
Postcondition:
None
Exceptions:
 None

SchemaMapping::~SchemaMapping (  )  [virtual]

Destructs a schema mapping object, by releasing all the used resources.

Parameters:
 Not applicable
Returns:
Not applicable
Precondition:
None
Postcondition:
None
Exceptions:
 None


Member Function Documentation

void SchemaMapping::SetReviseSchemaMode ( bool  mode = true  ) 

Sets the schema revising mode. Schema revising is a process where the existing schema mapping information is being updated, by examining the attributes of the converted mmCIF file. Schema revising is needed in order to increase the length of database attributes in database schema/data file so that the data can be fully stored in the database.

Parameters:
[in] mode - optional parameter that indicates whether the schema revising should be turned on (if true) or off (if false). If mode is not specified, schema revising is turned on.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

bool SchemaMapping::GetReviseSchemaMode (  ) 

Retrieves schema revising mode.

Parameters:
 None
Returns:
true - if schema revising is turned on

false - if schema revising is turned off

Precondition:
None
Postcondition:
None
Exceptions:
 None

void SchemaMapping::ReviseSchemaMap ( const string &  revisedSchemaFile  ) 

Writes the revised schema mapping information to a file.

Parameters:
[in] revisedSchemaFile - indicates the name of the ASCII CIF file, to which the revised schema mapping information will be written to.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void SchemaMapping::updateSchemaMapDetails ( SchemaMapping revSchMap  ) 

Updates the existing schema mapping object, with the revised information from the specified schema mapping object.

Parameters:
[in] revSchMap - reference to a revised schema mapping object.
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void SchemaMapping::CreateTables ( CifFile &  cifFile,
const string &  blockName 
)

In the specified CIF file object, creates tables that are specified in the schema mapping object.

Parameters:
[in] cifFile - reference to a CIF file object that will hold the data.
[in] blockName - the name of the data block
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

void SchemaMapping::GetTableNames ( vector< string > &  tableNames  ) 

Retrieves names of all the tables in each data block, defined in schema mapping object.

Parameters:
[out] tableNames - retrieved table names
Returns:
None
Precondition:
None
Postcondition:
None
Exceptions:
 None

ISTable * SchemaMapping::CreateTableInfo (  ) 

ISTable * SchemaMapping::CreateColumnInfo (  ) 

void SchemaMapping::GetAttributeNames ( vector< string > &  attributes,
const string &  tableName 
)

void SchemaMapping::GetAttributesInfo ( vector< AttrInfo > &  attrInfo,
const string &  tableName 
)

void SchemaMapping::GetMappedAttributesInfo ( vector< vector< string > > &  mappedAttrInfo,
const string &  tableName 
)

void SchemaMapping::GetMappedConditions ( vector< vector< string > > &  mappedConditions,
const string &  tableName 
)

void SchemaMapping::GetTableNameAbbrev ( string &  abbrev,
string  target 
)

void SchemaMapping::GetAttributeNameAbbrev ( string &  abbrev,
string  targetTable,
string  targetAttribute 
)

void SchemaMapping::getSchemaMapDetails ( const string &  tableName,
const string &  attribName,
string &  dataType,
string &  indexFlag,
string &  nullFlag,
string &  width,
string &  precision,
string &  populated 
)

void SchemaMapping::UpdateAttributeDef ( const string &  tableName,
const string &  columnName,
int  type,
int  iWidth,
int  newWidth 
)

void SchemaMapping::GetAttributeInfo ( vector< ATTRIBINFO > &  aI,
ISTable *  tIn 
)

void SchemaMapping::GetAllAttributeInfo ( vector< ATTRIBINFO > &  aI,
string  tableName 
)

bool SchemaMapping::AreAttributesMandatory ( const vector< string > &  row,
const vector< ATTRIBINFO > &  aI 
) [static]

bool SchemaMapping::IsTablePopulated ( const vector< AttrInfo > &  attrInfo  )  [static]

void SchemaMapping::GetMasterIndexAttribName ( string &  masterIndexAttribName  ) 

int SchemaMapping::CheckIndexAttributes ( const vector< string > &  row,
const vector< ATTRIBINFO > &  aI 
) [static]

void SchemaMapping::_AssignAttribIndices ( void   )  [private]

void SchemaMapping::GetGroupNames ( vector< string > &  groupNames  )  [private]

void SchemaMapping::Clear (  )  [private]


Member Data Documentation

const int SchemaMapping::_TYPE_CODE_INT = 1 [static]

const int SchemaMapping::_TYPE_CODE_FLOAT = 2 [static]

const int SchemaMapping::_TYPE_CODE_STRING = 3 [static]

const int SchemaMapping::_TYPE_CODE_TEXT = 4 [static]

const int SchemaMapping::_TYPE_CODE_DATETIME = 5 [static]

const int SchemaMapping::_TYPE_CODE_BIGINT = 6 [static]

const int SchemaMapping::_MAX_LINE_LENGTH = 255 [static]

bool SchemaMapping::_verbose [private]

string SchemaMapping::_schemaFile [private]

string SchemaMapping::_schemaFileOdb [private]

CifFile* SchemaMapping::_fobjS [private]

ISTable* SchemaMapping::_tableSchema [private]

ISTable* SchemaMapping::_attribSchema [private]

ISTable* SchemaMapping::_schemaMap [private]

ISTable* SchemaMapping::_mapConditions [private]

ISTable* SchemaMapping::_tableAbbrev [private]

ISTable* SchemaMapping::_attributeAbbrev [private]

bool SchemaMapping::_reviseSchemaMode [private]

int SchemaMapping::_compatibilityMode [private]


The documentation for this class was generated from the following files:
Generated on Fri Feb 8 10:24:44 2008 for db-loader-v4.0 by  doxygen 1.5.1