Are attributes mandatory in Chen's ERD diagram? - entity-relationship

Is it mandatory to add the attribute symbols in an ERD diagram when using Chen's notation?
I'm asking because in my current ERD there are already so many tables and relations that an A3 paper size is needed to print it out. Adding all the attribute symbols would make it even larger and less readable. I therefore wonder if it is an obligation or if I could leave them out. And if it is mandatory, how could I maintain my diagram readable?

It is not mandatory in Chen's notation to show the attributes.
In his seminal articles (for example here), Chen uses several diagrams with only entities and their relationships. This forms what he calls the "upper conceptual domain", i.e. the big picture. The details of the attributes could be documented elsewhere, for example in additional diagrams that "zoom" one or a few entities, or in a tabular data dictionary that describes the content of each entity.
You may also enrich this approach by showing in addition to the entities and relationships, the most relevant attributes: all the key attributes, and a few additional attributes that allow the reader to imagine the kind of information that the entity represents. The attributes belong to the "lower conceptual model" (Chen's terminology).
If you would want to shall all the attributes, and if the separate dictionary is not desirable for you, you could break the model down into several smaller models each having all the attributes for their entities and relationships. Some entities would appear in several diagrams to allow to make the link between them. The attribute details would then be detailed in only one of the diagrams and hidden in the others.

Related

Which entity relationship method looks right or better?

I see that there are two different ways to make entity relationship on the example illustrated below (either by one to one or by many to many). Which one is better method? (What is the better method in terms of common practice or widely accepted convention. Possibly, which one is more efficient? If there is no better method what would be the trade-off of using one instead of another?)
One-to-one method
Many-to-many method
First of all, neither diagram is an entity-relationship diagram. Entity-relationship diagrams should be able to represent entity-relationship concepts, but the notation you used doesn't distinguish between entity relations and relationship relations, and shows columns, types and foreign key constraints, which belong in a physical model rather than a conceptual one. What you have is better described as table diagrams. For ERDs, I recommend Chen's original notation or something close to it.
The first diagram mixes a higher-level abstraction into an otherwise physical model, and for that reason, I recommend the second style as it's more consistent.
Note that in either diagram, CompanyType_ID in General appears at odds with the type of relationship you're trying to represent. It may not necessarily be wrong (entities described in General may each have a primary or distinguished CompanyType in addition to a set of secondary types) but even if it's modeled that way intentionally, it warrants a second look at least.

Interpreting the Crow's foot ER symbols

I came to know that there is Crow's foot ER diagram notation, and got a good quick reference. Have a look at the below diagram:
I did get some clarity on these symbols, however I have difficulty in understanding:
1) Why we have the "connector symbols" on both side of the line?
2) How to interpret them?
Can anyone please help me understand this?
Your reference is somewhat incorrect. The Entity-Relationship model doesn't use Crow's foot. Chen's notation and extensions to that notation can be called ER diagrams.
Your diagram is a generalization of table diagrams, modified to allow many-to-many associations and hide attributes. However, it doesn't represent relationships using their own shapes, and I see no indication of support for ternary or higher relationships. There's also no indication of other ER concepts like weak entities, associative entities, identifying relationships or keys.
Data models that only support binary relationships are usually based on the network data model, not on the Entity-Relationship model. Relationships in the ER model, when physically implemented, are represented by two or more entity columns in the same table, not by any kind of link between tables. In actual table diagrams, many-to-many relationships are represented by their own table, with two one-to-many association lines. In those cases, the cardinality indicators represent the number and optionality of records with matching values for matching PK/FK columns.
The interpretation of the Crow's foot symbols are indicated in the orange column. For more information about modeling with Crow's foot, see Entity Modelling. However, don't confuse this with the Entity-Relationship model as described by Chen, or either of them with the Relational model.

One-to-many relationship between same entity in Core Data

I have entity called Item. It has attribute title and I want it to have collection of subitems (type of Item).
One item can have many (sub)items. (sub)item is part of right one item. For example, there is item titled as car. It has subitems titled wheels, engine and cabine. Cabine has subitems seat and steering wheel.
How to model it? Should I set inverse to subitems? If I set no inverse, I'm getting warning. And whether it is inverse or not, it is still many-to-many. No way to set it one-to-many.
How should I think of this problem? I don't have much experience with databases and I think there is also difference between modeling in Core Data and in SQL.
EDIT: There should be subitems instead of subitem in the picture
I've added relationship superitem as inverse to subitems. superitem is to-one type with nullify delete rule and subitems is to-many type with cascade delete rule. Seems to be the most perfect solution for my case. As bonus I don't have to write my own - addSubitem: method (as it is not generated for Swift) because it is automatically added if I set item's superitem.
Object modeling and relational database design are quite different, at least on the surface. The concepts of encapsulation, inheritance, and polymorphism have no exact analog in the relational data model. You are going to have to think about the problem in two different ways in order to do both object modeling and relational database design.
There is a model that is sort of half way between them. It's called the "Entity Relationship model", and this has been around almost as long as the relational model. This is useful for thinking about the problem and analyzing the data requirements at a conceptual level. ER modeling is very parallel to object modeling, except that object modeling models behavior as well as data, and ER modeling only models data.
The problem with learning ER modeling for this purpose is that in the present state of affairs, most of the professionals who use ER diagrams do not use them to depict a conceptual model. They use them to depict a relational design for a database. So if you learn ER modeling from them, you'll learn a design methodology, and not an analysis methodology.
Data analysis and database design are really very different activities, and it's useful to keep them separate in your mind, even if a single project requires you to do both of them. Oddly enough, the same division ultimately comes up in object modeling as well. Some object models are analysis models, and try to clarify the problem space. Other object models are design models, and try to clarify the solution space.
Acknowledging what Mitty said. You need wrap your brain around objects (not relational tables). Considering your example I would break it down as follows. The top level object is an item such as a car, truck, airplane, boat, etc. Items can have systems such as engines, transmissions, cabins. Systems can have components such as pistons, spark plugs, seats, steering wheels, tires. If you think of all these things as objects, then perhaps the beginning of a model would look like this:
An item may have many systems. Systems may have many components. Apple recommends setting the inverse, but you should worry more about the relationships and their cardinality (i.e. one-to-one, one-to-many). You can use a reflexive relationship (to self) as you depicted, but I think that limits your ability to really leverage the power of the object model as all 'things' would be represented as 'item' and you wouldn't have the nice distinction of system and component (IMO)

Breaking down a Core Data Entity

If I have an entity Person, and it has information like name, dateOfBirth, email and then it also has information like houseNo, street, landmark, city, country as well.
and this entity is representing a big form on an iPad.
Is it possible to break it down into smaller entities like Address ?
and then relate Address to Person, but that will be a one to one relationship, is it Okay ?
I am asking this because too many attribues based on one form for a person is becoming complex to manage.
You are encouraged to use a more entities to reflect the logic of your data model. This is certainly a good design principle and will provide more flexibility for future developments of your project.
However, I do not agree with your argument about complexity. In fact, a relational core data model is more complex than a flat one. Having one form referring to just one entity with a whole lot of attributes is certainly less complex than having relationships to other entities.
So if you think that your original data model is sufficient for your purposes, there is no good reason to change it.

Modeling a database (ERD) that has quirky behavior

One of the databases that I'm working on has some quirky behavior that I want to account for in the entity-relationship diagram.
One of the behaviors is that there is a 'booking' table and a 'invoice' table. When a 'booking' is invoiced, then the record is inserted into the 'invoice' table and then deleted from the 'booking' table.
However, a reference is still kept of the booking number.
How do we model this? Big arrow between the tables and some text beside it describing what happens?
No, changing the database schema is not possible at this point in time
Edit: This is the type of diagram that I want to use:
alt text http://img813.imageshack.us/img813/5601/erdartistperformssong.png
Link
If, by ERD, you mean the original "Chen" diagrams where the relationship was words written in a diamond, then you have a relationship between between Booking and Invoice. It's a special kind of relationship that's NOT implemented with a simple foreign key; it's implemented via a complicated move and a constraint.
If, by ERD, you mean the diagrams that ERwin draws, then you don't have an easy way to do this. It tends to focus you on drawing PK-FK relationships. You have a non-PK-FK relationship between these things. Some kind of line with text is about all you can do.
Arrows, BTW, aren't appropriate because the ERD shows the "state" of the database. Data flowing around isn't part of an ERD. You do have a relationship, it's just not a typical PK-FK relationship. It's an atypical relationship based on rows existing in some places and not existing in others.
In the UML you can easily draw this as a "constraint" among the relationships.
I don't know what these people are talking about.
The Entity Relation Diagram doesn't describe the data fully; yes of course, it only shows Entities and Relations, it doesn't show Attributes. That's why it is called an ERD and not a Data Model. Evidently many people here can't tell the difference.
The Data Model is supposed to show as much as possible. But it depends on (a) the standard [if any] that you use and (b) the Notation. Some show more than others. IDEF1X which is the only Relational modelling Standard (NIST 184 of 1993). It is the most complete, and shows intricacies and complexities that other notations do not show. Recently MS and others have come out with "simplified" notations, of course, much is lost in the "ERDs".
It is not "process flow", it is a relation in a database.
UML is completely inappropriate for modelling data, especially when there is at least one Standard plus several non-standard but commonly used data modelling notations. There is nothing that can be shown in UML that can't be shown in IDEF1X. But most developers here have never heard of it (developers should not be modelling unless they have acquired modelling skills, but that is another story)..
This is a perfectly legal; it may not be commonly known, but it is legal and named. It is a Supertype-Subtype relation, except that the Cardinality is 1::0-n instead of 1::0-1. The IDEF1X Notation (right) has a Subtype symbol. Note there is only one relation at the parent end; and one each at the child end. And of course the crows feet show the cardinality. These relations can be Exclusive or Non-exclusive; yours is Exclusive; that is what the X through the half-circle means.
ERwin is the only modelling (not diagramming) tool that implements IDEF1X, and thus has the full complement of the IDEF1X Notation.
Of course, the Standard, the modelling capability, are all in the mind, not in the tool. I draw Data Models that are IDEF1X-compliant using a simple drawing tool.
I find that some developers baulk at the Subtype symbol, so I show a simplified version (left) in my IDEF1X models; it is intended to convey the sense of exclusivity, while the retention of the single line at the parent end indicates it is a subtype.
Lott: Click here▶Link to Data Model◀Lott: Click here
Link to IDEF1X Notation for those who are unfamiliar with the Relational Modelling Standard.
Sounds like a process flow, not an entity relationship. If at the time the entry is added to invoice, and the entry is deleted from booking, then there is never a relationship between the two. There is never a situation where you can traverse that relationship because there is never a record in both places that can be related together.
ERD don't describe the database fully. There are other things like process flow and use cases that detail other facets of the system.
This is kind of an analogy to UML for software. A class diagram doesn't show you all the different ways classes interact. One class might initialize locally and call functions of another class, but because there is not composition or inheritance that relates those two classes, then the class diagram doesn't show this relationship. Only when you fully document the system with all the various types of diagrams can you see all the facets of how it operates.

Resources