User:RichMorin/smw relations

From Meta, a Wikimedia project coordination wiki
Jump to: navigation, search

Store relations between pages, etc.


Inter-table Relationships[edit]

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


MySQL Table Description[edit]

mysql> desc sem_smw_relations;
+-----------+-------------+------+-----+---------+-------+
| Field     | Type        | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| subjectns | smallint(6) |      |     | 0       |       |
| subject   | text        |      |     |         |       |
| relation  | text        |      |     |         |       |
| objectns  | smallint(6) |      |     | 0       |       |
| object    | text        |      |     |         |       |
+-----------+-------------+------+-----+---------+-------+
5 rows in set


Annotated Table Creation Code[edit]

-- Store relations between pages, etc.

CREATE TABLE sem_smw_relations (

  -- name space and name of RDF subject

  subjectns           smallint                    NOT NULL,
  subject             text                        NOT NULL,

  -- RDF "predicate"

  relation            text                        NOT NULL,

  -- name space and name of RDF object

  objectns            smallint                    NOT NULL,
  object              text                        NOT NULL

) TYPE = MyISAM;