Difference between revisions of "Semantic MediaWiki/data/smw atts2"
< Semantic MediaWiki | data
Jump to navigation
Jump to search
(Created page with "==About== * ''Version''': 1.7 ==SQL== <mysql>CREATE TABLE `smw_atts2` ( `s_id` int(8) unsigned NOT NULL, `p_id` int(8) unsigned NOT NULL, `value_xsd` varbinary(255) DEFA...") |
(documentation reconstructed from previously-written code) |
||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==About== | ==About== | ||
− | * ''Version''': 1.7 | + | * '''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_ids|SMW ID]] of ''source page'' (page where property is being set) | ||
+ | ** '''p_id''': [[../smw_ids|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== | ==SQL== | ||
<mysql>CREATE TABLE `smw_atts2` ( | <mysql>CREATE TABLE `smw_atts2` ( | ||
Line 12: | Line 24: | ||
KEY `value_xsd` (`value_xsd`) | KEY `value_xsd` (`value_xsd`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql> | ) 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> |
Latest revision as of 15:53, 17 December 2012
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:
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>