Help:SemanticMW export features

From Biowikifarm Metawiki
Jump to: navigation, search
Help sections
Contents · Semantic MediaWiki · Semantic Forms
Add Ontology · Semantic links and import/export features · Import external vocabulary
Other SemanticMW extensions · Other extensions

Semantic MediaWiki is closely related to Semantic Web technologies. These technologies enable the wiki to share its knowledge with external applications by encoding it into the standard OWL/RDF format. These should be useful for those who wish to implement tools that use Semantic MediaWiki's RDF export.

RDF export

Based on the user's semantic annotations of articles, Semantic MediaWiki generates machine-readable documents in OWL/RDF format, that can be accessed via Special:ExportRDF. Moreover, there is a maintenance script for automatically generating complete exports of all semantic data.

Users can easily access the generated RDF via the page Special:ExportRDF by entering a list of articles into the input field. The export will contain one OWL/RDF specification with various description blocks for exported elements. In addition to the requested articles, the export will also contain basic declarations for any further elements (such as men- tioned instances, properties, and classes). There are two settings that further influence the set of exported articles:

  • Recursive export. Every article usually has relations to various other articles. Enabling recursive export, all information about the encountered objects will be exported right away.
  • Backlinks. The RDF data model is based on directed graphs. Usually it exports only the statements within which the corresponding element occurs as a subject, and the exported document does not include incoming links. Enabling the export of backlinks, all articles that have relations to any of the exported articles then will also be exported.

In addition to the form at Special:ExportRDF, one can also retrieve RDF by calling appropriate URLs directly. This is suitable for linking to RDF specifications directly. In addition to title and page, ExportRDF has additional GET (query string) parameters.

  • Backlinks can be enabled or disabled by setting "backlinks" to 1 or 0, respectively.
  • Recursive export can be enabled or disabled by setting "recursive" to 1 or 0.


The above example will export recursive and with backlinks the page named TemplateParameterIndexTest, in application/rdf+xml mime format. By default, the mime format for export is application/xml (with charset=UTF-8).

Exporting all data

In addition to the wiki's Special:ExportRDF function, there is also a maintenance script that allows you to export all of the wiki's semantic data at once.

  • The script is called SMW_dumpRDF.php and can be found in SMW's maintenance directory. The script SMW_dumpRDF.php can generate full exports, or it can be restricted to certain elements of the schema, e.g. to export only the category hierarchy or only the attributes with their types. Details are described in the script itself.
  • The script can easily be run automatically as a cronjob to generate RDF dumps on a regular basis.