baojie / smw

Semantic Mediawiki Python binding
15 stars 4 forks source link

Write support? #2

Open olenz opened 10 years ago

olenz commented 10 years ago

Do you see a chance to support writing the Semantic data in the wiki? The RDF export is handled via the Special page, but there is no corresponding thing for writing data, is there?

baojie commented 10 years ago

It would be very easy to do so by adding some scripts on a page

page = wiki.site.Pages['SnowWhite'] old_content = page.edit() new_content = old_content + "[[Category:Princess]][[friend of::Grumpy]]" page.save(new_content)

https://github.com/baojie/smw/commit/330055cadd0fe2e133100a35cf0d3b92f243a0fb

olenz commented 10 years ago

That's not exactly what I meant. I thought that there would be a function to more directly modify the SMW data, e.g. by allowing to upload an RDF file (basically the inverse of "getRDF"). However, I see that this might be a problem, as all data should somehow be reflected in the contents of the article, I guess.

baojie commented 10 years ago

In SMW, the page content is primary, and database version is secondary. If we directly write to the database, the written data could be lost when the subject page is refreshed.

I agree that it would be very useful to import RDF data into wiki. The RDFIO extension [1] maybe used, although it requires a bit more setup at server side.

It may be useful to enable client-side Python support (without changing server code) by rewriting RDF triples to wiki scripts. Let's keep it in the roadmap

[1] http://www.mediawiki.org/wiki/Extension:RDFIO