コード例 #1
0
 static function createRDF($title, $rdfDataArray, $fullexport = true, $backlinks = false)
 {
     // if it's not a full export, don't add internal object data
     if (!$fullexport) {
         return true;
     }
     $pageName = $title->getDBkey();
     $namespace = $title->getNamespace();
     // Go through all SIOs for the current page, create RDF for
     // each one, and add it to the general array.
     $iw = '';
     $db = wfGetDB(DB_SLAVE);
     $res = $db->select('smw_ids', array('smw_id', 'smw_namespace', 'smw_title'), 'smw_title LIKE ' . $db->addQuotes($pageName . '#%') . ' AND ' . 'smw_namespace=' . $db->addQuotes($namespace) . ' AND smw_iw=' . $db->addQuotes($iw), 'SIO::getSMWPageObjectIDs');
     while ($row = $db->fetchObject($res)) {
         $value = new SIOInternalObjectValue($row->smw_title, intval($row->smw_namespace));
         if (class_exists('SMWSqlStubSemanticData')) {
             // SMW >= 1.6
             $semdata = new SMWSqlStubSemanticData($value, false);
         } else {
             $semdata = new SMWSemanticData($value, false);
         }
         $propertyTables = SMWSQLStore2::getPropertyTables();
         foreach ($propertyTables as $tableName => $propertyTable) {
             $data = smwfGetStore()->fetchSemanticData($row->smw_id, null, $propertyTable);
             foreach ($data as $d) {
                 $semdata->addPropertyStubValue(reset($d), end($d));
             }
         }
         $rdfDataArray[] = SMWExporter::makeExportData($semdata, null);
     }
     return true;
 }