2017 © Pedro Peláez
 

mediawiki-extension semantic-data-import

image

mediawiki/semantic-data-import

  • Thursday, July 12, 2018
  • by toniher
  • Repository
  • 1 Watchers
  • 1 Stars
  • 43 Installations
  • JavaScript
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 1 Open issues
  • 4 Versions
  • 10 % Grown

The README.md

SemanticDataImport

Build Status Code Coverage, (*1)

Extension for importing CSV-like structured data into MediaWiki pages using Semantic MediaWiki., (*2)

It basically turns CSV rows into Semantic Subobjects., (*3)

Basic Usage

Content can be saved straight into wikitext pages (only option for older wikis) or also as pure JSON pages (only via SpecialPage interface Special:SDImport)., (*4)

Namespace configuration

At the time of writting, mappings of CSV columns against Semantic MediaWiki properties can only be done by configuring (custom or not) namespaces in LocalSettings.php., (*5)

    # 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;

SDImport interface

There is a preliminary SDImport Special Page (Special:SDImport) that simplifies uploading content (especially for JSON pages), (*6)

Properties need to be defined in namespace configuration., (*7)

At the time of writing:, (*8)

  • First column: Page name (in selected namespace)
  • Rest of the columns, according to rowfields values...

JSON schema

Keys defined in JSON schema have precedence in front of what is defined in namespace configuration., (*9)

    {
        "meta": {
            "app": "SDI",
            "version": 0.1,
            "rowobject": "Entry",
            "rowfields": ["Relation1", "Relation2"]
        },
        "data": [
            [
                "2",
                "4"
            ],
            [
                "2",
                "5"
            ]
        ]
    }

Useful extensions

If we enable $GLOBALS["wgSDImportDataPage"][NS_SDImport]["edit"] = true; in LocalSettings.php we allow content to be modified by a spreadsheet-like interface., (*10)

However we might be interested to edit in another way. For this we recommend to install 2 extensions:, (*11)

$wgDefaultUserOptions['usebetatoolbar'] = 1; // user option provided by WikiEditor extension, (*12)

The Versions

12/07 2018

dev-master

9999999-dev https://github.com/toniher/SemanticDataImport

  Sources   Download

GPL-3.0+ GPL-3.0-or-later

The Requires

 

by Toni Hermoso Pulido

csv mediawiki smw semantic mediawiki tsv

06/07 2018

dev-linkmode

dev-linkmode https://github.com/toniher/SemanticDataImport

  Sources   Download

GPL-3.0-or-later

The Requires

 

by Toni Hermoso Pulido

csv mediawiki smw semantic mediawiki tsv

15/04 2018

dev-ooui

dev-ooui https://github.com/toniher/SemanticDataImport

  Sources   Download

GPL-3.0-or-later

The Requires

 

by Toni Hermoso Pulido

csv mediawiki smw semantic mediawiki tsv

17/03 2018

0.2.0

0.2.0.0 https://github.com/toniher/SemanticDataImport

  Sources   Download

GPL-3.0-or-later

The Requires

 

by Toni Hermoso Pulido

csv mediawiki smw semantic mediawiki tsv