Solving indirect relations / many-to-many tables : How to solve this in icCube? - iccube

I need to create a subdimension in icCube, for example:
I have two dimensions, the dimension Student and the dimension Localization. The dimension Student has a foreign key from Localization dimension and the fact table join with student dimension. Also I want create a hierarchy in student dimension with attributes from localization dimension.
Example of the model with localization as subdimension :

You've two options.
One dimension / two hierarchies
You would create a table that is the result of the crossjoin of Student and Localization (in the upcoming icCube version we've a join view). You'll use this
table to create a Dimension Student that has two hierarchies Student and Localization. Check Exists to see implication (it's usually not very important).
With this you only need to link Students to the facts as the relaction between facts and localization is solved through students ( it handles one-to-many too).
Two dimensions
You can create two dimension. One for Student and the other of Localization. Both are independent.
To bind the fact to the location we need to use an intermediate mapping structure that can be directly defined in the facts (it's called 'bridge', see Time). The bridge table would be STUDENT, ID_STUDENT, ID, ID_LOCALIZATION, this helps to build a mapping between ID_STUDENT and ID_LOCALIZATION (that might be many-to-many)
hope it helps

Related

Difference between One-Mnay relationship & Many-Many relationship

I am just confused about One-One relationship and Many-Many relationship. Well if I have a users table and a course table, Do I have to add a third table to make it Many-Many relationship or I can just connect them with foreign keys and primary keys? I hope my question is clear to you.
One-to-Many example :-
Many to One example :-
Teacher teaches students is one to many relationship
And students learning from the teacher is many to one relationship
May be your dought is clear now!!
You are asking about many to many relationship. In this imaginary relation you have to follow following steps
1-create two tables(users,courses)
2-make third table which is called pivot table . that will contains the foreighn keys of both tables that shows the relation b/w two tables.
3-You also have to make relationships of one-to-many in both tables(users,courses).
I hope this helps if not visit this link you will understand.
https://onlinewebtutorblog.com/laravel-8-many-to-many-eloquent-relationship-tutorial/

icCube mapping a dimension attribute to a measure group

I'm trying to figure out the best way to link a dimension to a fact table and having some trouble finding an example in the documentation. All of my data sources are csv files and I have the following 2 data tables:
Areas table with columns: Area,DateTime,Cost (Area,DateTime are unique)
Company table with columns: CompanyID,Area (CompanyID is unique and represents a dimension)
I would like to link the Company Dimension to the Cost measure from the Areas table. However, it seems that I can only link the Company dimension to the Areas measure group through the dimension key, which is CompanyID. Is there a way around this or do I need to add a CompanyID column to my Areas csv file prior to loading.
thanks
I'm not really sure what you want to achieve but it looks as you could use a many-to-many cube to create a link from Area to Company (even though it might be a one-to-on relation).
1) Create a many-to-many cube using your Company table (Advanced/Many-to-Many)
2) Bind the Company dimension in the facts, Area table, using the defined many-to-many relation.
Some documentation here (the first image is wrong).
hope it helps.

How to design a datastore database relationship

So I have a question about designing a datastore database, I'm using objectify. I'm trying to get optimal performance.
So I need to create two entities, List and Listings, with a relationship. There will be 500,000 listings in all and 50,000 per list.
Looking at this https://code.google.com/p/objectify-appengine/wiki/IntroductionToObjectify#Multi-Value_Relationship
I see there are three methods to store relationship.
One to one, many to one and Multi-value relationship.
The Multi-Value relationship looks like it would work great but appears to have a limit of 5,000 entries per entity(List?)
So I assume I should use the many to one method but I question the performance on this as I would have to query every listing and filter.
Can I have good performance doing what I'm attempting with datastore?
Any help at all would be great!
Multi-value relationship in that case has no a good performance because each value implies a new line on its field index. It means longer write times. Also it has a limit of entries. It's useful when you have a few values to store.
There is another type of relationship: entity group.
The criteria to choose between each method also depends on the type of queries you do and the frequency of updating entities.
In base of the information you provide, I recommend many-to-one relationship.

Data Warehouse Design Question

In my OLTP database I have a layout consisting of instructors and students. Each student can be a student of any number of instructors. A student can also sign up for an instructor, but not necessarily book any tuition (lesson).
In a data warehouse, how best would this be modelled? If I create a dimension table for Lessons, Instructors and Students and a fact table for the lessons students have taken then this will work when an instructor wants to see what lessons a student has taken.
However, how will an instructor see how many students are REGISTERED with the instructor but has not yet taken a lesson?
In my OLTP, I have a many to many table (InstructorStudents) that links each student with one more more instructors. In an OLAP database, this isn't appropriate.
What would be the best schema in this case? Would a many to many be appropriate in this instance? I can't store a list of which students are registered to which instructors in the student table, so I feel another dimension table is necessary but cannot work out what should be contained in it.
If a fact represents a transaction, you seem to have two different facts here: Sign ups & Lessons. There are always a lot of ways to go but, perhaps, you need two fact tables. They may have similar dimensionality except the sign-up table will have a Class dimension (class name, instructor name, etc.). The Lessons table will tie to the class dimension but, also, to a Lesson dimension (date, classroom used, etc.).
There are a few other ways to do this but they will be more difficult from a programming & reporting perspective.
You need a many to many dimensional model.
You need a factless fact table. Look at the following resource that refers to an example close to your need
http://www.kimballgroup.com/1996/09/02/factless-fact-tables/

Cube Design - Bridge Tables for Many To Many mapping with additional column

Am making a cube in SQL Server Analysis Services 2005 and have a question about many to many relationships.
I have a many to many relationship between two entities that contains an additional descriptive column as part of the relationship.
I understand that I may need to a bridge table to model the relationship but I am not sure where to store the additional column - in the bridge table or elsewhere?
Many To Many relationsip in SSAS can be implemented via an intermediate fact table that contains both dimension key that subject to the relation.
For example; If you have a cube that has a book-sales-fact table and you want to aggregate total sales by author (which may have many books and a book may be written by many authors) you should also have a author-book intermediate fact table (just like in relational database world). In this bridge table, you should have both dimension keys (Author and Book) plus some measure related to the current book and author such as wages paid to the author to write the book (or chapters).
As a result, if your additional column is kind of a measure you should add that column to the intermediate fact table.

Resources