Difference between revisions of "Semantic MediaWiki/data/smw object ids"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(fixed syntax tag; better example)
(updated highlight tags; latest schema)
Line 1: Line 1:
 
==About==
 
==About==
* '''Purpose''': registry of all SMW object IDs; apparently replaces {{l/same|smw_ids}} in schema version 2 but adds <code>smw_proptable_hash</code> field.
+
* '''Purpose''': registry of all SMW object IDs; apparently replaces {{l/same|smw_ids}} in schema version 2 but adds <code>smw_proptable_hash</code> field. A <code>smw_iw</code> field was added sometime between SMW versions v1.9 and 2.5.5.
 
==SQL==
 
==SQL==
 
<syntaxhighlight lang=mysql>
 
<syntaxhighlight lang=mysql>
Line 14: Line 14:
 
   KEY `smw_id` (`smw_id`,`smw_sortkey`),
 
   KEY `smw_id` (`smw_id`,`smw_sortkey`),
 
   KEY `smw_title` (`smw_title`,`smw_namespace`,`smw_iw`,`smw_subobject`),
 
   KEY `smw_title` (`smw_title`,`smw_namespace`,`smw_iw`,`smw_subobject`),
   KEY `smw_sortkey` (`smw_sortkey`)
+
   KEY `smw_sortkey` (`smw_sortkey`),
) ENGINE=InnoDB AUTO_INCREMENT=4599 DEFAULT CHARSET=binary$$
+
  KEY `smw_iw` (`smw_iw`)
 +
) ENGINE=InnoDB CHARSET=binary;
 
</syntaxhighlight>
 
</syntaxhighlight>
 
===Example===
 
===Example===

Revision as of 13:03, 26 January 2018

About

  • Purpose: registry of all SMW object IDs; apparently replaces smw_ids in schema version 2 but adds smw_proptable_hash field. A smw_iw field was added sometime between SMW versions v1.9 and 2.5.5.

SQL

CREATE TABLE `smw_object_ids` (
  `smw_id` int(8) unsigned NOT NULL AUTO_INCREMENT,
  `smw_namespace` int(11) NOT NULL,
  `smw_title` varbinary(255) NOT NULL,
  `smw_iw` varbinary(32) NOT NULL,
  `smw_subobject` varbinary(255) NOT NULL,
  `smw_sortkey` varbinary(255) NOT NULL,
  `smw_proptable_hash` mediumblob,
  PRIMARY KEY (`smw_id`),
  KEY `smw_id` (`smw_id`,`smw_sortkey`),
  KEY `smw_title` (`smw_title`,`smw_namespace`,`smw_iw`,`smw_subobject`),
  KEY `smw_sortkey` (`smw_sortkey`),
  KEY `smw_iw` (`smw_iw`)
) ENGINE=InnoDB CHARSET=binary;

Example

SELECT 
    smw_id,
    smw_namespace,
    CAST(smw_title AS CHAR) AS title,
    CAST(smw_iw AS CHAR) AS iw,
    CAST(smw_subobject AS CHAR) AS sub,
    CAST(smw_sortkey AS CHAR) AS sortkey,
    CAST(smw_proptable_hash AS CHAR) AS pthash
FROM
    smw_object_ids;