PHP code example of mediawiki / semantic-data-import
1. Go to this page and download the library: Download mediawiki/semantic-data-import library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mediawiki / semantic-data-import example snippets
# Example NS definition
define("NS_SDImport", 2000);
$GLOBALS["wgSDImportDataPage"][NS_SDImport] = array();
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["edit"] = false;
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["separator"] = "\t";
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["delimiter"] = '"';
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["rowobject"] = "SDImport";
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["rowfields"] = array("Page1", "Page2");
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["typefields"] = array("Page", "Page");
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["ref"] = array("ref" => "{{PAGENAME}}");
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["prefields"] = array( "", "" );
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["postfields"] = array( "", "" );
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["json"] = true; # Whether content is stored directly in JSON
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["single"] = false; #Whether to store straight properties-values, but not Subobject (rowobject is ignored)
$GLOBALS["wgSDImportDataPage"][NS_SDImport]["form"] = false; #Whether to show a form instead of a spreadsheet (as far as single is true)
$wgExtraNamespaces[NS_SDImport] = "SDImport";
$GLOBALS['smwgNamespacesWithSemanticLinks'][NS_SDImport] = true;