RDFIO-Mediawiki Extension: Difference between revisions

From artserver wiki
m (Text replacement - "Code_Notes" to "Code Notes")
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
RDFIO is a Mediawiki extension which:
{{#set: Section=Code Notes|
Date=2020}}
 
[https://www.mediawiki.org/wiki/Extension:RDFIO RDFIO] is a Mediawiki extension which:
* adds  SPARQL Endpoint to SMW installtion
* adds  SPARQL Endpoint to SMW installtion
* imports RDFs into the wiki
* imports RDFs into the wiki
* queries remote SPARQL endpoint URL
* queries remote SPARQL endpoint URL


==Related Work==
To me it is quite interesting to be able to have a SPARQL endpoint in a wiki, without having to [https://www.semantic-mediawiki.org/wiki/Help:Using_SPARQL_and_RDF_stores setup a RDF store], which to the extent of my knowldge, disables SMW's [[Special:Ask|ask queries]], forcing users to use only the SPARQL endpoint. So RDFIO seems to combine the best of both approaches.                                         
The article ''RDFIO: extending Semantic MediaWiki for interoperable biomedical data management''<ref>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</ref> was quite eye opening, as to how RDFIO can be used to expand the territory of Mediawiki + Semantic Mediawiki into Semantic Web, in
 
The article ''RDFIO: extending Semantic MediaWiki for interoperable biomedical data management''[[CiteRef::Lampa2017]] 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, "
"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, "
The possibility of gathering and publishing from and to other Semantic Web resources, or in other words, sindicating structured data, makes the RDFIO extension quite appealing. I was looking forward to be able to embed sparql queries from other sparql endpoints into this wiki, bringing in other data sources to here as well as my data accessible through RDFIO sparql endpoint. However, it didn't quite work as I expected, for the following reasons:
* RDFIO sparql endpoint was often giving incoherent results, seeming to not pickup all the values of a property which I was querying
* It has no functionality to embed sparql queries in wiki pages, it's main focus is on importing RDF data.
** in my view, it does not take advantage of a killer-feature the point of the Semantic Web, which is data syndication - being able to do realtime queries data that is being curated by other communities, rather than have data frozen and then giving me the responsibility to curate it.
* the documentation is also scarse and organized
In search for a Mediawiki extension that we cover those points I came across the [https://www.mediawiki.org/wiki/Extension:Linked LinkedWiki] extension. Started playing with it and I quite excited, so decided to investigate a bit more, which can be read in [[LinkedWiki-Mediawiki Extension]]
   
In any case here are my notes on RDFIO


==Installing==
==Installing==
Line 13: Line 28:
However, as described in the following [https://github.com/rdfio/RDFIO/issues/65 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 <code>59-make-work-with-mw-1.34 should be checkout</code>'''.
However, as described in the following [https://github.com/rdfio/RDFIO/issues/65 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 <code>59-make-work-with-mw-1.34 should be checkout</code>'''.


  cd extensions/Rdfio
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
  git checkout 59-make-work-with-mw-1.34
  php ../../maintenance/update.php
  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;


Once done in the page Special:RDFIOAdmin it should read: "The triplestore is already set up"


== import RDF==
== import RDF==
using Rdfio/maintenance/importRdf.php it is possible to import to the wiki RDF files. As example I will import  [https://www.w3.org/People/Berners-Lee/card Tim Berners Lee FOAF card]  
using Rdfio/maintenance/importRdf.php it is possible to import to the wiki RDF files. As example I will import  [https://www.w3.org/People/Berners-Lee/card Tim Berners Lee FOAF card]
  php importRdf.php --server http://localhost --in ~/Documents/Projects/RDF/LearningSparql/TimBernersLee.ttl
  php importRdf.php --server http://localhost --in ~/Documents/Projects/RDF/LearningSparql/TimBernersLee.ttl


Line 27: Line 57:


== SPARQL Query==
== SPARQL Query==
Now that TBL FOAF se can use the Special:SPARQLEndpoint to query it
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''.
 


<source lang="sparql>
<source lang="sparql>
@PREFIX w: <http://localhost/beerwiki/index.php/Special:URIResolver/> .
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf: <http://xmlns.com/foaf/0.1/>.


SELECT *
SELECT *
WHERE { ?s ?p "Timothy Berners-Lee" }
WHERE { ?s ?p ?v }
LIMIT 25
LIMIT 200
</source>
</source>




<source lang="sparql">
<source lang="sparql">
@PREFIX w : <http://localhost/beerwiki/index.php/Special:URIResolver/> .
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf: <http://xmlns.com/foaf/0.1/>.
 


SELECT *
SELECT *
WHERE { ?s w:Property-3AName ?val }
WHERE { ?s ?p "André Castro" }
LIMIT 25
LIMIT 25
</source>
</source>


Who knows who
<source lang="sparql">
<source lang="sparql">
@PREFIX w: <http://localhost/beerwiki/index.php/Special:URIResolver/> .
@PREFIX w : <http://oooooooooo.io/index.php/Special:URIResolver/> .
@PREFIX foaf : <http://xmlns.com/foaf/0.1/> .
@PREFIX foaf : <http://xmlns.com/foaf/0.1/> .


SELECT *
SELECT *
WHERE { ?s foaf:homepage ?v }
WHERE { ?s foaf:knows ?v }
LIMIT 25
LIMIT 25
</source>
</source>


==References==
==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 [https://rdflib.readthedocs.io/en/stable/gettingstarted.html RDFlib] to query the wiki, as explified in [https://janakiev.com/blog/wikidata-mayors/ Where do Mayors Come From: Querying Wikidata with Python and SPARQL]
 
==Test==
"Test Quote"[[CiteRef::Byrne 2008]]
 
{{#referencelist:
|listtype=ul
|browselinks=true // ("true", "1", "on" and "yes") or ( "false", "0", "off", and "no")
|columns=2
|header=Notes
}}

Latest revision as of 13:53, 25 August 2022


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.

The article RDFIO: extending Semantic MediaWiki for interoperable biomedical data managementLampa2017 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, "

The possibility of gathering and publishing from and to other Semantic Web resources, or in other words, sindicating structured data, makes the RDFIO extension quite appealing. I was looking forward to be able to embed sparql queries from other sparql endpoints into this wiki, bringing in other data sources to here as well as my data accessible through RDFIO sparql endpoint. However, it didn't quite work as I expected, for the following reasons:

  • RDFIO sparql endpoint was often giving incoherent results, seeming to not pickup all the values of a property which I was querying
  • It has no functionality to embed sparql queries in wiki pages, it's main focus is on importing RDF data.
    • in my view, it does not take advantage of a killer-feature the point of the Semantic Web, which is data syndication - being able to do realtime queries data that is being curated by other communities, rather than have data frozen and then giving me the responsibility to curate it.
  • the documentation is also scarse and organized

In search for a Mediawiki extension that we cover those points I came across the LinkedWiki extension. Started playing with it and I quite excited, so decided to investigate a bit more, which can be read in LinkedWiki-Mediawiki Extension

In any case here are my notes on RDFIO


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

Test

"Test Quote"Byrne 2008

{{#referencelist:

|listtype=ul
|browselinks=true // ("true", "1", "on" and "yes") or ( "false", "0", "off", and "no")
|columns=2
|header=Notes

}}

... more about "RDFIO-Mediawiki Extension"
Code Notes +
Date"Date" is a type and predefined property provided by Semantic MediaWiki to represent date values.
2020 +