|
11 | 11 | "cell_type": "markdown", |
12 | 12 | "metadata": {}, |
13 | 13 | "source": [ |
14 | | - "Master-part relationships capture the idea that a given entity (*master*) may include several tightly-coupled component entities (*parts*) spread across multiple tables. \n", |
| 14 | + "Master-part relationships express the idea that a given entity (*master*) may include several tightly-coupled component entities (*parts*) spread across multiple tables. \n", |
15 | 15 | "This notion is also described as *compositional integrity*.\n", |
16 | 16 | "\n", |
17 | 17 | "In DataJoint's relational workflow philosophy, a master part relationship expresses the notion of populated multiple related data artifacts in a single workflow step.\n", |
|
44 | 44 | "text": [ |
45 | 45 | "Exception reporting mode: Minimal\n" |
46 | 46 | ] |
47 | | - }, |
48 | | - { |
49 | | - "ename": "ModuleNotFoundError", |
50 | | - "evalue": "No module named 'datajoint'", |
51 | | - "output_type": "error", |
52 | | - "traceback": [ |
53 | | - "\u001b[0;31mModuleNotFoundError\u001b[0m\u001b[0;31m:\u001b[0m No module named 'datajoint'\n" |
54 | | - ] |
55 | 47 | } |
56 | 48 | ], |
57 | 49 | "source": [ |
|
64 | 56 | "@schema \n", |
65 | 57 | "class Polygon(dj.Manual):\n", |
66 | 58 | " definition = \"\"\"\n", |
67 | | - " polygon_id : uint16\n", |
| 59 | + " polygon_id : int\n", |
68 | 60 | " \"\"\"\n", |
69 | 61 | "\n", |
70 | 62 | " class Vertex(dj.Part):\n", |
71 | 63 | " definition = \"\"\"\n", |
72 | 64 | " -> master\n", |
73 | | - " vertex_id : uint16 \n", |
| 65 | + " vertex_id : int \n", |
74 | 66 | " ---\n", |
75 | | - " x : float32\n", |
76 | | - " y : float32\n", |
| 67 | + " x : float\n", |
| 68 | + " y : float\n", |
77 | 69 | " \"\"\"\n", |
78 | 70 | "\n", |
79 | 71 | " # Explicit numeric datatypes such as float32 and uint16 are introduced in DataJoint 2.0.\n", |
|
86 | 78 | "metadata": {}, |
87 | 79 | "outputs": [ |
88 | 80 | { |
89 | | - "ename": "NameError", |
90 | | - "evalue": "name 'dj' is not defined", |
91 | | - "output_type": "error", |
92 | | - "traceback": [ |
93 | | - "\u001b[0;31mNameError\u001b[0m\u001b[0;31m:\u001b[0m name 'dj' is not defined\n" |
94 | | - ] |
| 81 | + "data": { |
| 82 | + "image/svg+xml": [ |
| 83 | + "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"98pt\" height=\"98pt\" viewBox=\"0.00 0.00 98.00 98.00\">\n", |
| 84 | + "<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 94)\">\n", |
| 85 | + "<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-94 94,-94 94,4 -4,4\"/>\n", |
| 86 | + "<!-- Polygon -->\n", |
| 87 | + "<g id=\"node1\" class=\"node\">\n", |
| 88 | + "<title>Polygon</title>\n", |
| 89 | + "<g id=\"a_node1\"><a xlink:title=\"polygon_id \">\n", |
| 90 | + "<polygon fill=\"#00ff00\" fill-opacity=\"0.188235\" stroke=\"#00ff00\" stroke-opacity=\"0.188235\" points=\"76.5,-90 13.5,-90 13.5,-55 76.5,-55 76.5,-90\"/>\n", |
| 91 | + "<text text-anchor=\"start\" x=\"21.5\" y=\"-70.4\" font-family=\"arial\" text-decoration=\"underline\" font-size=\"12.00\" fill=\"darkgreen\">Polygon</text>\n", |
| 92 | + "</a>\n", |
| 93 | + "</g>\n", |
| 94 | + "</g>\n", |
| 95 | + "<!-- Polygon.Vertex -->\n", |
| 96 | + "<g id=\"node2\" class=\"node\">\n", |
| 97 | + "<title>Polygon.Vertex</title>\n", |
| 98 | + "<g id=\"a_node2\"><a xlink:title=\"→ Polygon vertex_id ------------------------------ x y \">\n", |
| 99 | + "<polygon fill=\"transparent\" stroke=\"transparent\" points=\"90,-19 0,-19 0,0 90,0 90,-19\"/>\n", |
| 100 | + "<text text-anchor=\"start\" x=\"8\" y=\"-8\" font-family=\"arial\" text-decoration=\"underline\" font-size=\"10.00\">Polygon.Vertex</text>\n", |
| 101 | + "</a>\n", |
| 102 | + "</g>\n", |
| 103 | + "</g>\n", |
| 104 | + "<!-- Polygon->Polygon.Vertex -->\n", |
| 105 | + "<g id=\"edge1\" class=\"edge\">\n", |
| 106 | + "<title>Polygon->Polygon.Vertex</title>\n", |
| 107 | + "<path fill=\"none\" stroke=\"#000000\" stroke-width=\"0.75\" stroke-opacity=\"0.250980\" d=\"M45,-54.83C45,-43.26 45,-28.32 45,-19.08\"/>\n", |
| 108 | + "</g>\n", |
| 109 | + "</g>\n", |
| 110 | + "</svg>" |
| 111 | + ], |
| 112 | + "text/plain": [ |
| 113 | + "<datajoint.diagram.Diagram at 0xffff27979d30>" |
| 114 | + ] |
| 115 | + }, |
| 116 | + "execution_count": 3, |
| 117 | + "metadata": {}, |
| 118 | + "output_type": "execute_result" |
95 | 119 | } |
96 | 120 | ], |
97 | 121 | "source": [ |
|
179 | 203 | "\n", |
180 | 204 | "Master-part relationships provide a concise and expressive way to model a master record that owns several subordinate rows. DataJoint’s nested class syntax, simplified foreign key, and transactional populate make this pattern easy to express and safe to use. In the context of relational workflows, masters act as workflow nodes, while parts capture the detailed payload generated in the same workflow step.\n" |
181 | 205 | ] |
182 | | - }, |
183 | | - { |
184 | | - "cell_type": "markdown", |
185 | | - "metadata": {}, |
186 | | - "source": [] |
187 | 206 | } |
188 | 207 | ], |
189 | 208 | "metadata": { |
190 | 209 | "kernelspec": { |
191 | | - "display_name": "Python 3", |
| 210 | + "display_name": "base", |
192 | 211 | "language": "python", |
193 | 212 | "name": "python3" |
194 | 213 | }, |
|
202 | 221 | "name": "python", |
203 | 222 | "nbconvert_exporter": "python", |
204 | 223 | "pygments_lexer": "ipython3", |
205 | | - "version": "3.11.11" |
| 224 | + "version": "3.13.2" |
206 | 225 | } |
207 | 226 | }, |
208 | 227 | "nbformat": 4, |
|
0 commit comments