Source

htsql / doc / dia / model-and-instance.tex

\documentclass{article}

\include{prelude}

\begin{document}

\tikzset{
    > = stealth', shorten > = 1pt, shorten < = 1pt,
    class/.style = {fill, circle, inner sep=0pt, minimum size=2mm},
    record/.style = {draw, circle, inner sep=0pt, minimum size=2mm},
    link/.style = {font=\small\itshape},
    envelope/.style = {rectangle, draw=blue!50, rounded corners},
    envelope header/.style = {font=\bfseries\color{blue!75}},
}

\begin{tikzpicture}

\node[class] (school) {};
\node[class] (department) [left=3 of school] {};
\node[class] (program) [below=5 of school.north, anchor=south] {};
\node[class] (course) [left=3 of program] {};

\node[above] (school label) at (school.north)
    {School};
\node[above] (department label) at (department.north)
    {Department};
\node[below] (program label) at (program.south)
    {Program};
\node[below] (course label) at (course.south)
    {Course};

\draw[->]
    (department)
    to node[link,below] {associated with}
    (school);
\draw[->]
    (program)
    to node[link,sloped,above] {administered by}
    (school);
\draw[->]
    (course)
    to node[link,sloped,above] {offered by}
    (department);

\node[envelope] (model)
    [fit=(school label) (department label) (program label) (course label)] {};

\node[envelope header] at (model.north) [above]
    {Model};

\node[record] (comp) [right=4 of school.east, anchor=west] {};
\node[record] (comp 304) [below=5 of comp.north, anchor=south] {};
\node[record] (eng) [right=5 of comp.north, anchor=north] {};
\node[record] (ucompsci) [below=5 of eng.north, anchor=south] {};

\node[record,dotted] [left=0.1 of comp.west] {};
\node[record,dotted] [left=0.4 of comp.west] {};
\node[record,dotted] [left=0.1 of comp 304.west] {};
\node[record,dotted] [left=0.4 of comp 304.west] {};
\node[record,dotted] [right=0.1 of comp 304.east] {};
\node[record,dotted] [right=0.4 of comp 304.east] {};
\node[record,dotted] [right=0.1 of eng.east] {};
\node[record,dotted] [right=0.4 of eng.east] {};
\node[record,dotted] [left=0.1 of ucompsci.west] {};
\node[record,dotted] [left=0.4 of ucompsci.west] {};
\node[record,dotted] [right=0.1 of ucompsci.east] {};
\node[record,dotted] [right=0.4 of ucompsci.east] {};

\node[above] (comp label) at (comp.north)
    {Dept. of Computer Science};
\node[below] (comp 304 label) at (comp 304.south)
    {Database Theory};
\node[above] (eng label) at (eng.north)
    {School of Engineering};
\node[below] (ucompsci label) at (ucompsci.south)
    {B.S. in Computer Science};

\draw[->]
    (comp)
    to node[link,below] {associated with}
    (comp -| eng.west);
\draw[->]
    (ucompsci)
    to node[link,sloped,above] {administered by}
    (eng);
\draw[->]
    (comp 304)
    to node[link,sloped,above] {offered by}
    (comp);

\node[envelope] (instance)
    [fit=(eng label) (comp label) (comp 304 label) (ucompsci label)] {};

\node[envelope header] at (instance.north) [above]
    {Instance};

\end{tikzpicture}

\end{document}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.