120 likes | 250 Views
Metaschema options (in chgen v14 TBD?). Slides 2 and 3 are taken from TTTA_metadata_jk.ppt. (Karner and Spinney’s 99s523 chgen v11 project file) Slide 2 diagrams chgen’s internal hcg_-structures and slide 3 defines a new internal representation of metadata which was implemented in chgenv11.
E N D
Metaschema options (in chgen v14 TBD?) • Slides 2 and 3 are taken from TTTA_metadata_jk.ppt. • (Karner and Spinney’s 99s523 chgen v11 project file) • Slide 2 diagrams chgen’s internal hcg_-structures and slide 3 defines a new internal representation of metadata which was implemented in chgenv11. • Slide 4 identifies the limitations of that tree-structured model. • The next two slides (5,6) explain how boot-strapping chgen can support the same flexible metadata model that is available for the application data schema. This major revision (061108) adds 4 slides with 3 sample extensions: • (1) metaschemaCK - adds CandidateKey (CK) and CKtoTAassociation (CA) tables. • (2) metaschemaNS – 2A: Add tables NameSpace NS, ProjectVersion PV and PS association; 2B: add table VT and split table TS. $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Current hcg table Hierarchy hcg_ts_list hcg_view_list ( 3 ) - numviews 1:HCGNumTables hcg_table_seqlist ( 1 ) - ttabrev - rcount - maxver 1 : MAXViews view_element_type (4) - view name - mode 1 : HCGNumTables ts_list (container) 1 : HCGNumTables version_elt_type ( 5 ) - version no. 1 : MAXVersions ts_type ( 2 ) - maxrows - vrcount $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Proposed ttsv vv Hierarchy for CHGEN MetaData (see also $PH/COOL-GEN/hcg_struct_migrationR1.ppt) SV Type ( 3 ) - Schema Name - Schema Version - numTables - struct tt_type *tt_ptr[HCG_NUMTABLES] - strict vv_type * vv_ptr[MAXViews] 1 : HCG_NUMTABLES 1 : MAXVIEWS tt type ( 1 ) - ttabbr[ABBRNAMELENGTH] - tableName[NAMELENGTH] - comment[ MAXCOMMENTLENGTH ] - maxver - rcount struct ta_type *ta_ptr[NUMATTRIBUTES] struct ts_type *ts_ptr[ MAXVERSIONS ] struct tt_type *next_ptr vv type ( 4 & 5 ) - viewName[ MAXVIEWNAMELEN] - mode - versionNo[ HCG_NUM_TABLES ] - numTables 1 : NUMATTRIBUTES ta type - FieldName[ NAMELENGTH ] -AltFieldName[ NAMELENGTH ] - FieldType[ NAMELENGTH ] - comment[ MAXCOMMENTLENGTH ] - IsKey - HasBp - Singleton - struct ta_type *next_ptr 1 : MAXVERSIONS ts type ( 2 ) - versionNo - maxrow - vrcount $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
99s523 genv10 Model Limitations • The proposed data model (previous slide) does not include symmetric binary relations which a bootstrapped chgen process can handle. • The preferred data model is metaschema.sch with tables SV, TT, TA, VV, TS. Table TS is a binary association between TT and VV. Table TS includes both TTid and VVid fkeys, as shown below. • The version number content of table VV is deprecated. Table VV should merely associate an arbitrary subset of TT_rows with each Viewname and declare its access mode in that view. Views are important e.g. to permit input and output test data formats or database conversion formats to be pre-defined in separate views in the schema). SV SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TA = TableStats VV TT TS TA $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Chgen Boot-strap Iterations • A bootstrapped version of chgen can load .msdat tables SV, TT, TA, VV, and TS from the metaschema.msdat file created earlier by chgen –metafile. • Access to the meta-schema tables SV, TT, TA, VV, and TS is supported by pr_*.c code that is also automatically generated by that prior chgen run. • Later versions of chgen may add more new tables to the same or a new metaschema.sch file version (SV_row), and may define more views which contain subsets of these tables in file metaschema.viewdefs; pr_init now adds each view spec (list of [versioned] table types) to table VV and TS. • Later versions will remove the versionNo component of pfkeys and add a a new NameSpace (NS) table. $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Chgen Boot-strap Example 1 • Example 1: (slides 6 - 8) Metadata to support queries, • This example adds tables CK and CK below TT and TA. • Based on composite-keys. CK = CandidateKey, CA = CKtoTAassociation • add candidate key specification metadata input tables and methods to maintain uniqueness of DB content wrt. any candidate key. • adding application data model tables and methods to support regression testing by declaring test data input and output formats. • Both of these may add new viewnames to metaschema table VV by augmenting file application.viewdefs. $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Example 1a: MetaschemaCK with CandidateKeys:(this is the subject of 06f522 asgnt3) SV SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TA = TableStats CK = CandidateKey CA = CKtoTAassociation VV TT TS TA CK CA (2 new table types) $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Example 1b: MetaschemaCKwith CandidateKeys and non-key attributes*: _SV___ svname sformat sversion lastMod svpath descr SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TA = TableStats New table types: CK = CandidateKey CA = CKtoTAassociation NS = NameSpace _VV______ vname mode (r/w/a) num_tables _TT_______ ttabb c5 ttname c30 *(A primary surrogate key attribuyte XXid is implied by the table abbrev XX. A foreign key attribute YYid is implied by any link incoming from an aggregate parent or superclass table with ttabbrev YY.) _TS___ verno ** maxrow vvrcount _TA__________ fname ?? dfltval ???? c32 ftype i4 c10 Iskey 0 c4 comment // t132 _CK________ CKname c32 CArcount i2 ** verno is a deprecatedcomponent of pfkeys. It will be removed along with verno in TS. A NS tag component will be prefixed to pfkeys instead. _CA______ CAorder i2 $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Chgen Boot-strap Example 2: • Example 2: (slides 9-12): Add NameSpace and ProjectVersion tables; simplify table TS and add table VT. • This example adds new tables lateral to root table SV, that do not affect existing table formats or generated code. • It adds NameSpace NS and ProjectVersion PV; also adds PVtoSV associative entity PS. • SV must be known to PV to insure consistency of database declarations in generated code and database references in application code. • The goal is to evolve and reuse system packages like GEN, LCP, BDE independently of each other. • NameSpace instances partition the data model entities into separate NameSpace scopes to avoid ttabb conflicts. • NameSpace partitions permit reuse of the same ttabb in a different namespace; • TBD Challenge: Use NameSpaces to promote higher-level encapsulation for inter-NS access than for intra-NS access. • Example 2 also modifies leaf table TS (split into TS and VT). $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Example 2a: MetaschemaNS with NameSpace table _SV___ svname sformat sversion lastMod svpath descr _NS (TBD) [1] nsabb nsname descr 0..1 SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TS = TableStats New table types: NS = NameSpace (TBD) Eliminated table types: CK = CandidateKey CA = CKtoTAassociation _TT_______ ttabb c5 ttname c30 descr t80 _VV______ vname mode (r/w/a) num_tables _TS [2] verno maxrow vvrcount _TA__________ fname ?? dfltval ???? c32 ftype i4 c10 Iskey 0 c4 comment // t132 1. An NS row# is encoded into a new NSidx component of each pfkey. 2. Table TS will be split into VT and TS on the next slide. $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Example 2b: MetaschemaNS and Project associations _SV___ svname sformat sversion lastMod svpath descr PV (TBD) PVname PVpath ???... _NS (TBD)___ nsabb nsname descr 0..1 _PS (TBD) _VV______ vname mode (r/w/a) num_tables SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TA = TableStats New table types: NS = NameSpace (TBD) PV = ProjectVersion (TBD) PS = PVtoSVassociation(TBD) _TT_______ ttabb c5 ttname c30 descr t80 _TA___ … _TS _____ verno maxrow vvrcount $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL
Example 2c: MetaschemaNS with TS changes (TS+VT) _SV___ svname sformat sversion lastMod svpath descr PV (TBD) PVname PVpath ???... _NS (TBD)___ NSname descr 0..1 _PS (TBD) SV = SchemaVersion TT = TableType TA = TableAttribute VV = ViewVersion TA = TableStats New table types: NS = NameSpace (TBD) PV = ProjectVersion (TBD) PS = PVtoSVassociation(TBD) VT = VVtoTTassociation (from TS) _VV______ vname mode (r/w/a) num_tables _TT_______ ttabb c5 ttname c30 descr t80 _VT [1]______ //table-in-view verno _TA___ … 1. VT defines a VV to TT association (split out from TS). (Should mode become table- as well as view-specific?) 2. TS fields maxrow and rcount now apply to the entire ttabb table. Since it is no longer view-specific, table TS could be merged into TT. WARNING: TS is not constant. _TS [2]___ maxrow vvrcount** $PH/COOL-GEN/TTTA_metadata_jk_rl.ppt 99s523 CHGEN project - Spinney/Karner; revised 06f522 - RJL