Difference between revisions of "Semantic MediaWiki/data/smw text2"

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
m (moved smw text2 to Semantic MediaWiki/data/smw text2: forgot to prefix with /)
(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 is long text or data of some kind (no SMW ID)
 +
* '''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_blob''': the value to which the property has been set for this page
 
==SQL==
 
==SQL==
 
<mysql>CREATE TABLE `smw_text2` (
 
<mysql>CREATE TABLE `smw_text2` (
Line 9: Line 15:
 
   KEY `p_id` (`p_id`)
 
   KEY `p_id` (`p_id`)
 
) 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(t.value_blob AS char) AS t_value
 +
  FROM
 +
    (smw_text2 AS t
 +
    LEFT JOIN smw_ids AS s ON t.s_id=s.smw_id)
 +
    LEFT JOIN smw_ids AS p ON t.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 is long text or data of some kind (no SMW ID)
  • 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_blob: the value to which the property has been set for this page

SQL

<mysql>CREATE TABLE `smw_text2` (

 `s_id` int(8) unsigned NOT NULL,
 `p_id` int(8) unsigned NOT NULL,
 `value_blob` mediumblob,
 KEY `s_id` (`s_id`),
 KEY `p_id` (`p_id`)

) 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(t.value_blob AS char) AS t_value
 FROM
   (smw_text2 AS t
   LEFT JOIN smw_ids AS s ON t.s_id=s.smw_id)
   LEFT JOIN smw_ids AS p ON t.p_id=p.smw_id;

</mysql>