Semantic MediaWiki/data/smw spec2: Difference between revisions

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Created page with "==About== * '''Version''': 1.7 ==SQL== <mysql>CREATE TABLE `smw_spec2` ( `s_id` int(8) unsigned NOT NULL, `p_id` int(8) unsigned NOT NULL, `value_string` varbinary(255) ..."
 
a small advance in understanding
 
(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''': URLs for <abbr title="Semantic Wiki Vocabulary and Terminology" href="http://semantic-mediawiki.org/swivt/">SWiVT</abbr> definitions of built-in types
** Currently, all URLs are like "http://semantic-mediawiki.org/swivt/1.0#_''X''", where ''X'' is "str", "txt", "dat", or "cod"
==SQL==
==SQL==
<mysql>CREATE TABLE `smw_spec2` (
<mysql>CREATE TABLE `smw_spec2` (
Line 10: Line 13:
   KEY `s_id_2` (`s_id`,`p_id`)
   KEY `s_id_2` (`s_id`,`p_id`)
) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql>
) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql>
==Example==
<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(value_string AS char) AS value
  FROM
    (smw_spec2 AS c
    LEFT JOIN smw_ids AS s ON c.s_id=s.smw_id)
    LEFT JOIN smw_ids AS p ON c.p_id=p.smw_id;
</mysql>

Latest revision as of 16:18, 17 December 2012

About

  • Version: 1.7
  • Documentation status: unofficial; confirmed only by testing
  • Purpose: URLs for SWiVT definitions of built-in types

SQL

<mysql>CREATE TABLE `smw_spec2` (

 `s_id` int(8) unsigned NOT NULL,
 `p_id` int(8) unsigned NOT NULL,
 `value_string` varbinary(255) DEFAULT NULL,
 KEY `s_id` (`s_id`),
 KEY `p_id` (`p_id`),
 KEY `s_id_2` (`s_id`,`p_id`)

) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql>

Example

<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(value_string AS char) AS value
 FROM
   (smw_spec2 AS c
   LEFT JOIN smw_ids AS s ON c.s_id=s.smw_id)
   LEFT JOIN smw_ids AS p ON c.p_id=p.smw_id;

</mysql>