I'm confused with the ofbiz data model.
PARTY RELATIONSHIP is a relationship from one PARTY to a another PARTY corresponding to a pair of PARTY ROLEs.
Entity PARTY RELATIONSHIP will have PARTY_ID_FROM, PARTY_ID_TO, ROLE_TYPE_ID_FROM, ROLE_TYPE_ID_TO and PARTY_RELATIONSHIP_TYPE_ID which is stored in PARTY RELATIONSHIP TYPE entity.
But in that entity is also stored ROLE_TYPE_ID_VALID_FROM and ROLE_TYPE_ID_VALID_TO.
Could have duplicate data in there ?
And would PARTY_RELATIONSHIP_TYPE_ID be a part of the key to the PARTY RELATIONSHIP entity?
A PARTY RELATIONSHIP joins only two other entities:
1) A PARTY RELATIONSHIP TYPE which associates two ROLE TYPES: e.g. supplier to customer or employee to department.
2) The actual PARTIES participating in the relationship ROLES: e.g. ABC COMPANY as supplier and Thang Nguyen as customer.
These parties in their respective roles are what's represented by the PARTY ROLE entity.
This PARTY ROLE entity may be expressed in a table, in which case you would have PARTY ROLE ID's for each of the two parties in the relationship. Or the party role may not have a separate table and only be realized in the Party Relationship table, in which case it will have, as you specify, a PARTY and ROLE TYPE ID for each of the parties in the relationship.
You won't have duplicate data in the PARTY RELATIONSHIP entity because FROM DATE is part of the key and would be unique in combination with the two PARTY ROLES.
The from and to dates are for that party relationship, not party relationship type.
Related
Occasionally Salesforce Object have polymorphic relationships with other Salesforce Objects. In a polymorphic relationship, the referenced object of the relationship can be one of several different types of object. These polymorphic relationships are defined using polymorphic fields contained in a Salesforce Object. A polymorphic field is one where the related object might be one of several different types of objects. For example, the Who relationship field of a Task can be a Contact or a Lead. Similarly the What relationship field of a Task can be any non-Person Object in Salesforce.
What is the best way to model these Salesforce polymorphic relationship in the Data Vault methodology?
we also use Salesforce at Scalefree internally and turn this into a Data Vault 2.0 model. In a data-driven Data Vault 2.0 model (that is what we teach and preach) you have two choices - either you consider the Who -related object as a generalized object. That would require a generalized hub, which is later linked (in the Business Vault ) to the Contact or Lead hub (in the Raw Data Vault) by using business logic (that is why the link belongs into the Business Vault).
The other option is to store the Salesforce ID (the char(18)) into a satellite and just ignore that this is a relationship - at least in the Raw Data Vault. In the Business Vault you calculate the links between task and contact or lead based on the satellite data and with business logic (how to distinguish leads from contacts essentially, which is simple).
Hope that helps,
Michael Olschimke
When you do you modelization with data vault, do not rely on the modelization of the source system, but rather on business entity and process.
In this particular case, " For example, the Who relationship field of a Task can be a Contact or a Lead.", the keyword is "relationship", meaning a link.
Based on what you describe, I will expected that you have a hub Task, a hub Contact and a hub Lead. Depending on what is you business process and the unit of work, you might have a link Task-Contact and another link Task-Lead.
then, when you fetch the data, simply insert into the right link (if it doesn't already exists).
In a hypothetical scenario where a business requires people to have a membership to use their service, there are three types of memberships: student, corporate, and individual. Student membership is free, but corporate and individual memberships incur a fee.
In order to implement this on an entity relationship diagram, would the following be appropriate?:
This solution utilizes subtypes/supertypes, with students, corporate, and individuals being subtypes of the membership supertype.
If there is a more appropriate way to handle this, please provide it. I am trying to learn the best practices for database design.
In standard ER modeling, the situation you describe is called generalization/specialization. Students memberships, Corporate memberships, and Individual Memberships are all specialized forms of memberships. In ER diagrams (actually EER diagrams) this is depicted as follows: Diagram
This diagram is for a different case from yours, but the concept of generalization is the same.
So we are developing a KPI and Initiative management system for a client.
In the image you can see the data model we've built based on the client's needs.
Basically this is the hierarchy of our data model: Strategic Objective linked to one entity > KPI > Initiative
Recently we've discovered from the customer that the strategic objective and KPI could be shared between more than one entity, but in the end for each entity there is a different Initiative.
I don't know how to reflect this in the data model. But I came up with three possible solutions:
1- Breaking down the Strategic Objective and Entity relation from one-to-many to many-to-many. And also the Strategic Objective and KPI relation to many-to-many, but this does not solve my problem. As in the end I want to model that for example SO1 is shared between entity1 and entity2, so is the KPI but not the Initiative.
2- EntityOwner table, that basically maps the Strategic Objective or KPI or Initiative to the entity directly.
3- Instead of mapping the entity to the strategic objective, we map it to the Initiative.
The Datamodel
Why not remove the relation between the KPI and Initiative and instead create one between Entity and Initiative?
Such model resembles the fact that KPIs seem to be in the domain of business performance while initiatives lie more on the side of programmes / projects office. In other words a business creates initiatives to satisfy strategic objectives not KPIs. KPIs are for visibility.
I would also query whether Strategic Objectives should have direct relationship with Entities, or whether there should be relationship SO -
- INITIATIVE -- ENTITY.
I have a database which I want to visualize in some kind of tool. Let me explain the basic:
Company A does business with Transport Company A and Transport Company B.
Transport Company A does business with Company A, Company B and Company C.
Company C does business with Transport Company A and Transport Company B.
As you can see every Company does business with different Transport Companies and vice versa. These relationships can be implemented in a database, and when drawing a visual model on paper this is also very easy.
Of course the model should contain hundreds of Companies and Transport Companies. So I want to have a visualizing tool, where a overview of these relations can be displayed.
My question is which tools can be used for realizing this?
I think you want to look at Microsoft Visio (get the 2010 version. 2013 is almost unusable from a database standpoint).
But if i am assuming correctly, you want to create a table per company. Don't do this! this can cause redundancy and data integrity problems. you want to create just one table and create what is called a unary many-to-many relationship. This is relationship that can be translated to many different rows can relate to many rows in the same table. I won't go into more detail unless you want me to, as i spent a week or 2 in my Database Design course last month just on many-to-many relationships and gets kinda complicated.
I am designing an intranet application. This intranet is for a parent company which will have multiple sub companies under it. Each employee will belong to a company. I need to store only the name of the company as of now.
Now to maintain external relations to partners and clients we need to store their company. Here also, I need to store only the name.
My questions is - Is it better to keep these in two separate tables one company table for internal and the other for external? Or is it better to have one table and identify internal and external companies with a FLAG.
The generic question being if two tables have the same structure but belong to differ
Please suggest.
Thanks!
Better, in a sense of normalized database design, would be to have one company table and second table of company types instead of a flag column. You'll be able to distinguish external partners later without having to add another flag.