Semantic MediaWiki/data/smw di *: Difference between revisions
from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
made some-tables fields list into a table |
No edit summary |
||
| 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 34: | Line 34: | ||
| '''o_id''' || - || - || - || - || - || - || wikipage || ID of page that is the property's value | | '''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
