Extension:RDFIO

From mediawiki.org
MediaWiki extensions manual
RDFIO
Release status: stable
Description Provides extended RDF import and export capabilities in Semantic MediaWiki , including a fully PHP-based SPARQL Endpoint
Author(s) Samuel Lampa, Ali King, Denny Vrandečić, Seb35
Latest version 3.0.2 (2022-10-04)
MediaWiki 1.29+
Database changes No
License GNU General Public License 2.0
Download

Notable Updates[edit]

Sep 7, 2017: New ready-made Virtual Machine available[edit]

A new virtual machine was just created, with the latest RDFIO 3.0.2, installed on MediaWiki 1.29 and Semantic MediaWiki 2.5. You can download it from figshare here. See also the relevant section in the installation instructions for how to import and use it.

Sep 4, 2017: Paper on RDFIO published[edit]

A paper on RDFIO was just published in Journal of Biomedical Semantics, titled RDFIO: extending Semantic MediaWiki for interoperable biomedical data management. It is open access, and contains a thorough overview of the motivations behind, and the technical architecture of the extension, that might be useful for anyone looking to make advanced use of it.

Aug 18, 2017: RDFIO 3.0.1 & 3.0.2[edit]

RDFIO 3.0.2 (and partially in RDFIO 3.0.1) contains a fix to set correct Content-type header for SPARQL results, so that the SPARQL endpoint can be used from external tools (verified using the SWI-Prolog SPARQL client as seen in the screenshot on the release page).

Aug 16, 2017: RDFIO 3.0.0[edit]

RDFIO 3.0.0 was just released, with improved permission settings, localisation, and RDF format support. See the release notes for more info!

Note in particular the new permission levels:

  • New permission levels: rdfio-admin, rdfio-import, rdfio-sparql
  • New user groups: rdfioadministrator, rdfiocurator (similar to the smwadministrator and smwcurator).
    • rdfioadministrator gets all permissions (rdfio-admin, rdfio-import, rdfio-sparql)
    • rdfiocurator gets content editing permissions (rdfio-import, rdfio-sparql)

See Manual:User rights for more info on how to set these permissions in your LocalSettings.php file!

Note that we changed the name of the config parameters once more, back to use the rdfiog prefix, for future-proof clarity and consistency (smw uses smwg etc). The changes that have happened are:

$rdfiogPropertiesToUseAsWikiTitle --> $rogTitleProperties --> $rdfiogTitleProperties
$rdfiogQueryByEquivURI            --> $rogQueryByEquivURI --> $rdfiogQueryByEquivURI
$rdfiogOutputEquivURIs            --> $rogOutputEquivURIs --> $rdfiogOutputEquivURIs
$rdfiogAllowRemoteEdit            --> $rogAllowRemoteEdit --> $rdfiogAllowRemoteEdit
$rdfiogBaseURIs                   --> $rogBaseURIs        --> $rdfiogBaseURIs

Thus, if you have set any of these parameters, you need to use the version in the rightmost column above, and update to that in your LocalSettings.php.

Aug 9, 2017: RDFIO 2.4.0 with SMW 2.5 support[edit]

With RDFIO 2.4.0, we now finally support the latest stable Semantic MediaWiki release, 2.5.

Update 8 August, 2017: RDFIO 2.3.0 with blank node support[edit]

With RDFIO 2.3.0, we now finally support blank RDF nodes in import data.

Introduction[edit]

This extension extends the RDF import and export functionality in Semantic MediaWiki by providing import of arbitrary RDF triples (not only OWL ontologies, as was the case before) and a SPARQL endpoint that allows write operations.

Technically, RDFIO implements the PHP/MySQL based triple store and accompanying SPARQL Endpoint provided by the ARC2 library.

The RDF import stores the original URI of all imported RDF entities in the Equivalent URI property, which can later be used by the SPARQL endpoint, instead of SMW's internal URIs, which thus allows to expose the imported RDF data "in its original formats", with its original URIs. This allows to use SMW as a collaborative RDF editor, in workflows together with other semantic tools, from which it is then possible to "export, collaboratively edit, and import again", to/from SMW.

This extensions was developed as part of a GSoC 2010 project, and later further extended as part of a Extension:RDFIO/Template_matching_for_RDFIO FOSS OPW 2014 project.

Installation[edit]

Easiest: Use the ready-made Virtual Machine[edit]

The absolute easiest way to try out RDFIO is to import the Ready-made Virtual Machine with RDFIO 3.0.2 (with MW 1.29 and SMW 2.5) into VirtualBox or VMWare, and just start browsing the local wiki installation.

Steps:

  1. Download the .ova file from doi.org/10.6084/m9.figshare.5383966
  2. In VirtualBox (should be similar in VMWare), select "File > Import appliance"
  3. Click the folder icon
  4. Locate the .ova file you downloaded
  5. Click "Next", "Agree" to the license, and finally "Import", to start the import
  6. Start the virtual machine
  7. Click log in (No password required)
  8. Click the icon on the desktop
  9. You will now see a local wiki installation with an RDFIO enabled wiki, in a browser!
  10. Enjoy!

Esay: Vagrant box[edit]

The absolutely simplest way, is to use the RDFIO Vagrant box, which will automatically set up MediaWiki, SemanticMediaWiki and RDFIO in a virtual machine in under 20 minutes.

Medium-Hard: Install semi-manually using composer[edit]

Dependencies[edit]

$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;

Installation steps[edit]

Assuming you have followed the steps above to install the dependencies for RDFIO:

  • Install RDFIO by executing the following commands in a terminal:

cd wiki_folder composer require rdfio/rdfio --update-no-dev

  • Log in to your wiki as a super user
  • Browse to http://[your-domain]/wiki/Special:RDFIOAdmin
  • Click the "Setup" button to set up ARC2 database tables.
  • If you already have semantic annotations in your wiki, you need to go to the article "Special:SMWAdmin" in your wiki, and click "Start updating data", and let it complete, in order for the data to be available in the SPARQL endpoint.

Optional but recommended steps[edit]

  • Edit the MediaWiki:Sidebar page and add the following wiki snippet, as an extra menu (I use to place it before just the "* SEARCH" line), which will give you links to the main functionality with RDFIO from the main links in the left sidebar on the wiki:
    * Semantic Tools
    ** Special:RDFIOAdmin|RDFIO Admin
    ** Special:RDFImport|RDF Import
    ** Special:SPARQLEndpoint|SPARQL Endpoint
    ** Special:SPARQLImport|SPARQL Import
    
  • Create the article "MediaWiki:Smw_uri_blacklist" and make sure it is empty (you might need to add some nonsense content like {{{}}}).

Test that it works[edit]

  • Now, try adding some semantic data to wiki pages, and then check the database (using phpMyAdmin e.g.) to see if you get some triples in the table named arc2store_triple.
  • Access the SPARQL endpoint at http://[url-to-your-wiki]/Special:SPARQLEndpoint
  • Access the RDF Import page at http://[url-to-your-wiki]/Special:RDFImport
  • Access the SPARQL Import page at http://[url-to-your-wiki]/Special:SPARQLImport

Additional configuration[edit]

These are some configuration options that you might want to adjust to your specific use case. That goes into your LocalSettings.php file. Find below a template with the default options, which you can start from, add to your LocalSettings.php file and modify to your liking:

# ---------------------------------------------------------------
#  RDFIO Configuration
# ---------------------------------------------------------------
# An associative array with base uris as keys and corresponding 
# prefixes as the items. Example:
# array( 
#       "http://example.org/someOntology#" => "ont1",
#       "http://example.org/anotherOntology#" => "ont2"
#      );
# $rdfiogBaseURIs = array();
# ---------------------------------------------------------------
# Query by /Output Equivalent URIs SPARQL Endpoint 
# (overrides settings in HTML Form)
# 
# $rdfiogQueryByEquivURI = false;
# $rdfiogOutputEquivURIs = false;
#
# $rdfiogTitleProperties = array(
#  'http://semantic-mediawiki.org/swivt/1.0#page',
#  'http://www.w3.org/2000/01/rdf-schema#label',
#  'http://purl.org/dc/elements/1.1/title',
#  'http://www.w3.org/2004/02/skos/core#preferredLabel',
#  'http://xmlns.com/foaf/0.1/name',
#  'http://www.nmrshiftdb.org/onto#spectrumId'
# );
# ---------------------------------------------------------------
# Allow edit operations via SPARQL from remote services
#
# $rdfiogAllowRemoteEdit = false;
# ---------------------------------------------------------------

Dependencies[edit]

Basic Usage[edit]

User manual (under development)

Bugs, new feature request and contact information[edit]

Please use the issue tracker on GitHub for all issues, suggestions or general feedback!

Alternative triple store connectors / SPARQL Endpoints[edit]

One of the features of RDFIO is to connect Semantic MediaWiki with a triple store, and to provide a SPARQL Endpoint. There are (already) a few extensions that offer this feature. See this page for an overview of triple store connector features. (The idea behind RDFIO is mainly focusing on the RDF import functionality, and merge of some or all of the extensions is being discussed).

See also[edit]

Related work[edit]