Help:Semantic Web

Although Semantic MediaWiki is designed to be used without additional technical background knowledge, it is closely related to well-known Semantic Web technologies. These technologies enable the wiki to share its knowledge with external applications by encoding it into the standard OWL/RDF format. Below is an overview of some related resources. These should be instructive for those who are familiar with semantic technologies or who wish to implement tools that use Semantic MediaWiki's RDF export. Normal users should go to the user manual to find help on using the wiki.

RDF export
The explicit semantic content of Semantic MediaWiki is formally interpreted in the OWL DL ontology language, and is made available in OWL/RDF format. For further details on the exported format, see Help:RDF export.

Reusing vocabulary from external ontologies
Normally, all statements in the wiki refer to concepts and properties defined in the wiki, but it is also possible to directly use vocabulary from other sources. E.g. this wiki imports a number of semweb:FOAF elements for use within the wiki. A detailed description of how to use this feature is given in the article on vocabulary import.

Querying and importing data
Reusing vocabulary does not import data to your wiki. You are basically reusing definitions, e. g. that your property "Website" is re-using the property "foaf:homepage" as defined in the FOAF vocabulary.

If you want query external data sources within your wiki and store data from these queries to your wiki, there are several different approaches:

Data Transfer extension
The Data Transfer extension allows users to both export and import data from and to the wiki, with export done in XML format and import possible in both XML, CSV and some spreadsheet formats. By using Semantic templates, the data from the import can be stored in SMW.

External Data extension
With the External Data, you can query different sources outside of your wiki and display the data. External data also supports storing this data inside your wiki with the parser function

A simple example shows how to use the API of Wikidata. In a first step, external data queres if the name of the page exists in Wikidata.



You could use this mechanism not only on a regular wiki page, but also on a form definition, if you use Page Forms for entering data in your wiki. There you could define the values to be set in the field "WikidataID" with the display parser function of external data:

LinkedWiki
The LinkedWiki extension lets you reuse Linked Data in your wiki. You can get data from Wikidata or another source directly with a SPARQL query. This extension also provides Lua functions for building your module so that you can write your data in your RDF database.

RDFIO
The RDFIO extension provides extended RDF import and export capabilities in Semantic MediaWiki, including a fully PHP-based SPARQL Endpoint

SPARQL Result format
The SparqlResultFormat is an extension hat lets you query different SPARQL endpoints and represent output data in various formats.

An example for a simple SPARQL query for Wikidata:

SPARQL endpoint
Any SMW powered wiki can be configured to provide a SPARQL endpoint that enables expressive querying against the wiki's content. By default,SMW stores all data in the same relational database (usually, a MySQL database) that is used by MediaWiki. But in principle, SMW supports any database that supports the SPARQL query language and SPARUL (SPARQL/Update) as introduced in SPARQL 1.1. and can be configured to use various Using SPARQL and RDF stores SPARQL stores.

External reuse
Tools that can process OWL/RDF in a meaningful way (including many RDF tools), can also be used with Semantic MediaWiki. Help:Reuse lists a number of applications that have been tested with the wiki's output on one site or the other.