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 atoms
RopeType← $ROPE;
IntType← $INT;
TimeType← $GMT;
BoolType← $BOOL;
AnyDomainType← $ANY;
RecordType← $RECORD;
Define the DataType entities
RopeTypeEntity ← DefineSystemEntity[RopeTypeID, DataTypeDomain, "ROPE"];
IntTypeEntity ← DefineSystemEntity[IntTypeID, DataTypeDomain, "INT"];
TimeTypeEntity ← DefineSystemEntity[TimeTypeID, DataTypeDomain, "GMT"];
BoolTypeEntity ← DefineSystemEntity[BoolTypeID, DataTypeDomain, "BOOL"];
RecordTypeEntity ← DefineSystemEntity[RecordTypeID, DataTypeDomain, "RECORD"];
AnyDomainTypeEntity ← DefineSystemEntity[AnyDomainTypeID, DataTypeDomain, "ANY"];
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← dNameProp.fh;
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← aNameProp.fh;
aTypeCodeProp← DefinePrivateProperty[
AttributeDomain, "aTypeCodeProp", IntType];
aTypeEntityProp← DefinePrivateProperty[
AttributeDomain, "aTypeEntityProp", $DataTypeDomain];
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];