This example gives a first introduction into some of the new features included in
ConceptBase version 4.0. It demonstrates the use of metaformulas and
graphical types while building a Telos model describing
Entity-Relationship-Diagrams. The follwing model forms the basis:
{**************************}
{* *}
{* File: ERModelClasses *}
{* *}
{**************************}
Class Domain
end
Class EntityType with attribute
eAttr : Domain;
keyeAttr : Domain
end
Class RelationshipType with attribute
role : EntityType
end
Class MinMax
end
"(1,*)" in MinMax with
end
"(1,1)" in MinMax with
end
Attribute RelationshipType!role with attribute
minmax: MinMax
end
The model defines the concepts of EntityTypes and RelationshipTypes. Each entity that participates in a relationship plays a particular role. This role is modelled as a Telos attribute-link of the object RelationshipType. The attributes describing the entities are modelled as Telos attribute-links to a class Domain containing the value-sets. Roles can be restricted by the ``(min,max)''-constraints ``(1,*)'' or ``(1,1)''. The next model contains a concrete ER-model.
{**************************}
{* *}
{* File: Emp_ERModel *}
{* *}
{**************************}
Class Employee in EntityType with
keyeAttr,attribute
ssn : Integer
eAttr,attribute
name : String
end
Class Project in EntityType with
keyeAttr,attribute
pno : Integer
eAttr,attribute
budget : Real
end
Integer in Domain end
Real in Domain end
String in Domain end
Class WorksIn in RelationshipType with role,attribute
emp : Employee;
prj : Project
end
WorksIn!emp with minmax
mProjForEmp: "(1,*)"
end
WorksIn!prj with minmax
mEmpForProj: "(1,*)"
end
ConceptBase in Project with pno
cb_pno : 4711
end
Martin in Employee with ssn
martinSSN : 4712
end
M_CB in WorksIn with
emp
mIsEmp : Martin
prj
cbIsPrj : ConceptBase
end
Hans in Employee with ssn
hans_ssn : 4714
end
The entity-types Employee and Project participate in a binary relationship WorksIn. The attributes Employee!ssn and Project!pno are key-attributes of the respective objects.