Subject | Hash | Author | Date (UTC) |
---|---|---|---|
Factorizing some aspect, separating fugires, re-wrote makefil, added treatment for html and odt outputs. | 91d14fa349fe376408bcc48e4ada948777bda5a0 | au | 2018-12-17 02:57:14 |
Fixing project archeticture, tayloring README and moving typesetting section from lecture notes to README. | c00c920db70a59ee8626134287aa47455fcb3e03 | au | 2018-12-16 19:51:52 |
Fine-tuning makefile | 2ce6e9dea5235a97c02b97e548567ff4584c3153 | au | 2018-12-16 05:41:35 |
Fixing | da441e5483d8153bff9b25f50230f584c4d67c5e | au | 2018-12-16 05:38:00 |
re-adding templates. | bfe4f6aa774c7befef9eda07f31edb5c9907cedb | au | 2018-12-16 05:30:19 |
Restore er tex files. | 771634fed59ac3a00fa3fa8ee292e98c4e35e3d6 | au | 2018-12-16 05:26:43 |
Changing vect. format from SVG to PDF. | fa1276c21b6d139d52bd2c0405a9eb694e1a932d | au | 2018-12-16 05:25:50 |
Fixing minor typos | 3fd56098f9022b48fadff8e3ea10fd7fcd49213a | au | 2018-12-16 04:05:47 |
Re-organization of the project. | ccb3e4e35a17076f72b836720948ba7cfe86155b | au | 2018-12-16 03:16:19 |
Ending reporting notes on paper, added planned schedule, added meta-info and made tthe pdf TOC deeper. | 96ffdff901b7e059471c34d7f7df6771ded38783 | aubert@math.cnrs.fr | 2018-05-30 15:46:13 |
Starting to work on ER def, adding some diagrams. | 4a938b9a338846c988800a1cc4d0c5f9fcd31f8d | aubert@math.cnrs.fr | 2018-05-29 21:16:02 |
Finished SQL, started Design. | 00c36f130c3f88bd548d009eb80e910db64ec823 | aubert@math.cnrs.fr | 2018-05-25 20:46:33 |
Adding the temp file, trying to patch the numbering of exercises inside problems. | e4e4624cd1037e65a45e8690f2b92e183714b486 | aubert@math.cnrs.fr | 2018-05-24 19:22:13 |
Cleaned up the code, fixed some typos, added a list of problems, started working onthe problem for SQL. | 701556c081df0bbf8e8800106c7aa4c997e560de | aubert@math.cnrs.fr | 2018-05-24 07:21:26 |
Finishing exo for chapter SQL | aea58f58f06d99615ae7cb85247bdc08c5ce9d96 | aubert@math.cnrs.fr | 2018-05-23 17:52:51 |
Progress on the SQL chapter. | e13cddc35a709c6714a90b21d8ed8db6b037793c | aubert@math.cnrs.fr | 2018-05-23 05:12:21 |
Started type some relational model examples in latex, reviewed chapter 1 and 2. | 1ddf3000e0cb4f8f02b2b2de1ffd8ae14a81c9dc | aubert@math.cnrs.fr | 2018-05-22 21:09:12 |
Finished correcting Chapter 1. Added a preamble and tweaked a lot (math, references, titles of subsubsections, etc.) | acdd1bb083cd6985763afd9b77e1b7995dc1ebd7 | aubert@math.cnrs.fr | 2018-05-22 07:02:51 |
Cleaning latex dependencies: removed colors, fonts, etc., added header and footer. | b4c1232d6091e12bc2cdf038529921143a55b758 | aubert@math.cnrs.fr | 2018-05-22 05:06:04 |
Putting all latex material aside, changing class. | e43fb54e6ecb0ec4669ed16feba940b47ee3e35c | aubert@math.cnrs.fr | 2018-05-21 15:14:48 |
File | Lines added | Lines deleted |
---|---|---|
README.md | 8 | 7 |
notes/Makefile | 54 | 13 |
notes/latex/packages.sty | 1 | 1 |
notes/lectures_notes.md | 49 | 180 |
notes/vec/er/Accident.tex | 25 | 0 |
notes/vec/er/Bad_Design.tex | 1 | 3 |
notes/vec/er/Belongs.tex | 10 | 0 |
notes/vec/er/Car_Info.tex | 31 | 0 |
notes/vec/er/Cellphone.tex | 13 | 0 |
notes/vec/er/Computer.tex | 13 | 0 |
notes/vec/er/Constraint2.tex | 1 | 3 |
notes/vec/er/Contains.tex | 10 | 0 |
notes/vec/er/Country.tex | 40 | 0 |
notes/vec/er/Entity_Instructor.tex | 1 | 3 |
notes/vec/er/Naming.tex | 1 | 3 |
notes/vec/er/Person.tex | 12 | 0 |
notes/vec/er/Pilot.tex | 17 | 0 |
notes/vec/er/Rel_Instance.tex | 1 | 3 |
notes/vec/er/Role_Name1.tex | 1 | 3 |
notes/vec/er/Role_Name2.tex | 1 | 3 |
notes/vec/er/Role_Name3.tex | 1 | 3 |
notes/vec/er/Stays_At.tex | 14 | 0 |
notes/vec/uml/Flight.tex | 23 | 0 |
notes/vec/uml/template.def | 4 | 0 |
File README.md changed (mode: 100644) (index b39d363..303a1ee) | |||
... | ... | Here are the lecture notes, code, exercises and problems for a lecture on databa | |
6 | 6 | ||
7 | 7 | ## Getting Started | ## Getting Started |
8 | 8 | ||
9 | The source code is organized as follows: | ||
9 | The source code, hosted at <https://rocketgit.com/user/caubert/CSCI_3410>, is organized as follows: | ||
10 | 10 | ||
11 | 11 | ~~~{.plain} | ~~~{.plain} |
12 | 12 | . | . |
... | ... | The source code is organized as follows: | |
21 | 21 | └── README.md -- The present file | └── README.md -- The present file |
22 | 22 | ~~~ | ~~~ |
23 | 23 | ||
24 | Before compiling this document, you will need | ||
24 | Before compiling this document, you will need to install | ||
25 | 25 | ||
26 | - To install git (cf. <https://git-scm.com/>) | ||
27 | - To install pandoc (cf. <http://pandoc.org/installing.html>) | ||
28 | - To install LaTeX (cf. <https://www.latex-project.org/get/>, <https://tex.stackexchange.com/q/1092>) | ||
29 | - To install pandoc-numbering (cf. <https://github.com/chdemko/pandoc-numbering#installation>) | ||
30 | - To install latexmk (cf. <https://ctan.org/pkg/latexmk/>, but it is possible that it is already part of your LaTeX installation.) | ||
26 | - git (cf. <https://git-scm.com/>) | ||
27 | - pandoc (cf. <http://pandoc.org/installing.html>) | ||
28 | - LaTeX (cf. <https://www.latex-project.org/get/>, <https://tex.stackexchange.com/q/1092>) | ||
29 | - pandoc-numbering (cf. <https://github.com/chdemko/pandoc-numbering#installation>) | ||
30 | - latexmk (cf. <https://ctan.org/pkg/latexmk/>, but it is possible that it is already part of your LaTeX installation.) | ||
31 | - pdf2svg (cf. <https://github.com/dawbarton/pdf2svg>) | ||
31 | 32 | - To clone the source, | - To clone the source, |
32 | 33 | ||
33 | 34 | ~~~{.bash} | ~~~{.bash} |
File notes/Makefile changed (mode: 100644) (index 45c77f5..5f579be) | |||
1 | 1 | # http://www.gnu.org/software/make/manual/make.html | # http://www.gnu.org/software/make/manual/make.html |
2 | # http://nuclear.mutantstargoat.com/articles/make/ | ||
3 | |||
2 | 4 | ||
3 | 5 | # Makefile global options. | # Makefile global options. |
4 | 6 | ||
5 | .DEFAULT_GOAL := pdf | ||
6 | 7 | MAKEFLAGS := -j | MAKEFLAGS := -j |
7 | ## Maximize parallel execution whenever possible | ||
8 | # Maximize parallel execution whenever possible | ||
9 | OPTIONSPANDOC := --pdf-engine=xelatex --pdf-engine-opt=-shell-escape --toc --filter pandoc-numbering --filter pandoc-citeproc --top-level-division=chapter -V links-as-notes -M date="$$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" | ||
10 | # Options common to all invokations of pandoc | ||
11 | .DEFAULT_GOAL := pdf | ||
8 | 12 | ||
9 | # "Phony" rule to compile the SVG figures using latexmk | ||
10 | 13 | ||
11 | VEC = vec/rel_mod/*.tex vec/er/*.tex | ||
14 | # "Phony" rule to compile the pdf figures using latexmk | ||
15 | |||
16 | VEC = vec/rel_mod/*.tex vec/er/*.tex vec/uml/*.tex | ||
12 | 17 | .PHONY: vec $(VEC) | .PHONY: vec $(VEC) |
13 | 18 | vec: $(VEC) | vec: $(VEC) |
14 | 19 | $(VEC): | $(VEC): |
15 | latexmk -silent -cd -pdf -c $@ | ||
20 | latexmk -silent -cd -pdf $@ | ||
21 | |||
22 | |||
23 | # "Phony" rule to convert the pdf figures to svg (for better integration in htm and odt output). | ||
24 | |||
25 | VEC_SVG = vec/rel_mod/*.pdf vec/er/*.pdf vec/uml/*.pdf | ||
26 | .PHONY: vec_svg $(VEC_SVG) | ||
27 | # $(VEC) is an "order-only" pre-requisite. Cf. http://www.gnu.org/software/make/manual/make.html#Types-of-Prerequisites | ||
28 | vec_svg: $(VEC_SVG) | ||
29 | $(VEC_SVG): |$(VEC) | ||
30 | pdf2svg $@ $(addsuffix .svg,$(basename $@)) | ||
31 | # To understand the syntax, cf. https://www.gnu.org/software/make/manual/html_node/File-Name-Functions.html#File-Name-Functions | ||
32 | |||
33 | |||
34 | # Rule to compile to pdf | ||
35 | |||
36 | pdf: lectures_notes.md | $(VEC) | ||
37 | pandoc $(OPTIONSPANDOC) --default-image-extension=pdf -o lectures_notes.pdf $< | ||
16 | 38 | ||
17 | # Rule to compile the pdf | ||
39 | |||
40 | # Rule to compile to odt | ||
41 | |||
42 | odt: lectures_notes.md | $(VEC_SVG) | ||
43 | pandoc $(OPTIONSPANDOC) --default-image-extension=svg -o lectures_notes.odt $< | ||
44 | |||
45 | |||
46 | # Rule to compile to html | ||
47 | |||
48 | html: lectures_notes.md | $(VEC_SVG) | ||
49 | pandoc $(OPTIONSPANDOC) --default-image-extension=svg --self-contained -o lectures_notes.html $< | ||
18 | 50 | ||
19 | pdf: lectures_notes.md | $(VEC) # $(VEC) is an "order-only" pre-requisite. Cf. http://www.gnu.org/software/make/manual/make.html#Types-of-Prerequisites | ||
20 | pandoc --pdf-engine=xelatex --pdf-engine-opt=-shell-escape --toc --filter pandoc-numbering --filter pandoc-citeproc --top-level-division=chapter -V links-as-notes -M date="$$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" -o lectures_notes.pdf $< | ||
21 | 51 | ||
22 | # | ||
23 | temp: | ||
24 | pandoc temp.md --pdf-engine=xelatex --pdf-engine-opt=-shell-escape --toc --filter pandoc-numbering --filter pandoc-citeproc --top-level-division=chapter -V links-as-notes -M date="$$(LANG=en_us_88591 date '+%B %e, %Y (%r)')" -o temp.pdf | ||
52 | # Rule to compile a temporary file, for testing purposes | ||
25 | 53 | ||
54 | temp: | $(VEC) | ||
55 | pandoc temp.md $(OPTIONSPANDOC) --default-image-extension=pdf -o temp.pdf | ||
56 | |||
57 | |||
58 | # "Phony" rule to compile all three versions (html, odt, pdf) of the document | ||
59 | |||
60 | .PHONY : all | ||
61 | all : pdf odt html push | ||
26 | 62 | ||
27 | # Rule to compile the README to html, and to publish the compiled lecture notes and the README to the website. | ||
28 | push: | pdf | ||
63 | |||
64 | # "Phony" rule to compile the README to html, and to publish the compiled lecture notes and the README to the website. | ||
65 | |||
66 | .PHONY : push | ||
67 | push: | ||
29 | 68 | pandoc ../README.md -s -o ../README.html | pandoc ../README.md -s -o ../README.html |
30 | 69 | cp lectures_notes.pdf ../../../website/CSCI_3410_2019_F_lecture_notes.pdf | cp lectures_notes.pdf ../../../website/CSCI_3410_2019_F_lecture_notes.pdf |
70 | cp lectures_notes.html ../../../website/CSCI_3410_2019_F_lecture_notes.html | ||
71 | cp lectures_notes.odt ../../../website/CSCI_3410_2019_F_lecture_notes.odt | ||
31 | 72 | cp ../README.html ../../../website/CSCI_3410_2019_F_README.html | cp ../README.html ../../../website/CSCI_3410_2019_F_README.html |
File notes/latex/packages.sty changed (mode: 100644) (index c7be85d..3cbb414) | |||
... | ... | every isa] | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | %%%% UML Class Diagrams | %%%% UML Class Diagrams |
134 | \usepackage[simplified]{pgf-umlcd} | ||
134 | |||
135 | 135 | \usetikzlibrary{arrows} | \usetikzlibrary{arrows} |
File notes/lectures_notes.md changed (mode: 100644) (index 00d841f..54a2d5f) | |||
... | ... | subtitle: Lecture Notes (Draft) | |
5 | 5 | author: Clément Aubert | author: Clément Aubert |
6 | 6 | institute: Augusta University | institute: Augusta University |
7 | 7 | papersize: letter | papersize: letter |
8 | margin: 1em | ||
8 | margins: 1em | ||
9 | 9 | bibliography: [ bib/bib.bib ] | bibliography: [ bib/bib.bib ] |
10 | 10 | link-citations: true | link-citations: true |
11 | 11 | lang: en | lang: en |
... | ... | The focus will be on design, but we will have to do a little bit of everything. | |
190 | 190 | ||
191 | 191 | {#fig:cycle} | {#fig:cycle} |
192 | 192 | ||
193 | Refer to the ["The cycle of design" figure]{#fig:cycle}. | ||
193 | Refer to the ["The cycle of design" figure](#fig:cycle). | ||
194 | 194 | ||
195 | 195 | Add a line from SQL to Program, a line from NoSQL to CLI. | Add a line from SQL to Program, a line from NoSQL to CLI. |
196 | 196 | Make the arrow from Bus. Statements to NoSQL dashed? | Make the arrow from Bus. Statements to NoSQL dashed? |
... | ... | CAR(VIN (PK), Make, Model, Year) | |
522 | 522 | DRIVER(State (PK), Licence\_number (PK), Name, Address) | DRIVER(State (PK), Licence\_number (PK), Name, Address) |
523 | 523 | INSURANCE(Policy\_Number (PK), Insured\_Car (FK to CAR.VIN), Insured\_Driver\_State (FK to DRIVER.State), Insured\_Driver\_Num (FK to DRIVER.Licence\_number), Rate) | INSURANCE(Policy\_Number (PK), Insured\_Car (FK to CAR.VIN), Insured\_Driver\_State (FK to DRIVER.State), Insured\_Driver\_Num (FK to DRIVER.Licence\_number), Rate) |
524 | 524 | PRICE(Stock\_number (PK), Car\_Vin (FK to CAR.VIN), Price, Margin) | PRICE(Stock\_number (PK), Car\_Vin (FK to CAR.VIN), Price, Margin) |
525 | ](vec/rel_mod/CAR.pdf){ width=100% } | ||
525 | ](vec/rel_mod/CAR){ width=100% } | ||
526 | 526 | \ | \ |
527 | 527 | ||
528 | 528 | (Yes, we do need the state *and* the licence number to uniquely identify a driver's licence, since [many states use the same licence format](https://ntsi.com/drivers-license-format/). | (Yes, we do need the state *and* the licence number to uniquely identify a driver's licence, since [many states use the same licence format](https://ntsi.com/drivers-license-format/). |
... | ... | Exercise +.# | |
635 | 635 | AUTHOR(Ref, Name, Address) | AUTHOR(Ref, Name, Address) |
636 | 636 | BOOK(ISSN, AuthorRef, Title) | BOOK(ISSN, AuthorRef, Title) |
637 | 637 | GAINED-AWARD(Ref, Name, BookISSN, Year) | GAINED-AWARD(Ref, Name, BookISSN, Year) |
638 | ](vec/rel_mod/BOOK_Exo.pdf){ width=100% } | ||
638 | ](vec/rel_mod/BOOK_Exo){ width=100% } | ||
639 | 639 | \ | \ |
640 | 640 | ||
641 | 641 | For each relation, answer the following: | For each relation, answer the following: |
... | ... | Exercise +.# | |
651 | 651 | TRAIN(Ref (PK), Model, Year) | TRAIN(Ref (PK), Model, Year) |
652 | 652 | CONDUCTOR(CompanyID (PK), Name, ExperienceLevel) | CONDUCTOR(CompanyID (PK), Name, ExperienceLevel) |
653 | 653 | ASSIGNED-TO(TrainRef (PK, FK to TRAIN.Ref), ConductorID (PK, FK to CONDUCTOR.CompanyID), Date (PK)) | ASSIGNED-TO(TrainRef (PK, FK to TRAIN.Ref), ConductorID (PK, FK to CONDUCTOR.CompanyID), Date (PK)) |
654 | ](vec/rel_mod/TRAIN_Exo.pdf){ width=100% } | ||
654 | ](vec/rel_mod/TRAIN_Exo){ width=100% } | ||
655 | 655 | \ | \ |
656 | 656 | ||
657 | 657 | #. What are the foreign keys in the ASSIGNED-TO relation? What are they refering? | #. What are the foreign keys in the ASSIGNED-TO relation? What are they refering? |
... | ... | Solution +.# | |
704 | 704 | AUTHOR(Ref (PK), Name, Address) | AUTHOR(Ref (PK), Name, Address) |
705 | 705 | BOOK(ISSN (PK), AuthorRef (FK to AUTHOR.REF), Title) | BOOK(ISSN (PK), AuthorRef (FK to AUTHOR.REF), Title) |
706 | 706 | GAINED-AWARD(Ref (PK), Name, BookISSN (FK to BOOK.ISSN), Year) | GAINED-AWARD(Ref (PK), Name, BookISSN (FK to BOOK.ISSN), Year) |
707 | ](vec/rel_mod/BOOK_Exo.pdf){ width=100% } | ||
707 | ](vec/rel_mod/BOOK_Exo){ width=100% } | ||
708 | 708 | \ | \ |
709 | 709 | ||
710 | 710 | For the last question, the answer is yes: based on the ISSN of the book, we can retrieve the author of the book. Hence, knowing which book was awarded which year, by lookinq in the GAINED-AWARD table, gives us the answer to that question. | For the last question, the answer is yes: based on the ISSN of the book, we can retrieve the author of the book. Hence, knowing which book was awarded which year, by lookinq in the GAINED-AWARD table, gives us the answer to that question. |
... | ... | THEATER(Id (PK), Name, Address) | |
767 | 767 | AUDITORIUM(Id (PK), Capacity, Theater (FK to THEATER.Id)) | AUDITORIUM(Id (PK), Capacity, Theater (FK to THEATER.Id)) |
768 | 768 | SHOWTIME(Id (PK), MovieId (FK to MOVIE.Id), AuditoriumId (FK to AUDITORIUM.Id), StartTime) | SHOWTIME(Id (PK), MovieId (FK to MOVIE.Id), AuditoriumId (FK to AUDITORIUM.Id), StartTime) |
769 | 769 | TICKETS(Id (PK), ShowTimeId (FK to SHOWTIME.Id), Price) | TICKETS(Id (PK), ShowTimeId (FK to SHOWTIME.Id), Price) |
770 | ](vec/rel_mod/CINEMA.pdf){ width=100% } | ||
770 | ](vec/rel_mod/CINEMA){ width=100% } | ||
771 | 771 | \ | \ |
772 | 772 | ||
773 | 773 | # The SQL Programming Language | # The SQL Programming Language |
... | ... | MariaDB [HW_CONSTRAINTS_PART3]> SELECT * FROM Table_set_null; | |
1220 | 1220 | { width=100% } | ||
1223 | ](vec/rel_mod/PROF_DEPARTMENT){ width=100% } | ||
1224 | 1224 | \ | \ |
1225 | 1225 | ||
1226 | 1226 | ~~~{.sqlmysql .numberLines} | ~~~{.sqlmysql .numberLines} |
... | ... | Can you provide a *relational model* (no need to write the `SQL` code, but remem | |
2797 | 2797 | ## Solution to Selected Problems | ## Solution to Selected Problems |
2798 | 2798 | ||
2799 | 2799 | Solution to [%D %n (%T)](#problem:address) | Solution to [%D %n (%T)](#problem:address) |
2800 | ~ This problem is supposed to be a straightforward application of what we studied in class. Look back at [Setting Up Your Work Environment]{#sec:setup} if you feel like you are stuck before rushing to this solution. | ||
2800 | ~ This problem is supposed to be a straightforward application of what we studied in class. Look back at [Setting Up Your Work Environment](#sec:setup) if you feel like you are stuck before rushing to this solution. | ||
2801 | 2801 | ||
2802 | 2802 | @problem:address -- Solution to Q. -.# | @problem:address -- Solution to Q. -.# |
2803 | 2803 | ~ We simply log-in as indicated in the ["Loging-in as testuser"](#testuserlogin) Section. | ~ We simply log-in as indicated in the ["Loging-in as testuser"](#testuserlogin) Section. |
... | ... | We then create the tables as in the problem. | |
2868 | 2868 | { width=100% } | ||
2871 | ](vec/rel_mod/ADDRESS){ width=100% } | ||
2872 | 2872 | \ | \ |
2873 | 2873 | ||
2874 | 2874 | @problem:address -- Solution to Q. -.# | @problem:address -- Solution to Q. -.# |
... | ... | WEAPON(Name (PK), Bonus, Possessed-By (FK to CHARACTER.Name)) | |
3290 | 3290 | QUEST(Name (PK), XP) | QUEST(Name (PK), XP) |
3291 | 3291 | COMPLETED-BY(Character (PK, FK to CHARACTER.Name), Quest (PK, FK to QUEST.Name)) | COMPLETED-BY(Character (PK, FK to CHARACTER.Name), Quest (PK, FK to QUEST.Name)) |
3292 | 3292 | SPECIAL-ITEM(Name (P), Quest (FK to QUEST.Name)) | SPECIAL-ITEM(Name (P), Quest (FK to QUEST.Name)) |
3293 | ](vec/rel_mod/RPG.pdf){ width=100% } | ||
3293 | ](vec/rel_mod/RPG){ width=100% } | ||
3294 | 3294 | \ | \ |
3295 | 3295 | ||
3296 | 3296 | # Designing a Good Database | # Designing a Good Database |
... | ... | multivalued | the box have double lines | | |
3404 | 3404 | derived | the box have dotted lines | | derived | the box have dotted lines | |
3405 | 3405 | a key | the name of the attribute is underlined | | a key | the name of the attribute is underlined | |
3406 | 3406 | ||
3407 | { width=100% } | ||
3407 | { width=100% } | ||
3408 | 3408 | \ | \ |
3409 | 3409 | ||
3410 | { width=100% } | ||
3410 | { width=100% } | ||
3411 | 3411 | \ | \ |
3412 | 3412 | ||
3413 | 3413 | --- | --- |
... | ... | Reminder: entity = actual thing, entity set = collection of entities, entity typ | |
3425 | 3425 | ||
3426 | 3426 | $E_1$, … $E_n$ *participate* in R, $e_1$, …, $e_n$ *participate* in $r_1$, $n$ is the degree. | $E_1$, … $E_n$ *participate* in R, $e_1$, …, $e_n$ *participate* in $r_1$, $n$ is the degree. |
3427 | 3427 | ||
3428 | { width=100% } | ||
3428 | { width=100% } | ||
3429 | 3429 | \ | \ |
3430 | 3430 | ||
3431 | 3431 | Note that we can have Entity Set 1 = Entity Set 2, in which case we say the relation is recursive. | Note that we can have Entity Set 1 = Entity Set 2, in which case we say the relation is recursive. |
... | ... | Naming convention: | |
3438 | 3438 | - Drawing usually reads right to left, and up to down. | - Drawing usually reads right to left, and up to down. |
3439 | 3439 | ||
3440 | 3440 | ||
3441 | { width=100% } | ||
3441 | { width=100% } | ||
3442 | 3442 | \ | \ |
3443 | 3443 | ||
3444 | 3444 | ||
... | ... | Convenient, and sometimes mandatory, to give role names. | |
3448 | 3448 | ||
3449 | 3449 | If we want to stress that we are considering only one aspect of an entity (that is, a person is not only an employee, a company is not only an employer, but this aspect is crucial for the "EMPLOYS" relation): | If we want to stress that we are considering only one aspect of an entity (that is, a person is not only an employee, a company is not only an employer, but this aspect is crucial for the "EMPLOYS" relation): |
3450 | 3450 | ||
3451 | { width=100% } | ||
3451 | { width=100% } | ||
3452 | 3452 | ||
3453 | 3453 | We can also use it to make the "right-side" and the "left-side" of a recursive relationship explicit: | We can also use it to make the "right-side" and the "left-side" of a recursive relationship explicit: |
3454 | 3454 | ||
3455 | { width=100% } | ||
3456 | { width=100% } | ||
3455 | { width=100% } | ||
3456 | { width=100% } | ||
3457 | 3457 | ||
3458 | 3458 | Finally, we will sometimes use "Role Name of Entity 1 : Role Name of Entity 2" as a notation for the relation between them. | Finally, we will sometimes use "Role Name of Entity 1 : Role Name of Entity 2" as a notation for the relation between them. |
3459 | 3459 | For instance, we can write "Employer:Employee" to denote the "EMPLOYS" relation, and we will also use this notation with entities, and write "PERSON:POSITION" for the "OCCUPIES" relation. | For instance, we can write "Employer:Employee" to denote the "EMPLOYS" relation, and we will also use this notation with entities, and write "PERSON:POSITION" for the "OCCUPIES" relation. |
... | ... | For binary relations, can be $1:1$, $N:1$, $M:N$ ($1$ is "at most", $M$, $N$, $O | |
3476 | 3476 | ||
3477 | 3477 | We indicate the ratio on the edges: | We indicate the ratio on the edges: |
3478 | 3478 | ||
3479 | { width=100% } | ||
3479 | { width=100% } | ||
3480 | 3480 | ||
3481 | 3481 | ##### Participation constraint | ##### Participation constraint |
3482 | 3482 | ||
... | ... | The participation can be total (a.k.a. existence dependency) or partial. | |
3486 | 3486 | ||
3487 | 3487 | Total is drawn with a double line, partial is drawn with a single line. | Total is drawn with a double line, partial is drawn with a single line. |
3488 | 3488 | ||
3489 | { width=100% } | ||
3489 | { width=100% } | ||
3490 | 3490 | ||
3491 | 3491 | ||
3492 | 3492 | #### Attributes | #### Attributes |
... | ... | What would be the ratio of such a relation? | |
4068 | 4068 | Exercise +.# | Exercise +.# |
4069 | 4069 | ~ Convert the following ER diagram into a relational model: | ~ Convert the following ER diagram into a relational model: |
4070 | 4070 | ||
4071 | \begin{tikzpicture}[node distance=7em] | ||
4072 | \node[relationship] (contains){STAYS\_AT}; | ||
4073 | \node[entity] (person) [above = 1cm of contains] {PERSON} edge node[right] {$N$} (contains);; | ||
4074 | \node[attribute] (ssn) [left of=person] {\key{SSN}} edge (person); | ||
4075 | \node[attribute] (dob) [above = .5cm of person] {Date\_Of\_Birth} edge (person); | ||
4076 | \node[entity] (burger) [below of= contains] {PLACE} edge node[right] {$1$} (contains); | ||
4077 | \node[attribute] (dob) [below = .5cm of burger] {\key{Address}} edge (burger); | ||
4078 | \node[attribute] (ssn) [left of=burger] {Rooms} edge (burger); | ||
4079 | \end{tikzpicture} | ||
4071 | { width=100% } | ||
4072 | \ | ||
4080 | 4073 | ||
4081 | 4074 | Exercise +.# | Exercise +.# |
4082 | 4075 | ~ Why do weak entity type have a total participation constraint? | ~ Why do weak entity type have a total participation constraint? |
... | ... | Exercise +.# | |
4197 | 4190 | Exercise +.# | Exercise +.# |
4198 | 4191 | ~ Consider the following diagram: | ~ Consider the following diagram: |
4199 | 4192 | ||
4200 | \begin{tikzpicture}[scale = 0.8] | ||
4201 | \begin{class}[text width=7cm]{Flight}{0,0} | ||
4202 | \attribute{flightNumber : Integer} | ||
4203 | \attribute{departureTime : Date} | ||
4204 | \attribute{flightDuration : Minutes} | ||
4205 | \attribute{departingAirport : String} | ||
4206 | \attribute{arrivingAirport : String} | ||
4207 | \operation{delayFlight(numberOfMinutes : Minutes)} | ||
4208 | \operation{getArrivalTime( ) : Date} | ||
4209 | \end{class} | ||
4210 | \begin{class}{Plane}{11, -0.8} | ||
4211 | \attribute{airPlaneType : String} | ||
4212 | \attribute{maximumSpeed : MPH} | ||
4213 | \attribute{maximumDistance : Miles} | ||
4214 | \attribute{tailID : String} | ||
4215 | \end{class} | ||
4216 | \association{Plane}{}{0..1}{Flight}{0..*}{} | ||
4217 | \end{tikzpicture} | ||
4193 | { width=100% } | ||
4218 | 4194 | ||
4219 | Give the number of attributes for both classes, and suggest two operations for the class that doesn't have any. Discuss the multiplicities: why did the designer picked those values? | ||
4195 | Give the number of attributes for both classes, and suggest two operations for the class that doesn't have any. Discuss the multiplicities: why did the designer picked those values? | ||
4220 | 4196 | ||
4221 | 4197 | Exercise +.# | Exercise +.# |
4222 | 4198 | ~ Briefly explain the difference between an aggregation and a composition association. | ~ Briefly explain the difference between an aggregation and a composition association. |
... | ... | Why is such a concept useful? | |
4228 | 4204 | Exercise +.# | Exercise +.# |
4229 | 4205 | ~ Convert the following E.R. diagram into a U.M.L. class diagram: | ~ Convert the following E.R. diagram into a U.M.L. class diagram: |
4230 | 4206 | ||
4231 | \begin{tikzpicture}[node distance=8em] | ||
4232 | \node[entity] (person) {PILOT}; | ||
4233 | \node[attribute] (pid) [left of=person] {\key{ID}} edge (person); | ||
4234 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
4235 | \node[attribute] (phone) [above of=person] {Experience} edge (person); | ||
4236 | |||
4237 | \node[relationship] (drives) [below of=person] {ASSIGNED\_TO} edge node[right, pos=0.1] {$N$} (person); | ||
4238 | \node[entity] (plane) [below of=drives] {PLANE} edge [total] node[right, pos=0.7] {$1$} (drives); | ||
4239 | \node[attribute] (make) [left of=plane] {\key{TailID}} edge (plane); | ||
4240 | \node[attribute] (maxS) [below left of =plane] {MaxSpeed} edge (plane); | ||
4241 | \node[attribute] (airPlaneType) [below of = plane] {AirPlaneType} edge (plane); | ||
4242 | \end{tikzpicture} | ||
4207 | { width=100% } | ||
4208 | \ | ||
4243 | 4209 | ||
4244 | 4210 | ## Solution to Exercises {-} | ## Solution to Exercises {-} |
4245 | 4211 | ||
... | ... | Solution +.# | |
4248 | 4214 | To have statistics about the extensions, to sort the username by length, etc. | To have statistics about the extensions, to sort the username by length, etc. |
4249 | 4215 | ||
4250 | 4216 | Solution +.# | Solution +.# |
4251 | ~ \begin{tikzpicture}[node distance=7em] | ||
4252 | \node[entity] (computer) {COMPUTER}; | ||
4253 | \node[attribute] (pid) [left of=computer] {\key{Id}} edge (computer); | ||
4254 | \node[multi attribute] (os) [above of=computer] {Operating\_System} edge (computer); | ||
4255 | \node[attribute] (devices) [right of=computer] {Devices} edge (computer); | ||
4256 | \node[attribute] (mouse) [above right of=devices] {Mouse} edge (devices); | ||
4257 | \node[attribute] (keyboard) [right of=devices] {Keyboard} edge (devices); | ||
4258 | \end{tikzpicture} | ||
4217 | ~ { width=100% } | ||
4218 | \ | ||
4259 | 4219 | ||
4260 | 4220 | Solution +.# | Solution +.# |
4261 | ~ \begin{tikzpicture}[node distance=7em] | ||
4262 | \node[entity] (cellphone) {CELLPHONE}; | ||
4263 | \node[attribute] (mid) [left of=cellphone] {\key{MIN}} edge (cellphone); | ||
4264 | \node[multi attribute] (app) [above of=cellphone] {App\_Installed} edge (cellphone); | ||
4265 | \node[attribute] (plan) [right of=cellphone] {Plan} edge (cellphone); | ||
4266 | \node[attribute] (carrier) [above right of=plan] {Carrier} edge (plan); | ||
4267 | \node[attribute] (price) [right of=plan] {Price} edge (plan); | ||
4268 | \end{tikzpicture} | ||
4221 | ~ { width=100% } | ||
4222 | \ | ||
4223 | |||
4269 | 4224 | ||
4270 | 4225 | Solution +.# | Solution +.# |
4271 | 4226 | ~ There can be more than one key in the ER model. | ~ There can be more than one key in the ER model. |
... | ... | Solution +.# | |
4308 | 4263 | ~ SUPERVISION, a recursive relationship on EMPLOYEE. | ~ SUPERVISION, a recursive relationship on EMPLOYEE. |
4309 | 4264 | ||
4310 | 4265 | Solution +.# | Solution +.# |
4311 | ~ \begin{tikzpicture}[node distance=7em] | ||
4312 | \node[relationship] (contains){BELONGS}; | ||
4313 | \node[entity] (burger) [left = 1cm of contains] {HAND} edge node[above] {$N$} (contains); | ||
4314 | \node[entity] (ingredient) [right = 1cm of contains] {PERSON} edge node[above]{$1$} (contains); | ||
4315 | \end{tikzpicture} | ||
4266 | ~ { width=100% } | ||
4267 | \ | ||
4316 | 4268 | ||
4317 | Solution +.# | ||
4318 | ~ \begin{tikzpicture}[node distance=7em] | ||
4319 | \node[entity] (person) {PERSON}; | ||
4320 | \node[attribute] (ssn) [left of=person] {\key{SSN}} edge (person); | ||
4321 | \node[attribute] (dob) [above of=person] {Date\_Of\_Birth} edge (person); | ||
4322 | \node[derived attribute] (age) [right of=person] {Age} edge (person); | ||
4323 | \end{tikzpicture} | ||
4269 | |||
4270 | Solution +.# | ||
4271 | ~ { width=100% } | ||
4272 | \ | ||
4324 | 4273 | ||
4325 | 4274 | Solution +.# | Solution +.# |
4326 | ~ \begin{tikzpicture}[node distance=7em] | ||
4327 | \node[relationship] (contains){CONTAINS}; | ||
4328 | \node[entity] (burger) [left = 1cm of contains] {BURGER} edge[total] node[above] {$N$} (contains); | ||
4329 | \node[entity] (ingredient) [right = 1cm of contains] {INGREDIENT} edge node[above]{$M$} (contains); | ||
4330 | \end{tikzpicture} | ||
4275 | ~ { width=100% } | ||
4276 | \ | ||
4331 | 4277 | ||
4332 | 4278 | Solution +.# | Solution +.# |
4333 | ~ \begin{tikzpicture}[node distance=7em] | ||
4334 | \node[relationship] (contains){CONTAINS}; | ||
4335 | \node[entity] (burger) [left = 1cm of contains] {BURGER} edge[total] node[above] {$N$} (contains); | ||
4336 | \node[entity] (ingredient) [right = 1cm of contains] {INGREDIENT} edge node[above]{$M$} (contains); | ||
4337 | \end{tikzpicture} | ||
4279 | ~ Same as before? | ||
4338 | 4280 | ||
4339 | 4281 | Solution +.# | Solution +.# |
4340 | 4282 | ~ Otherwise, we couldn't identify entities in it without owner entity. | ~ Otherwise, we couldn't identify entities in it without owner entity. |
... | ... | Solution +.# | |
4508 | 4450 | ||
4509 | 4451 | OR | OR |
4510 | 4452 | ||
4511 | \begin{tikzpicture}[node distance=7em] | ||
4512 | \node[entity] (person) {Person}; | ||
4513 | \node[attribute] (pid) [left of=person] {\key{id}} edge (person); | ||
4514 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
4515 | \node[attribute] (address) [below left of=person] {address} edge (person); | ||
4516 | |||
4517 | \node[relationship] (owns) [above right of=person] {Owns} edge node[above, sloped]{$M$} (person); | ||
4518 | \node[entity] (car) [above right of=owns] {Car} edge node[above, sloped]{$N$} (owns); | ||
4519 | \node[attribute] (licence) [above left of=car] {\key{licence}} edge (car); | ||
4520 | \node[attribute] (model) [above of =car] {model} edge (car); | ||
4521 | \node[attribute] (year) [above right of =car] {year} edge (car); | ||
4522 | |||
4523 | \node[relationship] (accident) [right = 5cm of person] {Accident} edge[total] node[above, sloped]{$M$} (person); | ||
4524 | \node[attribute] (report_number) [below of = accident] {\key{Report Number}} edge (accident); | ||
4525 | \node[attribute] (time) [right of = accident] {Time} edge (accident); | ||
4526 | \node[attribute] (place) [below right of = accident] {Place} edge (accident); | ||
4527 | \node[attribute] (damage_amount) [above right of = accident] {Damage\_Amount} edge (accident); | ||
4528 | |||
4529 | \draw (car) edge[total] node[above, sloped]{$N$} (accident); | ||
4530 | \end{tikzpicture} | ||
4453 | { width=100% } | ||
4454 | \ | ||
4531 | 4455 | ||
4532 | 4456 | --- | --- |
4533 | 4457 | ||
... | ... | Problem +.# | |
4543 | 4467 | ||
4544 | 4468 | Consider the following E.R. schema: | Consider the following E.R. schema: |
4545 | 4469 | ||
4546 | \begin{tikzpicture}[node distance=8em] | ||
4547 | \node[entity] (COUNTRY) {COUNTRY}; | ||
4548 | \node[attribute] (name) [left of=COUNTRY] {\key{Name}} edge (COUNTRY); | ||
4549 | \node[attribute] (population) [below left of=COUNTRY] {Population} edge (COUNTRY); | ||
4550 | |||
4551 | \node[relationship] (SPEAKS) [below right of=COUNTRY] {SPEAKS} edge node[right, pos=0.4] {$M$} (COUNTRY); | ||
4552 | \node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); | ||
4553 | \node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); | ||
4554 | \node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); | ||
4555 | |||
4556 | \node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; | ||
4557 | \draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); | ||
4558 | \draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); | ||
4559 | |||
4560 | %\node[relationship] (boundary) [above of = COUNTRY] {S\_B\_W}; | ||
4561 | %\draw (COUNTRY) to node[left, pos=0.6] {$N$} (boundary.west); | ||
4562 | %\draw (COUNTRY) to node[right, pos=0.6] {$M$} (boundary.east); | ||
4563 | |||
4564 | %\node[relationship] (conversion) [below of =LANGUAGE] {CONVERSION}; | ||
4565 | %\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (conversion.west); | ||
4566 | %\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (conversion.east); | ||
4470 | { width=100% } | ||
4471 | \ | ||
4567 | 4472 | ||
4568 | %\node[attribute] (timestamp) [below left of=conversion] {\key{Timestamp}} edge (conversion); | ||
4569 | %\node[attribute] (rate) [below right of=conversion] {Exchange\_rate} edge (conversion); | ||
4473 | where | ||
4570 | 4474 | ||
4571 | \node[ident relationship] (hasfor) [right of=COUNTRY] {SINGS} edge node[above, pos=0.4] {$1$} (COUNTRY); | ||
4572 | \node[weak entity] (anthem) %[right of=hasfor] | ||
4573 | [right = 1cm of hasfor] {NATIONAL\_ANTHEM} edge[total] node[above, pos=0.6]{$M$} (hasfor); | ||
4574 | \node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); | ||
4575 | \node[attribute] (name) [below right of = anthem] {\pkey{Name}} edge (anthem); | ||
4475 | - "W\_IN" stands for "WRITTEN\_IN", and | ||
4476 | - "B\_W\_F" stands for "BORROWS\_WORDS\_FROM". | ||
4576 | 4477 | ||
4577 | \node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; | ||
4578 | \draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); | ||
4579 | \draw (anthem) to node[right, pos=0.6] {$M$} (WIN); | ||
4580 | \end{tikzpicture} | ||
4581 | |||
4582 | %"S\_B\_W" stands for "SHARES\_A\_BORDER\_WITH". | ||
4583 | "W\_IN" stands for "WRITTEN\_IN", and | ||
4584 | "B\_W\_F" stands for "BORROWS\_WORDS\_FROM". | ||
4585 | 4478 | For this relationship, on the left-hand side is the language that borrows a word, and on the right-hand side is the language that provides the loanword. | For this relationship, on the left-hand side is the language that borrows a word, and on the right-hand side is the language that provides the loanword. |
4586 | 4479 | ||
4587 | 4480 | Map that E.R. diagram to a relational database schema. | Map that E.R. diagram to a relational database schema. |
... | ... | Problem +.#carinfo | |
4835 | 4728 | ||
4836 | 4729 | Consider the following E.R. schema for the CAR\_INFO database: | Consider the following E.R. schema for the CAR\_INFO database: |
4837 | 4730 | ||
4838 | \begin{tikzpicture}[node distance=8em] | ||
4839 | \node[entity] (person) {PERSON}; | ||
4840 | \node[attribute] (pid) [left of=person] {\key{ID}} edge (person); | ||
4841 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
4842 | \node[multi attribute] (phone) [above of=person] {Phone} edge (person); | ||
4843 | \node[attribute] (address) [above right of=person] {Address} edge (person); | ||
4844 | \node[attribute] (street) [above right of=address] {Street} edge (address); | ||
4845 | \node[attribute] (city) [right of=address] {City} edge (address); | ||
4846 | %\node[derived attribute] (age) [right of=person] {Age} edge (person); | ||
4847 | |||
4848 | \node[relationship] (drives) [below right of=person] {DRIVES} edge node[above, pos=0.1] {$1$} (person); | ||
4849 | \node[entity] (car) [below left of=drives] {CAR} edge node[above, pos=0.7] {$1$} (drives); | ||
4850 | \node[attribute] (make) [left of=car] {Make} edge (car); | ||
4851 | \node[attribute] (year) [below left of =car] {Year} edge (car); | ||
4852 | \node[attribute] (brand) [below of =car] {Brand} edge (car); | ||
4853 | |||
4854 | \node[relationship] (seats) [below left of=person] {SEATS\_IN} edge node[above, pos=0.1] {$N$} (person); | ||
4855 | \draw (seats) edge node[above, pos=0.3] {$1$} (car); | ||
4856 | \node[attribute] (position) [left of=seats] {Position} edge (seats); | ||
4857 | |||
4858 | \node[ident relationship] (insured) [right of=car] {INSURED} edge node[above, pos=0.3] {$1$} (car); | ||
4859 | \node[weak entity] (insurance) [right = 1cm of insured] {CAR\_INSURANCE} edge[total] node[above, pos=0.7] {$N$} (insured); | ||
4860 | \node[attribute] (amount) [above of =insurance] {Covered Amount} edge (insurance); | ||
4861 | \node[attribute] (policy) [above right of =insurance] {Policy Number} edge (insurance); | ||
4862 | \node[attribute] (company) [below right of =insurance] {Company Name} edge (insurance); | ||
4863 | \end{tikzpicture} | ||
4731 | { width=100% } | ||
4732 | \ | ||
4864 | 4733 | ||
4865 | 4734 | Note that a car can have at most one driver, $N$ passengers, $N$ insurances, and that car insurances exist only if they are "tied up" to a car (i.e., they are weak entities, and their identifying relationship is called "Insured"). | Note that a car can have at most one driver, $N$ passengers, $N$ insurances, and that car insurances exist only if they are "tied up" to a car (i.e., they are weak entities, and their identifying relationship is called "Insured"). |
4866 | 4735 |
File notes/vec/er/Accident.tex added (mode: 100644) (index 0000000..1b3d330) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[entity] (person) {Person}; | ||
6 | \node[attribute] (pid) [left of=person] {\key{id}} edge (person); | ||
7 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
8 | \node[attribute] (address) [below left of=person] {address} edge (person); | ||
9 | |||
10 | \node[relationship] (owns) [above right of=person] {Owns} edge node[above, sloped]{$M$} (person); | ||
11 | \node[entity] (car) [above right of=owns] {Car} edge node[above, sloped]{$N$} (owns); | ||
12 | \node[attribute] (licence) [above left of=car] {\key{licence}} edge (car); | ||
13 | \node[attribute] (model) [above of =car] {model} edge (car); | ||
14 | \node[attribute] (year) [above right of =car] {year} edge (car); | ||
15 | |||
16 | \node[relationship] (accident) [right = 5cm of person] {Accident} edge[total] node[above, sloped]{$M$} (person); | ||
17 | \node[attribute] (report_number) [below of = accident] {\key{Report Number}} edge (accident); | ||
18 | \node[attribute] (time) [right of = accident] {Time} edge (accident); | ||
19 | \node[attribute] (place) [below right of = accident] {Place} edge (accident); | ||
20 | \node[attribute] (damage_amount) [above right of = accident] {Damage\_Amount} edge (accident); | ||
21 | |||
22 | \draw (car) edge[total] node[above, sloped]{$N$} (accident); | ||
23 | \end{tikzpicture} | ||
24 | |||
25 | \end{document} |
File notes/vec/er/Bad_Design.tex changed (mode: 100644) (index 0a88db9..d477a12) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=2em] | \begin{tikzpicture}[node distance=2em] |
File notes/vec/er/Belongs.tex added (mode: 100644) (index 0000000..6437cc9) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[relationship] (contains){BELONGS}; | ||
6 | \node[entity] (burger) [left = 1cm of contains] {HAND} edge node[above] {$N$} (contains); | ||
7 | \node[entity] (ingredient) [right = 1cm of contains] {PERSON} edge node[above]{$1$} (contains); | ||
8 | \end{tikzpicture} | ||
9 | |||
10 | \end{document} |
File notes/vec/er/Car_Info.tex added (mode: 100644) (index 0000000..7daac71) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=8em] | ||
5 | \node[entity] (person) {PERSON}; | ||
6 | \node[attribute] (pid) [left of=person] {\key{ID}} edge (person); | ||
7 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
8 | \node[multi attribute] (phone) [above of=person] {Phone} edge (person); | ||
9 | \node[attribute] (address) [above right of=person] {Address} edge (person); | ||
10 | \node[attribute] (street) [above right of=address] {Street} edge (address); | ||
11 | \node[attribute] (city) [right of=address] {City} edge (address); | ||
12 | %\node[derived attribute] (age) [right of=person] {Age} edge (person); | ||
13 | |||
14 | \node[relationship] (drives) [below right of=person] {DRIVES} edge node[above, pos=0.1] {$1$} (person); | ||
15 | \node[entity] (car) [below left of=drives] {CAR} edge node[above, pos=0.7] {$1$} (drives); | ||
16 | \node[attribute] (make) [left of=car] {Make} edge (car); | ||
17 | \node[attribute] (year) [below left of =car] {Year} edge (car); | ||
18 | \node[attribute] (brand) [below of =car] {Brand} edge (car); | ||
19 | |||
20 | \node[relationship] (seats) [below left of=person] {SEATS\_IN} edge node[above, pos=0.1] {$N$} (person); | ||
21 | \draw (seats) edge node[above, pos=0.3] {$1$} (car); | ||
22 | \node[attribute] (position) [left of=seats] {Position} edge (seats); | ||
23 | |||
24 | \node[ident relationship] (insured) [right of=car] {INSURED} edge node[above, pos=0.3] {$1$} (car); | ||
25 | \node[weak entity] (insurance) [right = 1cm of insured] {CAR\_INSURANCE} edge[total] node[above, pos=0.7] {$N$} (insured); | ||
26 | \node[attribute] (amount) [above of =insurance] {Covered Amount} edge (insurance); | ||
27 | \node[attribute] (policy) [above right of =insurance] {Policy Number} edge (insurance); | ||
28 | \node[attribute] (company) [below right of =insurance] {Company Name} edge (insurance); | ||
29 | \end{tikzpicture} | ||
30 | |||
31 | \end{document} |
File notes/vec/er/Cellphone.tex added (mode: 100644) (index 0000000..560c3a6) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[entity] (cellphone) {CELLPHONE}; | ||
6 | \node[attribute] (mid) [left of=cellphone] {\key{MIN}} edge (cellphone); | ||
7 | \node[multi attribute] (app) [above of=cellphone] {App\_Installed} edge (cellphone); | ||
8 | \node[attribute] (plan) [right of=cellphone] {Plan} edge (cellphone); | ||
9 | \node[attribute] (carrier) [above right of=plan] {Carrier} edge (plan); | ||
10 | \node[attribute] (price) [right of=plan] {Price} edge (plan); | ||
11 | \end{tikzpicture} | ||
12 | |||
13 | \end{document} |
File notes/vec/er/Computer.tex added (mode: 100644) (index 0000000..d79068f) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[entity] (computer) {COMPUTER}; | ||
6 | \node[attribute] (pid) [left of=computer] {\key{Id}} edge (computer); | ||
7 | \node[multi attribute] (os) [above of=computer] {Operating\_System} edge (computer); | ||
8 | \node[attribute] (devices) [right of=computer] {Devices} edge (computer); | ||
9 | \node[attribute] (mouse) [above right of=devices] {Mouse} edge (devices); | ||
10 | \node[attribute] (keyboard) [right of=devices] {Keyboard} edge (devices); | ||
11 | \end{tikzpicture} | ||
12 | |||
13 | \end{document} |
File notes/vec/er/Constraint2.tex changed (mode: 100644) (index 1fac64e..180a47a) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=5em] | \begin{tikzpicture}[node distance=5em] |
File notes/vec/er/Contains.tex added (mode: 100644) (index 0000000..dca2dd2) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[relationship] (contains){CONTAINS}; | ||
6 | \node[entity] (burger) [left = 1cm of contains] {BURGER} edge[total] node[above] {$N$} (contains); | ||
7 | \node[entity] (ingredient) [right = 1cm of contains] {INGREDIENT} edge node[above]{$M$} (contains); | ||
8 | \end{tikzpicture} | ||
9 | |||
10 | \end{document} |
File notes/vec/er/Country.tex added (mode: 100644) (index 0000000..ca4e3e6) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=8em] | ||
5 | \node[entity] (COUNTRY) {COUNTRY}; | ||
6 | \node[attribute] (name) [left of=COUNTRY] {\key{Name}} edge (COUNTRY); | ||
7 | \node[attribute] (population) [below left of=COUNTRY] {Population} edge (COUNTRY); | ||
8 | |||
9 | \node[relationship] (SPEAKS) [below right of=COUNTRY] {SPEAKS} edge node[right, pos=0.4] {$M$} (COUNTRY); | ||
10 | \node[entity] (LANGUAGE) [below right of=SPEAKS] {LANGUAGE} edge node[right, pos=0.5] {$N$} (SPEAKS); | ||
11 | \node[attribute] (code) [left of = LANGUAGE] {\key{Code}} edge (LANGUAGE); | ||
12 | \node[attribute] (symbol) [right of = LANGUAGE] {Name} edge (LANGUAGE); | ||
13 | |||
14 | \node[relationship] (BWF) [below of = LANGUAGE] {B\_W\_F}; | ||
15 | \draw (LANGUAGE) to node[left, pos=0.6] {$N$} (BWF.west); | ||
16 | \draw (LANGUAGE) to node[right, pos=0.6] {$M$} (BWF.east); | ||
17 | |||
18 | %\node[relationship] (boundary) [above of = COUNTRY] {S\_B\_W}; | ||
19 | %\draw (COUNTRY) to node[left, pos=0.6] {$N$} (boundary.west); | ||
20 | %\draw (COUNTRY) to node[right, pos=0.6] {$M$} (boundary.east); | ||
21 | |||
22 | %\node[relationship] (conversion) [below of =LANGUAGE] {CONVERSION}; | ||
23 | %\draw (LANGUAGE) to node[left, pos=0.6] {$N$} (conversion.west); | ||
24 | %\draw (LANGUAGE) to node[right, pos=0.6] {$M$} (conversion.east); | ||
25 | |||
26 | %\node[attribute] (timestamp) [below left of=conversion] {\key{Timestamp}} edge (conversion); | ||
27 | %\node[attribute] (rate) [below right of=conversion] {Exchange\_rate} edge (conversion); | ||
28 | |||
29 | \node[ident relationship] (hasfor) [right of=COUNTRY] {SINGS} edge node[above, pos=0.4] {$1$} (COUNTRY); | ||
30 | \node[weak entity] (anthem) %[right of=hasfor] | ||
31 | [right = 1cm of hasfor] {NATIONAL\_ANTHEM} edge[total] node[above, pos=0.6]{$M$} (hasfor); | ||
32 | \node[multi attribute] (color) [right =1cm of anthem] {Creator} edge (anthem); | ||
33 | \node[attribute] (name) [below right of = anthem] {\pkey{Name}} edge (anthem); | ||
34 | |||
35 | \node[relationship] (WIN) [above right of =LANGUAGE] {W\_IN}; | ||
36 | \draw (LANGUAGE) to node[left, pos=0.6] {$N$} (WIN); | ||
37 | \draw (anthem) to node[right, pos=0.6] {$M$} (WIN); | ||
38 | \end{tikzpicture} | ||
39 | |||
40 | \end{document} |
File notes/vec/er/Entity_Instructor.tex changed (mode: 100644) (index 9f29d5f..aff21e5) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=7em] | \begin{tikzpicture}[node distance=7em] |
File notes/vec/er/Naming.tex changed (mode: 100644) (index 1437e16..e884bb8) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=7em] | \begin{tikzpicture}[node distance=7em] |
File notes/vec/er/Person.tex added (mode: 100644) (index 0000000..420bb68) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[entity] (person) {PERSON}; | ||
6 | \node[attribute] (ssn) [left of=person] {\key{SSN}} edge (person); | ||
7 | \node[attribute] (dob) [above of=person] {Date\_Of\_Birth} edge (person); | ||
8 | \node[derived attribute] (age) [right of=person] {Age} edge (person); | ||
9 | \end{tikzpicture} | ||
10 | |||
11 | |||
12 | \end{document} |
File notes/vec/er/Pilot.tex added (mode: 100644) (index 0000000..03a2761) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=8em] | ||
5 | \node[entity] (person) {PILOT}; | ||
6 | \node[attribute] (pid) [left of=person] {\key{ID}} edge (person); | ||
7 | \node[attribute] (name) [above left of=person] {Name} edge (person); | ||
8 | \node[attribute] (phone) [above of=person] {Experience} edge (person); | ||
9 | |||
10 | \node[relationship] (drives) [below of=person] {ASSIGNED\_TO} edge node[right, pos=0.1] {$N$} (person); | ||
11 | \node[entity] (plane) [below of=drives] {PLANE} edge [total] node[right, pos=0.7] {$1$} (drives); | ||
12 | \node[attribute] (make) [left of=plane] {\key{TailID}} edge (plane); | ||
13 | \node[attribute] (maxS) [below left of =plane] {MaxSpeed} edge (plane); | ||
14 | \node[attribute] (airPlaneType) [below of = plane] {AirPlaneType} edge (plane); | ||
15 | \end{tikzpicture} | ||
16 | |||
17 | \end{document} |
File notes/vec/er/Rel_Instance.tex changed (mode: 100644) (index 348d484..49d047a) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=2em] | \begin{tikzpicture}[node distance=2em] |
File notes/vec/er/Role_Name1.tex changed (mode: 100644) (index 9c39784..354254b) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=5em] | \begin{tikzpicture}[node distance=5em] |
File notes/vec/er/Role_Name2.tex changed (mode: 100644) (index b8a1710..a4e744c) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=5em] | \begin{tikzpicture}[node distance=5em] |
File notes/vec/er/Role_Name3.tex changed (mode: 100644) (index 1e0e6e1..5feef1f) | |||
1 | % !TeX document-id = {9fd243f0-f0ae-45f7-9f88-fa9555c363d3} | ||
2 | % !TeX TXS-program:compile = txs:///xelatex/[--shell-escape] | ||
3 | \documentclass[convert={outfile=\jobname.svg},border=20pt]{standalone} | ||
1 | \documentclass[border=20pt]{standalone} | ||
4 | 2 | \input{template.def} | \input{template.def} |
5 | 3 | ||
6 | 4 | \begin{tikzpicture}[node distance=5em] | \begin{tikzpicture}[node distance=5em] |
File notes/vec/er/Stays_At.tex added (mode: 100644) (index 0000000..bb77f8c) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[node distance=7em] | ||
5 | \node[relationship] (contains){STAYS\_AT}; | ||
6 | \node[entity] (person) [above = 1cm of contains] {PERSON} edge node[right] {$N$} (contains);; | ||
7 | \node[attribute] (ssn) [left of=person] {\key{SSN}} edge (person); | ||
8 | \node[attribute] (dob) [above = .5cm of person] {Date\_Of\_Birth} edge (person); | ||
9 | \node[entity] (burger) [below of= contains] {PLACE} edge node[right] {$1$} (contains); | ||
10 | \node[attribute] (dob) [below = .5cm of burger] {\key{Address}} edge (burger); | ||
11 | \node[attribute] (ssn) [left of=burger] {Rooms} edge (burger); | ||
12 | \end{tikzpicture} | ||
13 | |||
14 | \end{document} |
File notes/vec/uml/Flight.tex added (mode: 100644) (index 0000000..d9023c1) | |||
1 | \documentclass[border=20pt]{standalone} | ||
2 | \input{template.def} | ||
3 | |||
4 | \begin{tikzpicture}[scale = 0.8] | ||
5 | \begin{class}[text width=7cm]{Flight}{0,0} | ||
6 | \attribute{flightNumber : Integer} | ||
7 | \attribute{departureTime : Date} | ||
8 | \attribute{flightDuration : Minutes} | ||
9 | \attribute{departingAirport : String} | ||
10 | \attribute{arrivingAirport : String} | ||
11 | \operation{delayFlight(numberOfMinutes : Minutes)} | ||
12 | \operation{getArrivalTime( ) : Date} | ||
13 | \end{class} | ||
14 | \begin{class}{Plane}{11, -0.8} | ||
15 | \attribute{airPlaneType : String} | ||
16 | \attribute{maximumSpeed : MPH} | ||
17 | \attribute{maximumDistance : Miles} | ||
18 | \attribute{tailID : String} | ||
19 | \end{class} | ||
20 | \association{Plane}{}{0..1}{Flight}{0..*}{} | ||
21 | \end{tikzpicture} | ||
22 | |||
23 | \end{document} |
File notes/vec/uml/template.def added (mode: 100644) (index 0000000..06be5f3) | |||
1 | \renewcommand\familydefault{\sfdefault} % Default family: serif | ||
2 | |||
3 | \usepackage[simplified]{pgf-umlcd} | ||
4 | \begin{document} |