Skip to content
This repository has been archived by the owner on Jul 25, 2018. It is now read-only.

Sequelize models for relationships #28

Closed
Gillian0023 opened this issue Mar 27, 2017 · 15 comments
Closed

Sequelize models for relationships #28

Gillian0023 opened this issue Mar 27, 2017 · 15 comments

Comments

@Gillian0023
Copy link
Contributor

Group4 is here, Can anyone from group1 and group2 answer our following questions?Thanks
1.Do we need to create our separate sequelize models in the model folder? or we can create our model directly in the buildRelation.js file.
2.How can we get access to the database? Are the attributes' names defined in the sequelize models same as the ones in database?
@MusicConnectionMachine/group-1 @MusicConnectionMachine/group-2

@ShilpaGhanashyamGore
Copy link
Contributor

@Gillian0023 - From group1. We are working on hosting our server on the Azure cloud.
Using that you will be able to access the database.
Yes attributes name in sequelize models is same as the attribute names in the schema
@TimHenkelmann - Maybe you could help with the question regarding creating models.

@TimHenkelmann
Copy link
Contributor

Well, depends what you want to create :D If it's a seperate entity, then please create a seperate .js file for it. If it's just a relation between two entities that already exist, you can either just add it to the buildRelations.js file or create your own group4Relations.js file (which might be a good idea such that the other file does not get too big).
More information on how to create relations can be found here

@Sandr0x00
Copy link

@MusicConnectionMachine/group-3
maybe this is interesting for you guys as well, since we use more or less the same db-connection

@kordianbruck
Copy link
Contributor

@Gillian0023 yes, you will need to write your own models. If you talk to group 3 you can both use the same structure, which will be nice for the vis groups.

Please assign someone that will do the work or I will have to 😬

@Gillian0023
Copy link
Contributor Author

We can create a following relationship table;
Relationships(id,subject_id,object_id,relationship_type,relationship_name,weights or qualities or occurrences)
Any ideas from you? we need the same structure for both groups
@MusicConnectionMachine/group-3 @MusicConnectionMachine/group-4

@ansjin
Copy link
Member

ansjin commented Mar 27, 2017

That looks great!!!
But I have few doubts:

  1. We could have a relationship in which the subject/object may not be present in the already defined tables. So should we create a separate table for them or should we only keep those subjects/objects which are already defined or should we append to the already existing ones?

  2. For the relationship_type we can create a separate table and reference it to the main relationships table relationship_type table could have <id, relationship_type>. What do you think ?

  3. If I understood correctly the relationship_name is the word which we will find in a sentence and then that word will be mapped to a particular type of relationship. Correct? Like relationship_type: Taught and the names can be (studied under, learned from etc)

May be we can structure it like:

Relationship_Table ( Id, Subject_Id, _Object_Id, Relationship_Type_Id, Relationship_Occurrence, Relationship_Quality)
Relationship_Type_Table<Id, Relationship_Type>
Relationship_Description_Words_Table<Id, Relationship_Type_Id, Relation_Name>

What do you think ?

@Gillian0023
Copy link
Contributor Author

@ansjin thanks, really important points
For 1 I thought group1 has already created entity table which we can use directly. We need to keep those subjects/objects which are already defined, because our all data sources come from group1 and group2, right?
For 2 and 3 relationship_type and relationship_name I defined are exactly what you understood. And I agree to create seperate tables for them which matches database normalization.
What are others' opinion? If you agree, I will create sequelize models like:

Relationship_Table ( Id, Subject_Id, _Object_Id, Relationship_Type_Id, Relationship_Occurrence, Relationship_Quality)
Relationship_Type_Table<Id, Relationship_Type>
Relationship_Description_Words_Table<Id, Relationship_Type_Id, Relation_Name>
@MusicConnectionMachine/group-3 @MusicConnectionMachine/group-4

@ansjin
Copy link
Member

ansjin commented Mar 28, 2017

@Gillian0023 Yes, I agree with you.

Only one thing we missed in the Relationship_Table is the URL_Id, which will reference to the URL's table.
As discussed here(#22), it is required by group 5 and group 6

So Now the table will look something like this :

Relationship_Table ( Id, Subject_Id, _Object_Id, Relationship_Type_Id, Relationship_Occurrence, Relationship_Quality, URL_Id)

Rest everything looks great!!!

@Gillian0023
Copy link
Contributor Author

Ok, group2 has created the tables #26, we can set our attibute name to page_id

@ansjin
Copy link
Member

ansjin commented Mar 28, 2017

@Gillian0023 yeah Correct!

@Henni
Copy link
Contributor

Henni commented Mar 28, 2017

Relationship_Type_Table<Id, Relationship_Type> should also contain a property directed to specify whether that relationship type is directed (e.g. 'met' vs 'taught')

@Sandr0x00
Copy link

Sandr0x00 commented Mar 28, 2017

Can we start implementing this? Who will do it? Maybe we should do it together?
Maybe it's best if we meet tomorrow? I saw you meet tomorrow by 10 AM in Garching? We too meet tomorrow by 10 AM (normally we meet in the Mensa-Cafeteria in Arcistr.: eduroam, nice atmosphere, food nearby and a bit more central than Garching).
What do you all (@MusicConnectionMachine/group-3, @MusicConnectionMachine/group-4) think?
I created an API-Gitter-Room in which we can communicate better (at least I think).
I hope this was ok, @kordianbruck / @sacdallago

@FelsyWaschbaer
Copy link
Contributor

@ansjin doubt 1: I think we're supposed to keep also relations where subject/object are not already defined and they probably make up the biggest part of all relations. As I understand from #33 they want to build something like that now and the relations for unknown subjects/objects could be used there. But since we have no IDs for them maybe we can save them in a different table just as text.

@ansjin
Copy link
Member

ansjin commented Mar 29, 2017

@FelsyWaschbaer yeah true!!! As far as I remember @vviro also mentioned that we should dump our complete data in database . So i think probably we either need to append in the already existing subject and object table or we have to create new ones!

@Henni
Copy link
Contributor

Henni commented Mar 29, 2017

awesome work @Gillian0023
let's count this as fixed and continue discussion in the follow-up issue #39

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants