This video serves as a tutorial for using the Dia diagram editor, the recommended tool for creating ER diagrams in CS1032. It walks viewers through setting up Dia, creating entities and their attributes, establishing relationships between entities using Crow's Foot notation, saving the diagram, and finally exporting it as an image. The tutorial utilizes a fictional doctor's office scenario, referencing a previous ERD tutorial.
.dia file, which is the required submission format for assignments. It also demonstrates how to export the diagram as a non-editable image file (like .png) for sharing purposes, though this is not to be submitted for assignments.[Music] foreign we'll be going over how to use the DIA diagram editor this is the recommended tool for cs1032 to create ER diagrams we'll be using the scenario from the previous ERD tutorial that involves a fictional doctor's office so if you haven't seen that tutorial yet make sure to give it a watch before continuing with this one so after you've installed the DIA editor there should be a Dia edit icon on your Windows desktop if this doesn't show up go to the windows search menu and type in DIA and click the icon so Dia is also available for Linux and Mac but I'm only going to be giving instructions in this tutorial for the Windows operating system once you have the DIA editor open it should be pretty much the same for all platforms so the first thing to draw your attention to is this drop down menu right here so by default we're going to be in flowchart mode and we don't want to be in flowchart mode we want to be in a database mode so we can make er diagrams so the first thing to do is go to this drop down and go to other sheets and select database now you will notice that there are some other options in other sheets like er don't select ER we have to select database so for the type of er diagrams we're going to be making in this course we have to have database selected so the first thing we want to do is add the nurse entity from our doctor office example to do this select the database button that's now available since we select database and click anywhere on this white space should get this little box that says table now to start renaming it and adding attributes double click on it bring up the properties and the first box you'll see up here first text field is the name of this entity or the name of this table so since we're following that doctor's office example we want to call this nurse and we should be following our capitalization rules that we've been following for the other tutorials so object entities like nurse should be in all capitals the attributes tab right here will allow us to add attributes to this entity so we click the new button to add a new attribute in this case the name is going to be the name of the attribute we're going to start with the primary key so we'll call that nurse ID and the buttons down here or the check boxes down here allow us to select different properties for the attribute so since this is going to be the primary key we are going to select primary key and click apply so one thing you'll notice is that the actual diagram doesn't update until you actually hit the apply button so we're going to keep on going and add all the attributes for the nurse first name and since this is not nullable that means it has to have a value in the database we are going to uncheck nullable add last name add doctor ID and we're going to add hours per week now in the case of hours per week this one is going to be nullifiable because it's only filled in if no so we are going to leave that checked and select apply and we can see that the little table or the little box updated with all of the attributes that we put in now there's also a Styles tab available this allows us to change how it will actually look so I don't care too much how your ER diagrams look as long as they are readable so it's very important that the TA who's going to be marking your assignment be able to read them so the only big style changes you're going to need to change are just anything to make it a little bit more readable so in this case maybe we want to increase the size of the diagram so we can increase the fonts in this menu here so we're going to increase them a bit to maybe 1.5 4 and 1.4 and apply that and you can see that the table got bigger as the fonts increased okay so we're going to do the same thing for the other tables and I might fast forward this a bit since it's going to be the same thing you just saw [Music] [Applause] [Music] foreign [Music] so our last entity that we have to add is our relationship entity called orders and since this is a relationship entity it gets an all lowercase name now we have to add those foreign Keys the first one was Doctor ID and we're going to make sure it's not nullable and the other foreign key was test ID again not nullable now this entity also had a relationship attribute and that was date and again that was not nullable because it was required so apply that and we'll also change the style a little bit just so it's a little bit bigger font makes it easier to read go with 1.5 and 1.4 assignments make sure that you read any instructions about certain font sizes or styling rules okay there we go and now we can start adding those relationships so we can move our entities around just by clicking on them and then dragging them wherever we want we can also in view select snapped grid this option will make sure that our tables always snap to these grid points that we can see in the background so this can be useful if you want to position tables in exact locations but it isn't required it's just a graphical option the next thing we need to do is start adding some of our relations so the first relation we're going to add is between nurse and doctor so you might be tempted to click this little button down here under database which looks like a relation however this won't be used the Crow's foot notation that where it's required for our diagrams so instead you have to use this line tool up here so make sure you are using the line tool that's this right here and you are not using this one down here so once you have the line tool selected you can start by drawing from one entity to another and you do want to make sure that it like turns red because that means you are snapping to that so that means the line will be connected and it will always move around with that entity when you want to move it if it's not connected then the line will break when you move the entity it's not a big deal but it could be a bit annoying I want to make sure that's snapped on both sides now to actually get into the settings double click on the light and this will give you a few options so the first thing we'll note is that when we first drew it is just like a common Arrow it's not using Crow's foot notation so to fix that we want to go down to these different options here for start arrow and end Arrow start arrow is the part of the arrow that we started drawing in at so this would be the point where we started drawing and end Arrow would be the point where we stop Drawing the Line so for start we want this to be a many toe and many carnality and a one participation so I'll go into the options click more arrows and we'll see down here there is many and a one so the might seem like it's not the right one because it's facing the wrong direction but you'll notice all of these are on the right hand side so even though this is on the right hand side it will still draw it on the left hand side so long as it's the starting arrow in this case and remember it's not going to update until we hit apply um so for the end arrow and this one it's a one um cardinality and one participation from the nurse to the doctor so we'll go again to more arrows and we will select the one one right down here the two one symbols and when we hit apply it's hard to see but it did change them now since that's really hard to see it's not that readable we are probably going to want to increase the size so these options here for size change the size of the actual um symbol the many symbol or the one symbol so we can change that to one for example and this is just going to change it visually so you can see that they just got bigger once I hit apply you can also change the width of the line up here consider example set it to 1.5 and that makes everything a little bit thicker so it's a bit up to you about how you want to style it just make sure it's readable and it's really easy to tell what kind of relationship it is so you'll notice that this line isn't all that even so one thing we can do is we can just drag around our entities until it looks a little more straight you can sort of just eyeball it or you could try using the snap 2 feature to try to get it exact all that's required is that it's legible next we're going to add in the relationships for the other two so again we start by selecting the line tool or undoctor and we drag it to orders make sure we get that red box to show that it's snapped double click on the line sludge type of Arrow so in this case it's going to be on this side uh one cardinality one participation and the arrows that we've recently used are going to be right in the menu at the beginning so since we've already used that one it's already available for us and for the end Arrow it's going to be a meti cardinality with a zero participation so that's going to be in more rows and we'll select it and it won't show up until we hit apply and again it's a bit small I'm going to change the size to 1. and we'll change the line width to 1.5 and we'll apply that once again we'll just try to straighten it out that looks okay now we need to do the relationship between orders and tests select the line tool again draw the line make the adjustments so in this case we want it to be one and one on that side and we want it to be minion one on that one change these to one to make it a bit bigger and this to 1.5 and apply we can straighten it out a little bit and the last thing we need to do is actually put a name on this works relationship or works for relationship so it's not required on these two because we have the entity um the relationship entity that describes the relationship but on the one to one or one to many relationships we should label them so we can do that with the text tool so you just select the text tool you click where you want the text to be and you should see a little yellow box type works for or whatever your relationship may be and you click away and you can see the text here but it's a bit small so we'll double click on that I'll bring up some properties and we're going to increase the font size let's say all the way up to 35. we could do other things like change font um we could change colors but for now we just want to make sure it's readable apply okay and if we want to move it around we have to click on it and drag and we just drag it right above so at this point we've completed our ERD diagram but there's still a little bit of housekeeping steps we have to do before we were able to submit this for an assignment for example so the first one is the assignments are going to require that you have your name and student number on your diagram so the way we do this is with the text tool we click somewhere where we want our name to go type our name our student number and our Western user ID so that'd be the user ID you use to log into owl or your Western email if we wanted that text to be a bit bigger we just double click and we can change the font size so for example I'm going to change it to 30 points so one thing to keep in mind is for the assignment one requirement is that your diagram has to be legible and readable by the teaching assistant who's going to be marking it so that means you have to make sure all your lines text and everything is large enough for them to see so for these sort of arrows and lines a good guideline is to be at least 0.7 in size in this case we're using one so that's fine that's greater than 0.7 and the font should also be renewable too so now that we have it completed we have to save it so you can either click the save button here or you can go file save and this will bring up a little file system Navigator and that will allow us to choose where we're going to save the file so in this case by default it wants to save it in pictures so the assignment like assignment 2 for example is going to have a naming scheme when you're saving this file it'll usually be something like your username followed by your company name and then B2 so make sure you look at the assignment document for the exact naming scheme because it could be different from assignment to assignment so make sure you're following the naming scheme given in the assignment you're working on and then just hit save so that dot Dia file that we just created is the file that will be able to reopen in the Gia editor and it'll also let us make changes to our file or anything like that it's sort of an editable file whereas if we were to save it as an image file that would be a fixed image that we can't really edit one again so when you're submitting your assignment you have to submit the dot Dia file the dot DF file and not an image file so if we take a look at where I saved it in my pictures folder you can see the file here D servos 5-4 City widgets- A2 dot Gia so that would be the correct file to submit if you see other files like dot autosave or dot sort of a weird symbol then dot Dia those are sort of auto save files or backup files that Dia creates automatically for you some cases we don't want to submit those we want to submit the dot Dia file so make sure you're submitting a Dia file and after you've submitted it or uploaded it to owl make sure you download it again and check that it's working in your editor before you hit that submit button because it is your responsibility to make sure that the file is working correctly and you submitted the correct file so the next part I'm going to show you is how you can export this into an image this is not required in the assignment and you should be submitting that.dia file not the image file so this is just for your own personal use if you wanted to use this in real life when you're working on a project or something and you want to share what you've done with someone else who doesn't have the DS software you could do this to export it as an image and then it could be openable in any kind of image viewer or browser to export this as an image we go file export and then we can pick what kind of image file type by default it's saying.png which is probably a good choice but there's other options available like dot bmp.gif um dot jpeg things like that in this case we're going to save it as dot PNG ask us what size to make the image it's going to go with the defaults so you can see here we now have the dot Dio file and the dot PNG file dot PNG file is that image we just exported and it should be able to be opened in any sort of image viewer or browser so we double click on Windows should open up your default image viewer and we can see it right here so once again this image file is not an editable file you can't reopen it India but it is something you could share with other people if you want to show them your design however for the assignment you have to submit the dot Dia file so don't submit the dot PNG submit the DOT dfil so that's all I have for you in this video thank you for watching and have a great day [Music] [Music]
Here are three sections of the transcript that you can use for uploading to a chat interface for note generation:
Section 1: Introduction and Setup
foreign we'll be going over how to use the DIA diagram editor this is the recommended tool for cs1032 to create ER diagrams we'll be using the scenario from the previous ERD tutorial that involves a fictional doctor's office so if you haven't seen that tutorial yet make sure to give it a watch before continuing with this one so after you've installed the DIA editor there should be a Dia edit icon on your Windows desktop if this doesn't show up go to the windows search menu and type in DIA and click the icon so Dia is also available for Linux and Mac but I'm only going to be giving instructions in this tutorial for the Windows operating system once you have the DIA editor open it should be pretty much the same for all platforms so the first thing to draw your attention to is this drop down menu right here so by default we're going to be in flowchart mode and we don't want to be in flowchart mode we want to be in a database mode so we can make er diagrams so the first thing to do is go to this drop down and go to other sheets and select database now you will notice that there are some other options in other sheets like er don't select ER we have to select database so for the type of er diagrams we're going to be making in this course we have to have database selected
Section 2: Creating Entities and Relationships
so the first thing we want to do is add the nurse entity from our doctor office example to do this select the database button that's now available since we select database and click anywhere on this white space should get this little box that says table now to start renaming it and adding attributes double click on it bring up the properties and the first box you'll see up here first text field is the name of this entity or the name of this table so since we're following that doctor's office example we want to call this nurse and we should be following our capitalization rules that we've been following for the other tutorials so object entities like nurse should be in all capitals the attributes tab right here will allow us to add attributes to this entity so we click the new button to add a new attribute in this case the name is going to be the name of the attribute we're going to start with the primary key so we'll call that nurse ID and the buttons down here or the check boxes down here allow us to select different properties for the attribute so since this is going to be the primary key we are going to select primary key and click apply so one thing you'll notice is that the actual diagram doesn't update until you actually hit the apply button so we're going to keep on going and add all the attributes for the nurse first name and since this is not nullable that means it has to have a value in the database we are going to uncheck nullable add last name add doctor ID and we're going to add hours per week now in the case of hours per week this one is going to be nullifiable because it's only filled in if no so we are going to leave that checked and select apply and we can see that the little table or the little box updated with all of the attributes that we put in now there's also a Styles tab available this allows us to change how it will actually look so I don't care too much how your ER diagrams look as long as they are readable so it's very important that the TA who's going to be marking your assignment be able to read them so the only big style changes you're going to need to change are just anything to make it a little bit more readable so in this case maybe we want to increase the size of the diagram so we can increase the fonts in this menu here so we're going to increase them a bit to maybe 1.5 4 and 1.4 and apply that and you can see that the table got bigger as the fonts increased okay so we're going to do the same thing for the other tables and I might fast forward this a bit since it's going to be the same thing you just saw [Music] [Applause] [Music] foreign [Music] so our last entity that we have to add is our relationship entity called orders and since this is a relationship entity it gets an all lowercase name now we have to add those foreign Keys the first one was Doctor ID and we're going to make sure it's not nullable and the other foreign key was test ID again not nullable now this entity also had a relationship attribute and that was date and again that was not nullable because it was required so apply that and we'll also change the style a little bit just so it's a little bit bigger font makes it easier to read go with 1.5 and 1.4 assignments make sure that you read any instructions about certain font sizes or styling rules okay there we go and now we can start adding those relationships so we can move our entities around just by clicking on them and then dragging them wherever we want we can also in view select snapped grid this option will make sure that our tables always snap to these grid points that we can see in the background so this can be useful if you want to position tables in exact locations but it isn't required it's just a graphical option the next thing we need to do is start adding some of our relations so the first relation we're going to add is between nurse and doctor so you might be tempted to click this little button down here under database which looks like a relation however this won't be used the Crow's foot notation that where it's required for our diagrams so instead you have to use this line tool up here so make sure you are using the line tool that's this right here and you are not using this one down here so once you have the line tool selected you can start by drawing from one entity to another and you do want to make sure that it like turns red because that means you are snapping to that so that means the line will be connected and it will always move around with that entity when you want to move it if it's not connected then the line will break when you move the entity it's not a big deal but it could be a bit annoying I want to make sure that's snapped on both sides now to actually get into the settings double click on the light and this will give you a few options so the first thing we'll note is that when we first drew it is just like a common Arrow it's not using Crow's foot notation so to fix that we want to go down to these different options here for start arrow and end Arrow start arrow is the part of the arrow that we started drawing in at so this would be the point where we started drawing and end Arrow would be the point where we stop Drawing the Line so for start we want this to be a many toe and many carnality and a one participation so I'll go into the options click more arrows and we'll see down here there is many and a one so the might seem like it's not the right one because it's facing the wrong direction but you'll notice all of these are on the right hand side so even though this is on the right hand side it will still draw it on the left hand side so long as it's the starting arrow in this case and remember it's not going to update until we hit apply um so for the end arrow and this one it's a one um cardinality and one participation from the nurse to the doctor so we'll go again to more arrows and we will select the one one right down here the two one symbols and when we hit apply it's hard to see but it did change them now since that's really hard to see it's not that readable we are probably going to want to increase the size so these options here for size change the size of the actual um symbol the many symbol or the one symbol so we can change that to one for example and this is just going to change it visually so you can see that they just got bigger once I hit apply you can also change the width of the line up here consider example set it to 1.5 and that makes everything a little bit thicker so it's a bit up to you about how you want to style it just make sure it's readable and it's really easy to tell what kind of relationship it is so you'll notice that this line isn't all that even so one thing we can do is we can just drag around our entities until it looks a little more straight you can sort of just eyeball it or you could try using the snap 2 feature to try to get it exact all that's required is that it's legible next we're going to add in the relationships for the other two so again we start by selecting the line tool or undoctor and we drag it to orders make sure we get that red box to show that it's snapped double click on the line sludge type of Arrow so in this case it's going to be on this side uh one cardinality one participation and the arrows that we've recently used are going to be right in the menu at the beginning so since we've already used that one it's already available for us and for the end Arrow it's going to be a meti cardinality with a zero participation so that's going to be in more rows and we'll select it and it won't show up until we hit apply and again it's a bit small I'm going to change the size to 1. and we'll change the line width to 1.5 and we'll apply that once again we'll just try to straighten it out that looks okay now we need to do the relationship between orders and tests select the line tool again draw the line make the adjustments so in this case we want it to be one and one on that side and we want it to be minion one on that one change these to one to make it a bit bigger and this to 1.5 and apply we can straighten it out a little bit and the last thing we need to do is actually put a name on this works relationship or works for relationship so it's not required on these two because we have the entity um the relationship entity that describes the relationship but on the one to one or one to many relationships we should label them so we can do that with the text tool so you just select the text tool you click where you want the text to be and you should see a little yellow box type works for or whatever your relationship may be and you click away and you can see the text here but it's a bit small so we'll double click on that I'll bring up some properties and we're going to increase the font size let's say all the way up to 35. we could do other things like change font um we could change colors but for now we just want to make sure it's readable apply okay and if we want to move it around we have to click on it and drag and we just drag it right above
Section 3: Saving, Final Touches, and Exporting
so at this point we've completed our ERD diagram but there's still a little bit of housekeeping steps we have to do before we were able to submit this for an assignment for example so the first one is the assignments are going to require that you have your name and student number on your diagram so the way we do this is with the text tool we click somewhere where we want our name to go type our name our student number and our Western user ID so that'd be the user ID you use to log into owl or your Western email if we wanted that text to be a bit bigger we just double click and we can change the font size so for example I'm going to change it to 30 points so one thing to keep in mind is for the assignment one requirement is that your diagram has to be legible and readable by the teaching assistant who's going to be marking it so that means you have to make sure all your lines text and everything is large enough for them to see so for these sort of arrows and lines a good guideline is to be at least 0.7 in size in this case we're using one so that's fine that's greater than 0.7 and the font should also be renewable too so now that we have it completed we have to save it so you can either click the save button here or you can go file save and this will bring up a little file system Navigator and that will allow us to choose where we're going to save the file so in this case by default it wants to save it in pictures so the assignment like assignment 2 for example is going to have a naming scheme when you're saving this file it'll usually be something like your username followed by your company name and then B2 so make sure you look at the assignment document for the exact naming scheme because it could be different from assignment to assignment so make sure you're following the naming scheme given in the assignment you're working on and then just hit save so that dot Dia file that we just created is the file that will be able to reopen in the Gia editor and it'll also let us make changes to our file or anything like that it's sort of an editable file whereas if we were to save it as an image file that would be a fixed image that we can't really edit one again so when you're submitting your assignment you have to submit the dot Dia file the dot DF file and not an image file so if we take a look at where I saved it in my pictures folder you can see the file here D servos 5-4 City widgets- A2 dot Gia so that would be the correct file to submit if you see other files like dot autosave or dot sort of a weird symbol then dot Dia those are sort of auto save files or backup files that Dia creates automatically for you some cases we don't want to submit those we want to submit the dot Dia file so make sure you're submitting a Dia file and after you've submitted it or uploaded it to owl make sure you download it again and check that it's working in your editor before you hit that submit button because it is your responsibility to make sure that the file is working correctly and you submitted the correct file so the next part I'm going to show you is how you can export this into an image this is not required in the assignment and you should be submitting that.dia file not the image file so this is just for your own personal use if you wanted to use this in real life when you're working on a project or something and you want to share what you've done with someone else who doesn't have the DS software you could do this to export it as an image and then it could be openable in any kind of image viewer or browser to export this as an image we go file export and then we can pick what kind of image file type by default it's saying.png which is probably a good choice but there's other options available like dot bmp.gif um dot jpeg things like that in this case we're going to save it as dot PNG ask us what size to make the image it's going to go with the defaults so you can see here we now have the dot Dio file and the dot PNG file dot PNG file is that image we just exported and it should be able to be opened in any sort of image viewer or browser so we double click on Windows should open up your default image viewer and we can see it right here so once again this image file is not an editable file you can't reopen it India but it is something you could share with other people if you want to show them your design however for the assignment you have to submit the dot Dia file so don't submit the dot PNG submit the DOT dfil so that's all I have for you in this video thank you for watching and have a great day [Music] [Music]