ERD to django models ? Many to many relatioship with attribut - sql

How should I translate this Entity Relationship Diagram to Django models ?

Related

Oracle SQL: Concern About Barred Relationships

I have recently learned about “barred relationships” when developing an ERD through the Oracle Academy service. The course gave the following definition of a barred relationship: “A relationship that participates in an entity’s unique identifier” I understand how this works in the context of resolving a M:M relationship by creating an intersection entity and having the UID of that entity come from the originating relationships. My question is: Can a barred relationship occur in an instance where there is no intersection entity, or are barred relationships reserved for intersection entities?
Barred, that is, bar-ed ids are literally the original ids of the two entities connected by the relation with a bar (pipe, |) in between. Like in a CSV file.
The term is unusual and an invention of that course, I would say. It certainly is not usually used in the generic SQL world, nor even in the Oracle RDBMS documentation.

Query on Entity Relationship diagram

Below is the ER diagram with relation among 5 different entities.
My question:
1)
Each of these 5 entities a class as per OOP terminology?
2)
Can you help me understand the meaning of relation(different types of lines) among these 5 entities? Line with a little bubble/ with an angular shape /text
This is not an UML diagram at all, but an entity-relationship (E-R) diagram and typically shows the DB design. You can easily google it to find the detailed notstional rules, I could quickly find this page:
http://www.google.de/imgres?imgurl=http://docs.oracle.com/cd/B12037_01/java.101/b12021/img/entity_d.gif&imgrefurl=http://docs.oracle.com/cd/B12037_01/java.101/b12021/dev.htm&h=1780&w=1556&tbnid=vbXfAtrAAIq5_M:&zoom=1&tbnh=97&tbnw=85&usg=__vyr0LMggQHqYtI8Q6Ix-722jJwg=&docid=3LbfUSlxwqfpMM&client=firefox-a&sa=X&ei=iX1HU5awEImN7Qbf6IGwDg&ved=0CEsQ9QEwBA&dur=1439
If you want to model DB in UML, you can still do it, using class diagram and eventually restricting permited relationships to those available in non-OO modelling.

How to model family relationships in rails 3?

I'm working on a contact database in rails 3..
One thing thats really frustrating is how ugly the family relationship code is..
Is there a clean way of doing this in rails?
Basically all contacts are of the contact class (go figure!)
And contacts have many family_relationships (another model)
and many relatives through family_relationships.. The family relationship model also has one family relationship type (another model)
So far i've implemented this using the methods here http://railscasts.com/episodes/163-self-referential-association (using inverse relationships etc..)
But this just doesnt feel very clean.. and if i want to get all the contacts relatives, relationships etc.. i have to drop to raw SQL or join the arrays..
Is there a better (or definitive) way that this kinda thing is done in rails?
The Ancestry gem seems like it solves exactly this kind of problem:
Ancestry is a gem/plugin that allows the records of a Ruby on Rails ActiveRecord model to be organised as a tree structure (or hierarchy). It uses a single, intuitively formatted database column, using a variation on the materialised path pattern. It exposes all the standard tree structure relations (ancestors, parent, root, children, siblings, descendants) and all of them can be fetched in a single sql query. Additional features are STI support, scopes, depth caching, depth constraints, easy migration from older plugins/gems, integrity checking, integrity restoration, arrangement of (sub)tree into hashes and different strategies for dealing with orphaned records.

nHibernate <one-to-one> mapping

Please help me out
I am trying to do this but nHibernate not allowing can any one help me out how to do this?
Is it truly one-to-one in your data model is it one-to-one in your domain model?
I doubt you have two tables with same PK so you would not use one-to-one.
How to map it? HasOne x References

Entity Framework v4 examples and tutorials of conceptual model mapping

In an application I'm writing I have a fairly complicated Database model. I'd like to use EF4 to map this to a whole lot nicer conceptual model. However all the tutorials I've read are with samples of 2 or 3 tables which all map 1 on 1 to the conceptual model.
I'd like to learn how to correctly map the database model to a different conceptual model using VS 2010. However I can't find any good tutorials or (preferabally) instruction video's.
Somebody got any tips, links or even books?
Here are some interesting mapping scenarios.
TPT, TPC, TPH hierarchy mapping
Entity splitting
Multiple entity sets per type.