Difference between revisions of "Semantic MediaWiki/data/smw di *"
< Semantic MediaWiki | data
Jump to navigation
Jump to search
(Created page with "==About== Each of these tables contains property values for properties of a particular type. The following fields appear in all tables: * '''s_id''': ID of page on which the...") |
|||
(One intermediate revision by the same user not shown) | |||
Line 1: | Line 1: | ||
==About== | ==About== | ||
− | Each of these tables contains property values for properties of a particular type. | + | Each of these tables contains property values for properties of a particular type. These tables work closely with the {{l/same|smw_object_ids}} table, and are often stacked together with a UNION. |
− | + | ==Fields== | |
The following fields appear in all tables: | The following fields appear in all tables: | ||
* '''s_id''': ID of page on which the property appears | * '''s_id''': ID of page on which the property appears | ||
Line 7: | Line 7: | ||
The following fields appear only in some tables: | The following fields appear only in some tables: | ||
− | + | {| | |
− | + | |- | |
− | + | ! name↓ / table→ | |
− | + | ! [[../smw_di_blob|blob]] | |
− | + | ! [[../smw_di_bool|bool]] | |
− | + | ! [[../smw_di_coords|coords]] | |
− | + | ! [[../smw_di_number|number]] | |
− | + | ! [[../smw_di_time|time]] | |
+ | ! [[../smw_di_uri|URI]] | ||
+ | ! [[../smw_di_wikipage|wikipage]] | ||
+ | |- | ||
+ | | '''o_blob''' || blob || - || - || - || - || URI | ||
+ | |- | ||
+ | | '''o_hash''' || blob | ||
+ | |- | ||
+ | | '''o_value''' || - || bool | ||
+ | |- | ||
+ | | '''o_serialized''' || - || - || coords || number || time || URI | ||
+ | |- | ||
+ | | '''o_lat''' || - || - || coords | ||
+ | |- | ||
+ | | '''o_lon''' || - || - || coords | ||
+ | |- | ||
+ | | '''o_sortkey''' || - || - || - || number || time | ||
+ | |- | ||
+ | | '''o_id''' || - || - || - || - || - || - || wikipage || ID of page that is the property's value | ||
+ | |} | ||
+ | ==SQL== | ||
+ | This generates a result which combines all types, giving as much useful information as possible about each value: | ||
+ | <source lang=mysql> | ||
+ | SELECT | ||
+ | s_id, p_id, 'blob' AS fType, CAST(o_hash AS CHAR) AS val FROM smw_di_blob | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'time' AS fType, CAST(o_serialized AS CHAR) as val FROM smw_di_time | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'wikiPage' AS fType, CAST(o_id AS CHAR) AS val FROM smw_di_wikipage | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'bool' AS fType, CAST(o_value AS CHAR) AS val FROM smw_di_bool | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'coords' AS fType, CAST(o_serialized AS CHAR) AS val FROM smw_di_coords | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'number' AS fType, CAST(o_serialized AS CHAR) AS val FROM smw_di_number | ||
+ | UNION SELECT | ||
+ | s_id, p_id, 'uri' AS fType, CAST(o_blob AS CHAR) AS val FROM smw_di_uri | ||
+ | </source> |
Latest revision as of 23:34, 10 July 2020
About
Each of these tables contains property values for properties of a particular type. These tables work closely with the smw_object_ids table, and are often stacked together with a UNION.
Fields
The following fields appear in all tables:
- s_id: ID of page on which the property appears
- p_id: ID of page for property name
The following fields appear only in some tables:
name↓ / table→ | blob | bool | coords | number | time | URI | wikipage | |
---|---|---|---|---|---|---|---|---|
o_blob | blob | - | - | - | - | URI | ||
o_hash | blob | |||||||
o_value | - | bool | ||||||
o_serialized | - | - | coords | number | time | URI | ||
o_lat | - | - | coords | |||||
o_lon | - | - | coords | |||||
o_sortkey | - | - | - | number | time | |||
o_id | - | - | - | - | - | - | wikipage | ID of page that is the property's value |
SQL
This generates a result which combines all types, giving as much useful information as possible about each value:
SELECT
s_id, p_id, 'blob' AS fType, CAST(o_hash AS CHAR) AS val FROM smw_di_blob
UNION SELECT
s_id, p_id, 'time' AS fType, CAST(o_serialized AS CHAR) as val FROM smw_di_time
UNION SELECT
s_id, p_id, 'wikiPage' AS fType, CAST(o_id AS CHAR) AS val FROM smw_di_wikipage
UNION SELECT
s_id, p_id, 'bool' AS fType, CAST(o_value AS CHAR) AS val FROM smw_di_bool
UNION SELECT
s_id, p_id, 'coords' AS fType, CAST(o_serialized AS CHAR) AS val FROM smw_di_coords
UNION SELECT
s_id, p_id, 'number' AS fType, CAST(o_serialized AS CHAR) AS val FROM smw_di_number
UNION SELECT
s_id, p_id, 'uri' AS fType, CAST(o_blob AS CHAR) AS val FROM smw_di_uri