Setting up SemanticMediaWiki using Virtuoso.
General instructions for setting up SMW can be found here. This page gives specific instructions for using the SemanticMediaWiki extension with Virtuoso.
PrerequisitesVirtuoso Server with the Mediawiki VAD installed.
Note on Installing MediaWikiInstall MediaWiki on your server following this guide:
The MediWiki VAD includes everything that you need to run SemanticMediaWiki. The SMW and Validator extensions are installed during the VAD install. When you run the MediaWiki installer will see on the Options Page, in the Extensions section, that you can select to enable the Validator and SemanticMediaWiki extensions. Do not select SemanticMediaWiki at this point. There is a bug? in the automatic installation of SemanticMediawiki and it will cause your installation of MediaWiki to fail. You will need the Validator extension for SemanticMediaWiki so you can either choose to enable it during the MediaWiki setup or enable it manually later.
Enable the SemanticMediawiki Extension.
Once you have successfully installed MediaWiki, go to the root of the installation and edit LocalSettings.php. Enable the extensions by putting the following lines in LocalSettings.php. If you enabled Validator while setting up MediaWiki? then the validator line will already be in LocalSettings.php.
require_once( "$IP/extensions/Validator/Validator.php" ); include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" ); enableSemantics('localhost:8890');
Set Up the Database TablesNext you will need to set up some extra database tables that are used by SMW. If you enable the extension but do not do this step you will find you get an error message every time you save a page. The message you will see is:
Error in doQuery(): [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ200: No table smw_ids .
To set up the database tables, log in as a MediaWiki administrator and go to the Special Pages. Select the Admin Functions for Semantic MediaWiki page.
On the Admin Functions For Semantic MediaWiki Page click the Initialise or upgrade tables button. This will set up the tables.
If it is successful you will see a page showing each table that has been created and at the bottom you will see the message The storage engine was set up successfully.
Testing the InstallationAt this point you can quickly check that SMW has been correctly installed by creating a new page and entering the following text.
Property test: [[testproperty::Dummypage]]
If you preview the page before saving you will see a Factbox containing the new property. Once the page is saved the property should be displayed when you select the Browse Properties link in the left hand menu.
At this point you can use SMW. However, you may wish to set up Virtuoso as an SMWSparqlStore.
Using Virtuoso as SMWSparqlStoreThe default storage backend for SemanticMediaWiki is called SQLStore2 and it stores the semantic information in the same relational database used by the base MediaWiki installation. However, a relational database is not the best way to store semantic information. SMW allows you to set up a RDF data store that can be queried using the sparql protocol as a more efficient means of storing semantic data. See the SMW help document: Help:Using SPARQL and RDF stores.
The following must be added to LocalSettings.php to use Virtuoso as a sparql store.
$smwgDefaultStore = 'SMWSparqlStore'; $smwgSparqlDatabase = 'SMWSparqlDatabaseVirtuoso'; # using Virtuoso as connector $smwgSparqlQueryEndpoint = 'http://localhost:8890/sparql/'; # location of query service $smwgSparqlUpdateEndpoint = 'http://localhost:8890/sparql/'; # location of update service $smwgSparqlDataEndpoint = ''; # location of SPARQL over HTTP service # optional value; leave as is in case of problems $smwgSparqlDefaultGraph = 'http://example.org/mydefaultgraphname'; # name of default graph