Difference between revisions of "Relation Table"
| (One intermediate revision by the same user not shown) | |||
| Line 2: | Line 2: | ||
This is how the [https://en.wikipedia.org/wiki/Graph_(discrete_mathematics) graph] of Truxton objects is stored. | This is how the [https://en.wikipedia.org/wiki/Graph_(discrete_mathematics) graph] of Truxton objects is stored. | ||
| + | =SQL= | ||
<source lang="SQL"> | <source lang="SQL"> | ||
CREATE TABLE "Relation" | CREATE TABLE "Relation" | ||
| Line 14: | Line 15: | ||
); | ); | ||
</source> | </source> | ||
| + | |||
| + | =Columns= | ||
| + | ==<code>A_ID</code>== | ||
| + | The globally unique identifier of the first item. | ||
| + | |||
| + | ==<code>B_ID</code>== | ||
| + | The globally unique identifier of the second item. | ||
| + | |||
| + | ==<code>A_ObjectTypeID</code>== | ||
| + | What type A is. | ||
| + | This corresponds to the <code>ID</code> column of the <code>[ObjectType]</code> table. | ||
| + | It should be one of [[Object_Types|these]] values. | ||
| + | |||
| + | ==<code>B_ObjectTypeID</code>== | ||
| + | What B is. | ||
| + | This corresponds to the <code>ID</code> column of the <code>[ObjectType]</code> table. | ||
| + | It should be one of [[Object_Types|these]] values. | ||
| + | |||
| + | ==<code>RelationTypeID</code>== | ||
| + | What relates these two items. | ||
| + | This corresponds to the <code>ID</code> column of the <code>[RelationType]</code> table. | ||
| + | It should be one of [[Relation_Types|these]] types. | ||
| + | |||
| + | ==<code>SourceID</code>== | ||
| + | What related these two items. This uuid points to the reason why we added this record to the table. | ||
| + | |||
| + | ==<code>SourceObjectTypeID</code>== | ||
| + | The type of <code>Source</code>. | ||
| + | This corresponds to the <code>ID</code> column of the <code>[ObjectType]</code> table. | ||
| + | It should be one of [[Object_Types|these]] values. | ||
Latest revision as of 05:56, 27 January 2024
This table stores the relationships between things in Truxton. This is how the graph of Truxton objects is stored.
Contents
SQL
CREATE TABLE "Relation"
(
"A_ID" uuid NOT NULL,
"B_ID" uuid NOT NULL,
"A_ObjectTypeID" smallint NOT NULL,
"B_ObjectTypeID" smallint NOT NULL,
"RelationTypeID" integer NOT NULL,
"SourceID" uuid NOT NULL,
"SourceObjectTypeID" smallint NOT NULL
);
Columns
A_ID
The globally unique identifier of the first item.
B_ID
The globally unique identifier of the second item.
A_ObjectTypeID
What type A is.
This corresponds to the ID column of the [ObjectType] table.
It should be one of these values.
B_ObjectTypeID
What B is.
This corresponds to the ID column of the [ObjectType] table.
It should be one of these values.
RelationTypeID
What relates these two items.
This corresponds to the ID column of the [RelationType] table.
It should be one of these types.
SourceID
What related these two items. This uuid points to the reason why we added this record to the table.
SourceObjectTypeID
The type of Source.
This corresponds to the ID column of the [ObjectType] table.
It should be one of these values.