RDFIO-Mediawiki Extension
RDFIO is a Mediawiki extension which:
- adds SPARQL Endpoint to SMW installtion
- imports RDFs into the wiki
- queries remote SPARQL endpoint URL
To me it is quite interesting to be able to have a SPARQL endpoint in a wiki, without having to setup a RDF store], which to the extent of my knowldge, disables SMW's ask queries, forcing users to use only the SPARQL endpoint. So RDFIO seems to combine the best of both approaches.
Related Work
The article RDFIO: extending Semantic MediaWiki for interoperable biomedical data management[1] was quite eye opening, as to how RDFIO can be used to expand the territory of Mediawiki + Semantic Mediawiki into Semantic Web, in "usage scenarios such as bootstrapping new wikis from existing data sources, or round-tripping between the SMW data structure and the RDF data format used in the wider Semantic Web, "
Installing
Installation of RDFIO is simple, if the installation steps are followed.
However, as described in the following issue: the extension development team is having a hard time to keep up with the development and deployment rate of Mediawiki. So for the moment, for Mediawiki 1.34.1, the branch 59-make-work-with-mw-1.34 should be checkout
.
php composer.phar require rdfio/rdfio --update-no-dev cd extensions/ mv Rdfio/ Rdfio.bak git clone https://github.com/rdfio/RDFIO.git Rdfio cd Rdfio git checkout 59-make-work-with-mw-1.34 php ../../maintenance/update.php rm -r ../Rdfio.bak
Once done in the page Special:RDFIOAdmin it should read: "The triplestore is already set up"
Settings
I have added the following settings to LocalSettings.php, so that the SPARQL endpoint is accessible to non-logged in users, but editind (insert statments are disabled)
# --------------------------------------------------------------- # RDFIO Configuration # --------------------------------------------------------------- $rdfiogAllowRemoteEdit = false; $wgGroupPermissions['*']['rdfio-sparql'] = true;
import RDF
using Rdfio/maintenance/importRdf.php it is possible to import to the wiki RDF files. As example I will import Tim Berners Lee FOAF card
php importRdf.php --server http://localhost --in ~/Documents/Projects/RDF/LearningSparql/TimBernersLee.ttl
That import will probably add a few Jobs to be MW queue which need to be run:
php ../../maintenance/update.php
SPARQL Query
We can user Special:SPARQLEndpoint to query the wiki property & values
Note: that despite runing the update.php and runJobs.php I needed to perform a refresh action on the pages with Semantic annotation so that the RDFIO could pick it them up.
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
SELECT *
WHERE { ?s ?p ?v }
LIMIT 200
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
SELECT *
WHERE { ?s ?p "André Castro" }
LIMIT 25
Who knows who
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf : <http://xmlns.com/foaf/0.1/> .
SELECT *
WHERE { ?s foaf:knows ?v }
LIMIT 25
Furture Research
- can we use RDIO to query external SPARQL endoints and bring the results to the wiki? Don't think so
- can we embbed SPARQL queries in wiki pages?
- use Python's RDFlib to query the wiki, as explified in Where do Mayors Come From: Querying Wikidata with Python and SPARQL
References
- ↑ Lampa, S., Willighagen, E., Kohonen, P. et al. RDFIO: extending Semantic MediaWiki for interoperable biomedical data management. J Biomed Semant 8, 35 (2017). https://doi.org/10.1186/s13326-017-0136-y