|
<?xml version='1.0' standalone='yes'?> |
|
1 |
<Database> |
<Database> |
2 |
<Title>Attributes Database</Title> |
<Title>Attributes Database</Title> |
3 |
|
<Notes>The Attributes Database allows applications to upload and retrieve |
4 |
|
custom data for NMPDR data objects. It uses the ERDB database system (which |
5 |
|
is also used by the [[SproutDatabase]] and the [[SaplingDatabase]]) to |
6 |
|
store the attributes. Attributes differ from conventional data in that they |
7 |
|
are unstructured: new attributes can be added without modifying the database |
8 |
|
design. A single attribute database services the entire NMPDR complex. |
9 |
|
%BR%%BR% |
10 |
|
Attributes are organized by _attribute key_. Attribute values are |
11 |
|
assigned to _objects_. In the real world, objects have types and IDs; |
12 |
|
however, to the attribute database only the ID matters. In general, it |
13 |
|
is possible to determine the object type from the format of the ID, but |
14 |
|
it doesn't matter to the database. |
15 |
|
%BR%%BR% |
16 |
|
The actual attribute values are stored as a relationship between the attribute |
17 |
|
keys and the objects. There can be multiple values for a single key/object pair. |
18 |
|
|
19 |
|
</Notes> |
20 |
<Entities> |
<Entities> |
21 |
<Entity name="AttributeGroup" keyType="name-string"> |
<Entity name="AttributeGroup" keyType="name-string"> |
22 |
<Notes>A [i]group[/i] is a named set of attribute keys. An attribute key can belong to |
<DisplayInfo theme="seed" col="3" row="1" caption="Attribute Group" /> |
23 |
|
<Notes>A group is a named set of attribute keys. An attribute key can belong to |
24 |
many groups or none at all.</Notes> |
many groups or none at all.</Notes> |
25 |
|
<Asides>Groups provide a useful mechanism for classifying certain types of attribute |
26 |
|
keys. An attribute key's group membership is updated using a table of checkboxes |
27 |
|
in the attribute web interface. The interface also allows new groups to be created. |
28 |
|
There is a group for attributes that are only used for %FIG{ProteinEncodingGroups}% |
29 |
|
and another for attributes that require NMPDR support. Groups can also be used |
30 |
|
to specify attribute key white lists for individual applications.</Asides> |
31 |
</Entity> |
</Entity> |
32 |
<Entity name="AttributeKey" keyType="name-string"> |
<Entity name="AttributeKey" keyType="name-string"> |
33 |
<Notes>An [i]attribute key[/i] describes named values attached to a particular type of object. |
<DisplayInfo theme="seed" col="3" row="3" caption="Attribute Key" /> |
34 |
|
<Notes>An attribute key describes named values attached to a particular type of object. |
35 |
Each instance of this entity contains the attribute's description and its name. An attribute |
Each instance of this entity contains the attribute's description and its name. An attribute |
36 |
key name must consist of letters, numbers, periods, underscores, and hyphens.</Notes> |
key name must consist of letters, numbers, periods, underscores, and/or hyphens.</Notes> |
37 |
<Fields> |
<Fields> |
38 |
<Field name="description" type="text"> |
<Field name="description" type="text"> |
39 |
<Notes>Text describing the attribute. This should explain what the attribute means and |
<Notes>Text describing the attribute. This should explain what the attribute means and |
40 |
what kinds of values are appropriate.</Notes> |
what kinds of values are appropriate.</Notes> |
41 |
</Field> |
</Field> |
42 |
<Field name="data-type" type="name-string"> |
<Field name="relationship-name" type="name-string"> |
43 |
<Notes>ERDB data type for the attribute. This serves as documentation only, but |
<Notes>Name of the relationship containing the attribute data. This relationship |
44 |
that may change at some future point.</Notes> |
must look exactly like HasValueFor. The only difference is the table name.</Notes> |
45 |
|
<Asides>In order to improve performance of batch updates, some attributes |
46 |
|
are stored in private relationship tables. When retrieving attributes, we need |
47 |
|
to check each attribute key's private table for the data. The tables have |
48 |
|
the same structure as HasValueFor. They are separated solely for performance |
49 |
|
reasons.</Asides> |
50 |
</Field> |
</Field> |
51 |
</Fields> |
</Fields> |
52 |
</Entity> |
</Entity> |
53 |
<Entity name="TargetObject" keyType="string"> |
<Entity name="TargetObject" keyType="string"> |
54 |
<Notes>An [i]object[/i] represents a keyed thing to which an attribute can be assigned. |
<DisplayInfo theme="neutral" col="3" row="5" caption="Target Object" /> |
55 |
|
<Notes>An object represents a keyed thing to which an attribute can be assigned. |
56 |
In order to improve performance, this table has no data in it. It is simply required by |
In order to improve performance, this table has no data in it. It is simply required by |
57 |
the semantics of the database.</Notes> |
the semantics of the database.</Notes> |
58 |
</Entity> |
</Entity> |
59 |
</Entities> |
</Entities> |
60 |
<Relationships> |
<Relationships> |
61 |
|
<Relationship name="IsEvidencedBy" to="TargetObject" from="AttributeKey" arity="MM" converse="HasEvidence"> |
62 |
|
<DisplayInfo theme="seed" col="3.5" row="4" fixed="1" caption="Is\nEvidenced\nBy" /> |
63 |
|
<Notes>This relationship connects a feature (target object) to its evidence |
64 |
|
attributes.</Notes> |
65 |
|
<Asides>This table exists to separate evidence codes from other attributes for |
66 |
|
performance reasons. Evidence codes are built from scratch several times a week. |
67 |
|
Erasing an entire table is faster than erasing individual rows, so putting the |
68 |
|
evidence codes in their own private table provides significant benefits.</Asides> |
69 |
|
<Fields> |
70 |
|
<Field name="subkey" type="string"> |
71 |
|
<Notes>Some attribute keys are split into two parts. The real key is controlled and |
72 |
|
must correspond to a key in the AttributeKey table. The second part of the key |
73 |
|
resides in this field. When the attribute value is presented to the user, the two |
74 |
|
parts of the key are joined together around the splitter value.</Notes> |
75 |
|
</Field> |
76 |
|
<Field name="value" type="text"> |
77 |
|
<Notes>This is the actual attribute value. Note that a single key/object pair may in fact |
78 |
|
have many values, and therefore many entries in this table.</Notes> |
79 |
|
</Field> |
80 |
|
</Fields> |
81 |
|
<FromIndex> |
82 |
|
<Notes>This index sorts all the values for a single attribute key by the subkey value.</Notes> |
83 |
|
<IndexFields> |
84 |
|
<IndexField name="subkey" order="ascending" /> |
85 |
|
</IndexFields> |
86 |
|
</FromIndex> |
87 |
|
<ToIndex> |
88 |
|
<Notes>This index sorts all the values for an object by attribute key and the subkey.</Notes> |
89 |
|
<IndexFields> |
90 |
|
<IndexField name="from-link" order="ascending" /> |
91 |
|
<IndexField name="subkey" order="ascending" /> |
92 |
|
</IndexFields> |
93 |
|
</ToIndex> |
94 |
|
<Indexes> |
95 |
|
<Index> |
96 |
|
<Notes>This index allows searching for an attribute value by its prefix.</Notes> |
97 |
|
<IndexFields> |
98 |
|
<IndexField name="value" order="ascending" /> |
99 |
|
</IndexFields> |
100 |
|
</Index> |
101 |
|
<Index> |
102 |
|
<Notes>This index allows searching for values within keys.</Notes> |
103 |
|
<IndexFields> |
104 |
|
<IndexField name="from-link" order="ascending" /> |
105 |
|
<IndexField name="value" order="ascending" /> |
106 |
|
</IndexFields> |
107 |
|
</Index> |
108 |
|
<Index> |
109 |
|
<Notes>This index sorts all the values for a single attribute key by the target object ID.</Notes> |
110 |
|
<IndexFields> |
111 |
|
<IndexField name="from-link" order="ascending" /> |
112 |
|
<IndexField name="to-link" order="ascending" /> |
113 |
|
</IndexFields> |
114 |
|
</Index> |
115 |
|
</Indexes> |
116 |
|
</Relationship> |
117 |
<Relationship name="IsInGroup" from="AttributeKey" to="AttributeGroup" arity="MM"> |
<Relationship name="IsInGroup" from="AttributeKey" to="AttributeGroup" arity="MM"> |
118 |
|
<DisplayInfo theme="seed" caption="Is\nGroup\nOf" /> |
119 |
<Notes>This relationship connects an attribute key to the groups of which it is a member.</Notes> |
<Notes>This relationship connects an attribute key to the groups of which it is a member.</Notes> |
120 |
</Relationship> |
</Relationship> |
121 |
<Relationship name="HasValueFor" from="AttributeKey" to="TargetObject" arity="MM"> |
<Relationship name="HasValueFor" from="AttributeKey" to="TargetObject" arity="MM" converse="HasValueOf"> |
122 |
|
<DisplayInfo theme="seed" col="2.5" row="4" fixed="1" caption="Has\nValue\nFor" /> |
123 |
<Notes>This relationship connects an attribute key to its objects. It contains the |
<Notes>This relationship connects an attribute key to its objects. It contains the |
124 |
attribute values, and is therefore the primary data repository for the database.</Notes> |
attribute values, and is therefore the primary data repository for the database.</Notes> |
125 |
<Fields> |
<Fields> |
140 |
<IndexField name="subkey" order="ascending" /> |
<IndexField name="subkey" order="ascending" /> |
141 |
</IndexFields> |
</IndexFields> |
142 |
</FromIndex> |
</FromIndex> |
143 |
|
<ToIndex> |
144 |
|
<Notes>This index sorts all the values for an object by attribute key and the subkey.</Notes> |
145 |
|
<IndexFields> |
146 |
|
<IndexField name="from-link" order="ascending" /> |
147 |
|
<IndexField name="subkey" order="ascending" /> |
148 |
|
</IndexFields> |
149 |
|
</ToIndex> |
150 |
<Indexes> |
<Indexes> |
151 |
<Index> |
<Index> |
152 |
<Notes>This index allows searching for an attribute value by its prefix.</Notes> |
<Notes>This index allows searching for an attribute value by its prefix.</Notes> |
161 |
<IndexField name="value" order="ascending" /> |
<IndexField name="value" order="ascending" /> |
162 |
</IndexFields> |
</IndexFields> |
163 |
</Index> |
</Index> |
164 |
|
<Index> |
165 |
|
<Notes>This index sorts all the values for a single attribute key by the target object ID.</Notes> |
166 |
|
<IndexFields> |
167 |
|
<IndexField name="from-link" order="ascending" /> |
168 |
|
<IndexField name="to-link" order="ascending" /> |
169 |
|
</IndexFields> |
170 |
|
</Index> |
171 |
</Indexes> |
</Indexes> |
172 |
</Relationship> |
</Relationship> |
173 |
</Relationships> |
</Relationships> |
174 |
|
<Shapes> |
175 |
|
</Shapes> |
176 |
</Database> |
</Database> |