Semantic MediaWiki/data/smw rels2: Difference between revisions
from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
m moved smw rels2 to Semantic MediaWiki/data/smw rels2: forgot to prefix with / |
documentation reconstructed from previously-written code |
||
| 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 values have an SMW ID | |||
* '''Foreign keys''': {{l/same|smw_ids}}.smw_id | |||
* '''Fields''': | |||
** '''s_id''': [[../smw_ids|SMW ID]] of a page on which the property name-value pair is defined | |||
** '''p_id''': [[../smw_ids|SMW ID]] of the property name | |||
** '''o_id''': [[../smw_ids|SMW ID]] of the property value | |||
==SQL== | ==SQL== | ||
<mysql>CREATE TABLE `smw_rels2` ( | <mysql>CREATE TABLE `smw_rels2` ( | ||
| Line 10: | Line 17: | ||
KEY `o_id` (`o_id`) | KEY `o_id` (`o_id`) | ||
) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql> | ) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql> | ||
===Examples=== | |||
<mysql> | |||
SELECT s_id | |||
, s.smw_namespace AS s_namespace | |||
, CAST(s.smw_title AS char) AS s_title | |||
, CAST(p.smw_title AS char) AS p_title | |||
, CAST(o.smw_title AS char) AS o_title | |||
FROM | |||
((smw_rels2 AS r | |||
LEFT JOIN smw_ids AS s ON r.s_id=s.smw_id) | |||
LEFT JOIN smw_ids AS p ON r.p_id=p.smw_id) | |||
LEFT JOIN smw_ids AS o ON r.o_id=o.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 values have an SMW ID
- Foreign keys: smw_ids.smw_id
- Fields:
SQL
<mysql>CREATE TABLE `smw_rels2` (
`s_id` int(8) unsigned NOT NULL, `p_id` int(8) unsigned NOT NULL, `o_id` int(8) unsigned DEFAULT NULL, KEY `s_id` (`s_id`), KEY `p_id` (`p_id`), KEY `o_id` (`o_id`)
) ENGINE=InnoDB DEFAULT CHARSET=binary;</mysql>
Examples
<mysql> SELECT s_id
, s.smw_namespace AS s_namespace , CAST(s.smw_title AS char) AS s_title , CAST(p.smw_title AS char) AS p_title , CAST(o.smw_title AS char) AS o_title FROM ((smw_rels2 AS r LEFT JOIN smw_ids AS s ON r.s_id=s.smw_id) LEFT JOIN smw_ids AS p ON r.p_id=p.smw_id) LEFT JOIN smw_ids AS o ON r.o_id=o.smw_id;
</mysql>
