User:RichMorin/smw attributes

From Meta, a Wikimedia project coordination wiki

Stores attribute information concerning pages.


Inter-table Relationships[edit]

  • subject - page title ( page.page_title)
  • subjectns - page namespace ( page.page_namespace)


MySQL Table Description[edit]

mysql> desc sem_smw_attributes;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| subjectns | smallint(6) |      |     | 0       |       |
| subject   | text        |      |     |         |       |
| attribute | text        |      |     |         |       |
| unit      | text        | YES  |     | NULL    |       |
| datatype  | text        |      |     |         |       |
| value     | text        |      |     |         |       |
+-----------+-------------+------+-----+---------+-------+
6 rows in set


Annotated Table Creation Code[edit]

-- Stores attribute information concerning pages.

CREATE TABLE sem_smw_attributes (

  -- name space and name of RDF subject

  subjectns           smallint                    NOT NULL,
  subject             text                        NOT NULL,

  -- name of attribute

  attribute           text                        NOT NULL,

  -- name of attribute unit, if any

  unit                text,

  -- data type of attribute, given as a language-independent internal id string

  datatype            text                        NOT NULL,

  -- value of attribute (as text, typically in XSD-conformant format)

  value               text                        NOT NULL

) TYPE = MyISAM;