tailieunhanh - PATTERNS OF DATA MODELING- P14

PATTERNS OF DATA MODELING- P14: Models provide the means for building quality software in a predictable manner. Models let developers think deeply about software and cope with large size and complexity. Developers can think abstractly before becoming enmeshed in the details of writing code. Although models are beneficial, they can be difficult to construct. That is where patterns come in. Patterns provide building blocks that help developers construct models faster and better. | 46 Chapter 3 Directed Graph Template DG Figure Node and edge directed graph IDEF1X template. SQL Queries Figure Figure and Figure show SQL queries for common traversals of the template. The colon prefix denotes variable values that must be provided for each query. SELECT FROM Edge AS E INNER JOIN Node AS Source ON WHERE aSourceNodeID ORDER BY Figure Node and edge directed graph SQL query. Find the edges that originate from a node. SELECT FROM Edge AS E INNER JOIN Node AS Sink ON WHERE aSinkNodeID ORDER BY Figure Node and edge directed graph SQL query. Find the edges that terminate at a node. SELECT AS srcNodeID AS srcNodeName AS sinkNodeID AS sinkNodeName FROM Edge AS E INNER JOIN Node AS Src ON INNER JOIN Node AS Sink ON WHERE anEdgeID Figure Node and edge directed graph SQL query. Find the source and sink nodes for an edge. Node and Edge Directed Graph Template 47 Sample Populated Tables Figure and Figure show node and edge directed graph tables populated with data. The values of the IDs are arbitrary but internally consistent. Node table node ID dgID node Name 1 1 A 2 1 B 3 1 C 4 1 D 5 1 E 6 1 F Edge table edgeID dgID edgeName sourceNodeID sinkNodelD 51 1 c 1 3 52 1 d 1 4 53 1 e 1 5 54 1 f 2 5 55 1 g 3 6 56 1 h 4 6 57 1 i 5 6 Figure Node and edge directed graph Populated tables. Node table node ID dgID node Name 11 2 X 12 2 Y edgeID dgID edgeName sourceNodeID sinkNodeID 61 2 r 11 12 62 2 s 11 12 63 2 t 11 11 Figure Node and edge directed graph Populated tables. 48 Chapter 3 Directed Graph Template Examples The node and edge directed graph is the most common representation. Figure shows an example for published flights. Figure .

TỪ KHÓA LIÊN QUAN