As an anonymous user, you can only add new data. If you would like to also modify existing data, please create an account and indicate your languages on your user page.

Help:Class Membership table

From OmegaWiki
Jump to: navigation, search
Help:Index Database layout Class Membership table



The Class Membership table defines which defined meaning (or concept) is a member of which class. This member can then be annotated with class attributes (cf. Class Attributes table). To understand what are classes and class attributes, have a look at Help:Class.

+-----------------------+---------+------+-----+---------+-------+
| Field                 | Type    | Null | Key | Default | Extra |
+-----------------------+---------+------+-----+---------+-------+
| class_membership_id   | int(11) | NO   |     | NULL    |       | 
| class_mid             | int(11) | NO   |     | 0       |       | 
| class_member_mid      | int(11) | NO   |     | 0       |       | 
| add_transaction_id    | int(11) | NO   | MUL | NULL    |       | 
| remove_transaction_id | int(11) | YES  | MUL | NULL    |       | 
+-----------------------+---------+------+-----+---------+-------+

Fields[edit]

class_membership_id 
An id that identifies this entry in the table.
class_mid 
A link to a defined_meaning_id in the Defined Meaning table that identifies the class (e.g. "animal").
class_member_mid 
A link to a defined_meaning_id in the Defined Meaning table that identifies the member of the class (e.g. "dog").
add_transaction_id 
Indicates when and by who the syntrans was added. See Transactions table.
remove_transaction_id 
Indicates when and by who the syntrans was removed. NULL if the syntrans is still valid.

Sample MySQL queries[edit]

The set of classes is a particular collection. Therefore, to know which class exist, you have to query the Collection table and the Collection Contents table, as shown below:

For DefinedMeaning:Community_Database_class_(725301), we have collection_mid = 725301.

select member_mid

from uw_collection, uw_collection_contents
where collection_mid = 725301
and uw_collection.collection_id = uw_collection_contents.collection_id
and uw_collection.remove_transaction_id IS NULL
and uw_collection_contents.remove_transaction_id IS NULL ;

gives a list of the defined_meaning_id of all existing classes.
+------------+
| member_mid |
+------------+
|        194 | <= http://www.omegawiki.org/DefinedMeaning:(194) - animal
...