There are usually four relationships such as association, generalization (inheritance), dependency and refining between classes and classes.
The association relationship is divided into ordinary association, recursive association, limited association, or seven types such as association, orderly association, ternary correlation, and aggregation.
The association relationship is generally two-way, ie the associated objects can communicate with each other with each other. Conversely, if there is a relationship that can communicate with each other between the objects, or both the object can perceive the other party, then there is a relationship between the two classes (know each other, interconnect each other).
1. Ordinary relationship: Ordinary relationship is the most common association, as long as there is a connection relationship between classes and inter-class, it can be expressed in normal associations.
2. Recursive relationship: If a class is associated with its own relationship, this association is called a recursive association (association between similar objects. Such as: a network node class, there are many network node objects on the network, then these have The associated network node object is a recursive association).
Role problem in association:
"Human", "human" defines two objects, then there may be a marriage association (recursive) between them. One person is married to another. I will play a husband role, one is a wife. If a person is not married, then this person can't make a wife or husband, so there should not be "marriage" for this person. People can be the customer of the insurance company. Then this is different in different associated characters, namely: people are recursive between people, then they may be couples, brothers, father and son - ..., then insurance companies and People can be seen as ordinary associations, then the relationship between them can be the relationship between insurance companies and insurance customers.
3. Limitation association: Limited associations for a pair of more or more relative relationships. In the qualified association, the specific object of the end of the end of the end of the end using the qualifian is divided into the object set. Limit words can be understood as a keyword, separated all objects with keywords. Using the defined association, the weight in the model can be changed from one-to-one. For example, there may be a multi-relationship between insurance companies and people, but we gave "Insurance Company" plus limited words "Peace Insurance" to become a couple of relationships, we will give "people" plus The upper limit word "Zhang San" will become a one-on-one relationship.
4. Or association: people can establish an insurance contract with the insurance company, and the company can also establish an insurance contract with the insurance company. It is clear that the contract with the company should not be the same, which means that the relationship between the person and the insurance contract cannot be used. The company has happened at the same time as the association relationship with the insurance contract. In order to solve such problems, "or related" is introduced. The so-called or associated is a constraint condition for two or more associated additional constraints, allowing the object in the class to only be applied to an association relationship.