} // Reify the model if checked in submitted form if (isset($_POST['reify']) and $_POST['reify'] == "1") { $model =& $model->reify(); echo "<BR><BR><h3>Your original model has been refied.</h3><BR>"; } // Output Triples as Table if checked in submitted form if ($_POST['view_triple'] == "1") { echo "<BR><BR><h3>View input as HTML table:</h3><BR>"; RDFUtil::writeHTMLTable($model); echo "<P>"; } //serialize model to RDF with default configuration if checked in submitted form if ($_POST['serialize'] == '1') { // Create Serializer $ser = new RDFSerializer(); $msg_string = ''; if (isset($_POST['serial_attributes']) and $_POST['serial_attributes'] == '1') { $ser->configUseAttributes(TRUE); $msg_string .= 'Use Attributes '; } if (isset($_POST['serial_entities']) and $_POST['serial_entities'] == '1') { $ser->configUseEntities(TRUE); $msg_string .= 'Use XML Entities '; } if (isset($_POST['serial_wo_qnames']) and $_POST['serial_wo_qnames'] == '1') { $ser->configUseQnames(FALSE); $msg_string .= 'Without Qnames '; } $rdf =& $ser->serialize($model); echo "<p><BR><h3>Serialization of input model";
function MwRdfOutputXml($model) { global $wgOut, $_SERVER, $wgRdfNamespaces; $rdftype = wfNegotiateType(wfAcceptToPrefs($_SERVER['HTTP_ACCEPT']), wfAcceptToPrefs(MWRDF_XML_TYPE_PREFS)); if (!$rdftype) { wfHttpError(406, "Not Acceptable", wfMsg("notacceptable")); return false; } else { $wgOut->disable(); header("Content-type: {$rdftype}; charset=utf-8"); $wgOut->sendCacheControl(); # Make sure serializer is loaded require_once RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF; $ser = new RDFSerializer(); $ser->configSortModel(true); $ser->configUseAttributes(false); $ser->configUseEntities(false); foreach ($wgRdfNamespaces as $key => $value) { $ser->addNamespacePrefix($key, $value); } print $ser->serialize($model); return true; } }