Semantic MediaWiki/data/smw atts2

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to: navigation, search

About

  • Version: 1.7
  • Documentation status: unofficial; confirmed only by testing
  • Purpose: defines semantic relationships between property-names and property-values, where
    • the value-type has some numeric or logical significance, or
    • the value-type is a non-page string type, or
    • the property is a special property type:
      • _MDAT: seems to be the last-modified timestamp of the page
      • _dat: seems to refer to any property named "date", or possibly any property with "date" type
  • Fields:
    • s_id: SMW ID of source page (page where property is being set)
    • p_id: SMW ID of property (name of property being used)
    • value_xsd: value in string format
    • value_num: value in numeric format (non-numeric strings seem to evaluate to 0)

SQL

<mysql>CREATE TABLE `smw_atts2` (

 `s_id` int(8) unsigned NOT NULL,
 `p_id` int(8) unsigned NOT NULL,
 `value_xsd` varbinary(255) DEFAULT NULL,
 `value_num` double DEFAULT NULL,
 KEY `s_id` (`s_id`),
 KEY `p_id` (`p_id`),
 KEY `value_num` (`value_num`),
 KEY `value_xsd` (`value_xsd`)

) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql>

Examples

<mysql> SELECT s_id, p_id

 , CAST(s.smw_title AS char) AS s_title
 , CAST(p.smw_title AS char) AS p_title
 , CAST(a.value_num AS char) AS a_num
 , CAST(a.value_xsd AS char) AS a_xsd
 FROM
   (smw_atts2 AS a
   LEFT JOIN smw_ids AS s ON a.s_id=s.smw_id)
   LEFT JOIN smw_ids AS p ON a.p_id=p.smw_id;

</mysql>