Actually, I was able to accomplish this, with a hack in SMW_OwlExport.php:

in method printExpData
around line 542:
 global $wgParser, $wgTitle;

then around line 577:
    $newTextValue = "";
                        if($object->getDatatype() == ""){
                          // donundeen: i think here is where we need to parse wikitext.
                          // note: this may break something I haven't thought of...
                          $newTextValue = $object->getDataValue()->getShortWikiText();
                          $newTextValue = $wgParser->parse( $newTextValue, $wgTitle, new ParserOptions)->mText;
                          // use this $newTextValue instead of the wikitext. Gotta make is XML-safe though!
                          $newTextValue = $object->getName();
                        $this->post_ns_buffer .= '>' .
                            str_replace( array( '&', '>', '<' ), array( '&amp;', '&gt;', '&lt;' ), $newTextValue ) .
                            '</' . $property->getQName() . ">\n";

I'm not saying for a second that this is the RIGHT way to do it, but it can be done. Of course, there could be some nasty side effects I haven't considered yet.

Any for me, it doesn't make sense to send wiki-formatted text in an RDF export, unless the consumer is another wiki. The RDF export is a service, so there's no telling who the consumer will be. I wouldn't expect some random consumer to grok wikitext, but i could expect it to grok HTML.


From: Benedikt Kaempgen <>
To: don undeen <>; smw dev list <>
Sent: Tue, December 7, 2010 2:57:21 PM
Subject: RE: [SMW-devel] RDFExport : rendering wikitext


I think, configuring the rdf export to transform content is not possible and
also not its intended purpose. Maybe there is a one-to-one mapping of wiki
syntax to html implemented in a script, somewhere?  If so, you could use it
to do the transformation after the export.



Karlsruhe Institute of Technology (KIT)
Institute of Applied Informatics and Formal Description Methods (AIFB)

Benedikt Kämpgen
Research Associate

Kaiserstraße 12
Building 11.40
76131 Karlsruhe, Germany

Phone: +49 721 608-7946
Fax: +49 721 608-6580

KIT – University of the State of Baden-Wuerttemberg and
National Research Center of the Helmholtz Association

-----Original Message-----
From: don undeen []
Sent: Thursday, December 02, 2010 6:22 PM
To: smw dev list
Subject: [SMW-devel] RDFExport : rendering wikitext

hi All,
I'm working with the RDF export feature, so I can deliver wiki data to 3rd
Party apps.

For example, I've got an essay page, which has content that's contained in
the Text-type property "hasTextContentLeft"
, "hasTextContentMain", etc

So I was using the RDF Export feature to extract that data from a page.

However, in this essay content, the user may have done any of the formatting
stuff that one might do with the WYSIWYG editor. For example, adding
''this'' to make a word italicized.

When the RDF exporter delivers this data, it returns ''this'' . However,
it's a lot easier on my 3rd party app if it only has to worry about
rendering HTML, not wiki text.

I'm wondering if there's a way to get the rdf exporter to return <i>this</i>
instead of ''this'' ?

I'm happy to write some sort of proxy that gets the RDF, then runs the
individual elements through the parser. But I'd like to reduce the amount of
overhead, and avoid any extra http calls to the MW api page.

What would be the best way to approach this?