RDF export of SIOC wiki content

Based on Leigh Dodds idea about FOAF Bulletin Board RDF Export, I wrote some scripts that transform SIOC Wiki pages into RDF description:

The export is done with PHP5 and XSLT, using embedded PHP within XSL stylesheets, so that I can call PHP functions in it. For each link found during the transformation, a PHP function opens the URL and gets the SIOC link using autodiscovery feature. I’ve also added a function that remove links that shouldn’t be exported.

With the 2 links provided below, you’ve got an up-to-date description of where to find raw SIOC data or SPARQL stores, that you can use in your crawler or any application. A cache version is also created on each request made, you can use it if you need to access the RDF files several times in a short interval.

About these ads

Integrate FCKEditor in Dokuwiki

Dokuwiki is a nice wiki application, easy to setup, and with a lot of plugins (notes, LaTeX rendering …). It features a tiny javascript editor in order to publish pages without knowledge of its wiki syntax. Yet, some users would certainly like a more advanced WYSIWYG editor, especially for handling images upload and positioning.

So, here’s a quick tutorial to embed FCKeditor[1], a GPL-ed WYSIWYG XHTML-compliant editor, in Dokuwiki[2].

First, setup FCK as the default DokuWiki editor:

  • Copy the unpackaged FCK archive folder to $BASE/lib/scripts/[3];
  • We’ll use the textarea replacement method to embed FCK. So open $BASE/inc/template.php and, after line 218, add the following instructions:
 ptln('<script type="text/javascript" charset="utf-8" src="'.       DOKU_BASE.'lib/scripts/FCKeditor/fckeditor.js"></script>',$it);  ptln('<script type="text/javascript" charset="utf-8">window.onload = function() '.       '{ var fck = new FCKeditor("wiki__text", "100%", "600"); fck.BasePath = "'.       DOKU_BASE.'lib/scripts/FCKeditor/"; fck.ReplaceTextarea(); }</script>');

where “100%” and “600” are the editor width and height;

  • In $BASE/inc/html.php delete/comment the following line (l.1023), to remove the original JS editor:
 <div id="size__ctl"></div>
  • You should also edit $BASE/lib/scripts/FCKeditor/fckeditor.js and remove the following line (l.92), or FCK will complain he can’t find a textarea in the front-end pages:
 alert( 'Error: The TEXTAREA with id or name set to "' + this.InstanceName    + '" was not found' ) ;

Then, we need to tell DokuWiki that pages are now written in HTML, and not using its wiki syntax:

  • The first thing to do is to set $conf['htmlok'] = 1; in $BASE/conf/dokuwiki.conf (or local.php if you created one);
  • Next, you’ll have to open $BASE/inc/common.php and replace the line (l. 840)
 io_saveFile($file, $text);

by

 io_saveFile($file, "<html>$text</html>");

so that it will save content between <html> tags, telling Dokuwiki we’re embedding HTML;

  • Open $BASE/inc/html.php and, @ line 277, replace
   p_render('xhtml',p_get_instructions($txt),$info)

by

   p_render('xhtml',p_get_instructions("<html>$txt</html>"),$info)

so that the preview text will be also interpreted as HTML.

One of the bast feature of FCK is its images/files upload management. If you want to enable it:

  • In $BASE/lib/scripts/FCKEditor/fckconfig.js, set _FileBrowserLanguage and _QuickUploadLanguage values to php (l. 134).
  • You’ll also need to edit ($BASE/lib/scripts/FCKeditor/editor/filemanager/browser/default/connectors/php/config.php and) $BASE/lib/scripts/FCKeditor/editor/filemanager/upload/php/config.php to set $Config['UserFilesPath'] to an upload directory relative to your website root (and create + chown it so that webserver can upload files), and set $Config['Enabled'] = true;.

That’s all, you’ve got FCKeditor running in your wiki.

At least, if want to get an easy way to create internal links (and so, new pages), you should add a rewrite rule to make your wiki interpret links like foo as index.php?id=foo. Using it, you’ll be able to create new pages using the FCK link editor, by adding a link with no protocol and just a page name.

Notes

[1] I first choosed TinyMCE, until I discovered its images management plugin wasn’t free, while FCK’s one is.

[2] Using with DokuWiki v2006-03-09 and FCKeditor v2.3.

[3] $BASE is supposed to be the DokuWiki install path on your server.

(another) SIOC Browser

While Uldis released his SIOC live browser, and Christoph wrote a nice live query interface, here’s my attempt ofdesigning another SIOC browser / explorer.

The idea, as discussed with Uldis and John when I was in Galway, is to:

  • Crawl different SIOC blogs;
  • Put crawled data in a triple-store;
  • Query this data w/SPARQL over HTTP;
  • Get some clean interfaces to view the results.

The browser, is available here: http://apassant.net/hack/2006/06/sioc-browser/

As I still have some code to improve / redesign, I’ll explain the concepts and implementation (SAJAX + JSON + …) in detail later[1], but you still can try it now.

The 3store used at the moment is a bit unstable (actually, it seems that it’s more related to MySQL / JDBC driver that to Joseki), so I hope you can have a look at it before it’s down :)

Finally, SIOC community is quite active at the moment, so if you want to know more or participate, let’s join the SIOC mailing-list!

Notes

[1] Certainly next week as I’m away for the WE

Customize your FOAFMap account

If you’re using FOAFMap, you may be not satisfied with the current design, especially if you link the map from your website.

Now, you can add your own header, and also use your own CSS ! You just need to add some parameters at the end of your account url:

Tom – SemWeb Technologies Co-ordinator @ ESWC06 – is now using it for ESWC Organising Commitee and Delegates list. He has also setup really cool things for the conference: a Semantic wiki (using Semantic Mediawiki), a Semantic search engine … and a complete RDF description of the conference (schedules, people …). BTW, is there a SPARQL endpoint available ?

I won’t be there, unfortunately, but FOAFMap will be presented tomorrow morning during the Scripting Challenge session of SFSW06.