Extension:RDFIO

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
RDFIO

Release status:Extension status beta

DescriptionTemplate:Extension#description Extended RDF import and export capabilities in Semantic MediaWiki, including a fully PHP-based SPARQL Endpoint
Author(s)Template:Extension#username Samuel Lampa, Ali King, Denny Vrandečić
Latest versionTemplate:Extension#version v2.0.10 (2016-11-26)
MediaWikiTemplate:Extension#mediawiki Tested with 1.26.x
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license GPL
Download

Translate the RDFIO extension if it is available at translatewiki.net

Check usage and version matrix.

Update Nov 1 2016: Works with SMW 2.4 - Vagrant box available[edit source]

MW 1.26 + SMW 2.4[edit source]

Version 2.0.9 of RDFIO works with MW 1.26 + SMW 2.4. Use the README page on GitHub (recommended), or the installation section below for updated installation instructions. Also, please use the GitHub issue tracker for any questions, feedback or issues!

Automated Virtual Machine installation (a.k.a. "Vagrant box")[edit source]

Note that you can now set up a complete virtual machine with MediaWiki, Semantic MediaWiki and the latest RDFIO in under 20 minutes with a single command, using the new Vagrant box!

Introduction[edit source]

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 source]

Dependencies[edit source]

Composer[edit source]

  • See this page for installation instructions.

MediaWiki[edit source]

  • See this page for installation instructions.

Semantic MediaWiki[edit source]

  • See this page for installation instructions.
  • To show the "Semantic factbox" on all pages, make sure to include this in your LocalSettings.php file:
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;

Installation steps[edit source]

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

  • Add the following option to the end of LocalSettings.php:
$smwgOWLFullExport = true;

It allows user defined properties for property articles (which is needed by the RDF import)

  • 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 source]

  • 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 source]

  • 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 source]

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;
#
# $rdfiogPropertiesToUseAsWikiTitle = 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 source]

Basic Usage[edit source]

User manual (under development)

Bugs, new feature request and contact information[edit source]

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

Change Log[edit source]

  • v2.0.10 - 2016-11-26 - Remove non-working RDF/XML example data and polish RDF import form.
  • v2.0.9 - 2016-10-31 - Support for SMW 2.4, MW 1.26. WikiObjectModel dependency dropped. Fixed some bugs, etc etc.
  • ... bunch of versions not included here ...
  • 1.9.6 - 2014-08-11 - Enhanced admin page, better feedback on import/setup success, creates pages for import data sources, refactoring and tidying of internal functionality
  • 1.9.? - 2013-10-21 - RDFIO is nearing basic feature completion. Many things are now tested with Unit testing and some system testing.
  • 1.9.? - 2013-05-17 - Works with the new SMWSQLStore3
  • 1.9.0 - 2012-11-22 - Updated to work with SMW 1.6 and later. Much refactored code base. Depends now only on Wiki Object Model, rather than SMWWriter and Page Object Model.
  • 0.5.0 - 2010-09-17 - Numerous fixes to make remote SPARQL querying work (See repository updates for a list of all commits).
    • Improved file hierarchy
    • Made querying and output of/querying by Original URIs and Equivalent URIs configurable from LocalSettings.php in SPARQL endpoint (So this can be turned on for remote queries too)
    • In total five new configurable settings for LocalSettings.php (see here for full list):
      • $rdfiogQueryByOrigURI = true;
      • $rdfiogOutputOrigURIs = true;
      • $rdfiogQueryByEquivURI = false;
      • $rdfiogOutputEquivURIs = false;
      • $rdfiogAllowRemoteEdit = false;
    • Lots of serious bug fixes encountered when making SPARQL querying from Bioclipse/Jena work
  • 0.4.0 - 2010-08-16
    • Support for configuring extra namespace prefixes in LocalSettings.php
    • More options in RDF Import screen
    • Output SPARQL resultset as default for remote queries, and HTML for form queries
    • Enable output as Original URI/Equivalent URI also for XML Resultset output format
    • Refactorings (Merged EquivalentURIHandler and SMWBatchWriter classes, Broke out RDFIOPageHandler in separate file)
    • Many bugfixes
  • 0.3.0 - 2010-07-30 - Added output filtering options and other improvements.
    • Option to query by Equivalent URI
    • Refined SPARQL Endpoint screen
    • Option to output all Equivalent URIs (For RDF/XML format only)
    • Option to filter properties by ontology (when outputting equivalent URIs) by specified an URL to an OWL ontology definition. (For RDF/XML format only).
    • Much improved processing of SPARQL queries
    • Various refactoring
    • Fixed various bugs
      • Initialize query variable (r150)
      • Don't delete Original URI properties etc when deleting other facts (r151)
      • Fixed error in isURL check (r153)
  • 0.2.0 - 2010-07-20 - Important security improvements
    • Checking for appropriate user rights on all special pages
    • Improved code structure and comments
    • Various small fixes
  • 0.1.0 - 2010-07-21 - First release

Alternative triple store connectors / SPARQL Endpoints[edit source]

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 source]