Semantic Web

From semantic-mediawiki.org
(Redirected from 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[edit]

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 RDF export.

Reusing vocabulary from external ontologies[edit]

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[edit]

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[edit]

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[edit]

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 #store_external_table

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.

{{#get_web_data:url=wikidata.org/w/api.php?action=wbgetentities&sites=frwiki%7Cenwiki%7Cdewiki&titles=…{{PAGENAME}}&props=descriptions&languages=en&format=json
|format=JSON
|data=Qid=id,Description=value
}}

;{{#external_value:Qid}}
:{{#external_value:Description}}

You could use this mechanism not only on a regular wiki page, but also on a form definition, if you use Extension "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:

{{{field|WikidataID|input type=tokens|values={{#external_value:Qid}}|class=form-control}}}

LinkedWiki[edit]

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

RDFIO[edit]

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

SPARQL Result format[edit]

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:

{{#sparql2table:
|divId=table1 
|sparqlEndpoint=Wikidata
|sparqlEscapedQuery=
SELECT ?item ?itemLabel WHERE {  ?item wdt:P31 wd:Q146.  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
}}

SPARQL endpoint[edit]

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[edit]

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




This documentation page applies to all SMW versions from 1.0 to the most current version.
      Other languages: defrruukzh-hans

Semantic Web en 1.0