Difference between revisions of "Semantic MediaWiki/data/smw di *"

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
(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:
* '''o_blob''': {{l/same|smw_di_blob}}, {{l/same|smw_di_uri}}
+
{|
* '''o_hash''': {{l/same|smw_di_blob}}
+
|-
* '''o_value''': {{l/same|smw_di_bool}}
+
! name↓ / table→
* '''o_serialized''': {{l/same|smw_di_coords}}, {{l/same|smw_di_number}}, {{l/same|smw_di_time}}, {{l/same|smw_di_uri}}
+
! [[../smw_di_blob|blob]]
* '''o_lat''': {{l/same|smw_di_coords}}
+
! [[../smw_di_bool|bool]]
* '''o_lon''': {{l/same|smw_di_coords}}
+
! [[../smw_di_coords|coords]]
* '''o_sortkey''': {{l/same|smw_di_number}}, {{l/same|smw_di_time}}
+
! [[../smw_di_number|number]]
* '''o_id''': {{l/same|smw_di_wikipage}} - ID of page that is the property's value
+
! [[../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