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

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== * '''Purpose''': specifications for all SMW Objects that point to wiki pages (existing or not) * '''Refers to''': {{l/same|smw_object_ids}} ==SQL== <mysql> delimiter...")
 
m (updated syntax highlight tags)
Line 3: Line 3:
 
* '''Refers to''': {{l/same|smw_object_ids}}
 
* '''Refers to''': {{l/same|smw_object_ids}}
 
==SQL==
 
==SQL==
<mysql>
+
<syntaxhighlight lang=mysql>
delimiter $$
 
 
 
 
CREATE TABLE `smw_di_wikipage` (
 
CREATE TABLE `smw_di_wikipage` (
 
   `s_id` int(8) unsigned NOT NULL,
 
   `s_id` int(8) unsigned NOT NULL,
Line 13: Line 11:
 
   KEY `p_id` (`p_id`,`o_id`),
 
   KEY `p_id` (`p_id`,`o_id`),
 
   KEY `o_id` (`o_id`)
 
   KEY `o_id` (`o_id`)
) ENGINE=InnoDB DEFAULT CHARSET=binary$$
+
) ENGINE=InnoDB DEFAULT CHARSET=binary
</mysql>
+
</syntaxhighlight>
 
===Example===
 
===Example===
<mysql>
+
<syntaxhighlight lang=mysql>
 
SELECT s_id
 
SELECT s_id
 
   , s.smw_namespace AS s_namespace
 
   , s.smw_namespace AS s_namespace
Line 30: Line 28:
 
     LEFT JOIN smw_object_ids AS o ON r.o_id=o.smw_id
 
     LEFT JOIN smw_object_ids AS o ON r.o_id=o.smw_id
 
ORDER BY s_id,p_title, o_title
 
ORDER BY s_id,p_title, o_title
</mysql>
+
</syntaxhighlight>
 
* p_namespace will probably always be the "property:" namespace, which defaults to 102 (unless there's some way to use a page outside that namespace as a property)
 
* p_namespace will probably always be the "property:" namespace, which defaults to 102 (unless there's some way to use a page outside that namespace as a property)

Revision as of 12:51, 26 January 2018

About

  • Purpose: specifications for all SMW Objects that point to wiki pages (existing or not)
  • Refers to: smw_object_ids

SQL

CREATE TABLE `smw_di_wikipage` (
  `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`,`p_id`),
  KEY `p_id` (`p_id`,`o_id`),
  KEY `o_id` (`o_id`)
) ENGINE=InnoDB DEFAULT CHARSET=binary

Example

SELECT s_id
  , s.smw_namespace AS s_namespace
  , CAST(s.smw_title AS char) AS s_title
  , p.smw_namespace AS p_namespace
  , CAST(p.smw_title AS char) AS p_title
  , o.smw_namespace AS o_namespace
  , CAST(o.smw_title AS char) AS o_title
  FROM
    ((smw_di_wikipage AS r
    LEFT JOIN smw_object_ids AS s ON r.s_id=s.smw_id)
    LEFT JOIN smw_object_ids AS p ON r.p_id=p.smw_id)
    LEFT JOIN smw_object_ids AS o ON r.o_id=o.smw_id
ORDER BY s_id,p_title, o_title
  • p_namespace will probably always be the "property:" namespace, which defaults to 102 (unless there's some way to use a page outside that namespace as a property)