#include <CifSchemaMap.h>
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) |
Static Public Member Functions | |
static bool | AreAttributesMandatory (const vector< string > &row, const vector< ATTRIBINFO > &aI) |
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 |
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.
SchemaMapping::SchemaMapping | ( | const string & | schemaFile = String::Empty , |
|
const string & | schemaFileOdb = String::Empty , |
|||
bool | verbose = false | |||
) |
Constructs a schema mapping object.
[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. |
None |
SchemaMapping::~SchemaMapping | ( | ) | [virtual] |
Destructs a schema mapping object, by releasing all the used resources.
Not applicable |
None |
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.
[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. |
None |
bool SchemaMapping::GetReviseSchemaMode | ( | ) |
Retrieves schema revising mode.
None |
false - if schema revising is turned off
None |
void SchemaMapping::ReviseSchemaMap | ( | const string & | revisedSchemaFile | ) |
Writes the revised schema mapping information to a file.
[in] | revisedSchemaFile | - indicates the name of the ASCII CIF file, to which the revised schema mapping information will be written to. |
None |
void SchemaMapping::updateSchemaMapDetails | ( | SchemaMapping & | revSchMap | ) |
Updates the existing schema mapping object, with the revised information from the specified schema mapping object.
[in] | revSchMap | - reference to a revised schema mapping object. |
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.
[in] | cifFile | - reference to a CIF file object that will hold the data. |
[in] | blockName | - the name of the data block |
None |
void SchemaMapping::GetTableNames | ( | vector< string > & | tableNames | ) |
Retrieves names of all the tables in each data block, defined in schema mapping object.
[out] | tableNames | - retrieved table names |
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] |
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] |
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] |