The original use case behind the RDFIO Semantic MediaWiki Extension which I developed as part of "Google Summer of Code 2010", and which was to hook up SMW with Bioclipse, is now concretizising. By using the new Bioclipse SMW Module (code here) it is now for the first time possible to add and remove SMW facts from inside Bioclipse, using a little Bioclipse JS Script:
var wikiURL = "http://drugmet.rilspace.org/wiki/"; smw.addTriple( "w:Caffeine", "w:is_a", "w:Molecule", wikiURL );
Removing triples is similar:
var wikiURL = "http://drugmet.rilspace.org/wiki/"; smw.removeTriple( "w:Caffeine", "w:is_a", "w:Molecule", wikiURL );
Well, you can use full URI:s also, but using the "w" prefix references wiki article titles directly. Thus you can view the result of the addition at http://drugmet.rilspace.org/wiki/Caffeine
What does this mean? Well, one thing is that with Bioclipse you can edit facts in SMW with the ease and power of javascript! This could enable scenarios where an SMW gets prepopulated with data for subsequent community editing, whereafter data can be transferred back to Bioclipse again, (as blogged about by Egon Willighagen already), possibly making community editing of scientific data mainstream!
There's a little convenience method for getting all RDF data from the SMW too:
rdfStore = rdf.createInMemoryStore(); rdfStore = smw.getRDF( "http://drugmet.rilspace.org/wiki/" );
... which you can then query locally with SPARQL, using the rdf manager:
result = rdf.sparql( rdfStore, "SELECT DISTINCT ?p WHERE { ?s ?p ?o } LIMIT 10" ) js.print( result );
...getting some output like so:
[["p"], ["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], ["http://www.w3.org/2000/01/rdf-schema#domain"], ["http://www.w3.org/2000/01/rdf-schema#range"], ["http://www.w3.org/2000/01/rdf-schema#subPropertyOf"], ["http://www.w3.org/2000/01/rdf-schema#subClassOf"], ["http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate"], ["http://semantic-mediawiki.org/swivt/1.0#wikiNamespace"], ["http://www.w3.org/2000/01/rdf-schema#isDefinedBy"], ["http://semantic-mediawiki.org/swivt/1.0#page"], ["http://www.w3.org/2000/01/rdf-schema#label"] ]
That's it! Oh, well, I demonstrated the same thing with a screencast as well:
Yay! :) As getting this to work, we ran into a number of bugs in RDFIO, so that also resulted in a new release
Comments
Backport to Bioclipse 2.4?
Samuel, should we try to backport this to the 2.4.x branch? This is cool stuff! Well done! Oh, and please put the demo scripts on MyExperiment.org...