DBStorage.SetSystemTupleTable[systemTupleVec];
Define the system domains
DomainDomain← DefineSystemDomain[DomainTSID, "Domain"];
RelationDomain← DefineSystemDomain[RelationTSID, "Relation"];
AttributeDomain← DefineSystemDomain[AttributeTSID, "Attribute"];
DataTypeDomain← DefineSystemDomain[DataTypeTSID, "DataType"];
IndexDomain← DefineSystemDomain[IndexTSID, "Index"];
IndexFactorDomain← DefineSystemDomain[IndexFactorTSID, "IndexFactor"];
Define the DataType entities
RopeType← DefineSystemEntity[RopeTypeID, DataTypeDomain, "RopeType"];
IntType← DefineSystemEntity[IntTypeID, DataTypeDomain, "IntType"];
TimeType← DefineSystemEntity[TimeTypeID, DataTypeDomain, "TimeType"];
BoolType← DefineSystemEntity[BoolTypeID, DataTypeDomain, "BoolType"];
RecordType← DefineSystemEntity[RecordTypeID, DataTypeDomain, "RecordType"];
AnyDomainType← DefineSystemEntity[AnyDomainTypeID, DataTypeDomain, "AnyDomainType"];
FakeTheNameHandle[]; -- must call after RopeType defined but before any real entities
Define (private) properties of domain, relation, attribute, and index entities
dHandleProp← DefinePrivateProperty[
DomainDomain, "dHandleProp", RecordType, DBStorage.TuplesetObjectSize];
dHandle must be first field for proper storage level operation!
dNameProp← DefinePrivateProperty[DomainDomain, "dName", RopeType, DefaultNameSize];
tupleSetNameHandle← T2SAT[dNameProp].vHandle;
dIndexProp← DefinePrivateProperty[DomainDomain, "dIndexProp", IndexDomain];
rHandleProp← DefinePrivateProperty[
RelationDomain, "rHandleProp", RecordType, DBStorage.TuplesetObjectSize];
rHandle must be first field for proper DBStorage operation!
rNameProp← DefinePrivateProperty[
RelationDomain, "rNameProp", RopeType, DefaultNameSize];
don't need handle because assume identical pos&size as tupleChangeNameHandle above
r1to1Prop← DefinePrivateProperty[RelationDomain, "r1to1", BoolType];
aHandleProp← DefinePrivateProperty[
AttributeDomain, "aHandleProp", RecordType, DBStorage.FieldObjectSize];
handle need not be first field, but make it that way anyway like other system tuples
aNameProp← DefinePrivateProperty[AttributeDomain, "aName", RopeType];
attributeNameHandle← T2SAT[aNameProp].vHandle;
aTypeCodeProp← DefinePrivateProperty[
AttributeDomain, "aTypeCodeProp", IntType];
aTypeEntityProp← DefinePrivateProperty[
AttributeDomain, "aTypeEntityProp", DomainDomain];
iHandleProp← DefinePrivateProperty[
IndexDomain, "iHandleProp", RecordType, DBStorage.IndexObjectSize];
iHandle must be first field of Index entity for proper DBStorage operation!
Define the system relations and their attributes
FakeTheTypeAndLinkRelations[];
[aRelation, aRelationOf, aRelationIs]← DefineSystemBinary[
id: aRelationTSID, name: "aRelation", of: AttributeDomain, is: RelationDomain];
[aUniqueness, aUniquenessOf, aUniquenessIs]← DefineSystemBinary[
id: aUniquenessTSID, name: "aUniqueness", of: AttributeDomain, is: IntType];
[aLength, aLengthOf, aLengthIs]← DefineSystemBinary[
id: aLengthTSID, name: "aLength", of: AttributeDomain, is: IntType];
[aDomain, aDomainOf, aDomainIs]← DefineSystemBinary[
id: aDomainTSID, name: "aDomain", of: AttributeDomain, is: DomainDomain];
[aUnlinked, aUnlinkedOf, aUnlinkedIs]← DefineSystemBinary[
id: aUnlinkedTSID, name: "aUnlinked", of: AttributeDomain, is: DomainDomain];
[ifIndex, ifIndexOf, ifIndexIs]← DefineSystemBinary[
id: ifIndexTSID, name: "ifIndex", of: IndexFactorDomain, is: IndexDomain];
[ifOrdinalPosition, ifOrdinalPositionOf, ifOrdinalPositionIs]← DefineSystemBinary[
id: ifOrdinalPositionTSID, name: "ifOrdinalPosition", of: IndexFactorDomain, is: IntType];
[ifAttribute, ifAttributeOf, ifAttributeIs]← DefineSystemBinary[
id: ifAttributeTSID, name: "ifAttribute", of: IndexFactorDomain, is: AttributeDomain];
[dSubType, dSubTypeOf, dSubTypeIs]← DefineSystemBinary[
id: dSubTypeTSID, name: "dSubType", of: DomainDomain, is: DomainDomain, is1to1: FALSE];