<docbook><section><title>OdsIntegrationMediaWiki</title><title> ODS Integration of MediaWiki</title> ODS Integration of <ulink url="MediaWiki">MediaWiki</ulink>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">What is MediaWiki?</bridgehead>
MediaWiki is a popular open-source wiki engine written in PHP.
 The guide below shows how to run it in Virtuoso.<bridgehead class="http://www.w3.org/1999/xhtml:h3">Install VAD</bridgehead>
<orderedlist spacing="compact"><listitem>Start virtuoso db using the hosting_php.so ( .dll for win users).
 To use this plugin, it must be included in your virtuoso ini file as follows: <programlisting>...
[Plugins]
# for ex. here the location of the plugins is the plugin folder
LoadPath = ./plugin
...
Load6    = Hosting,hosting_php.so
...
</programlisting></listitem>
<listitem>Setup &quot;Local Virtuoso&quot; DSN (note the empty space in the name!) in order to access any of the application URLs.
<itemizedlist mark="bullet" spacing="compact"><listitem>For windows users, please perform the following steps: <orderedlist spacing="compact"><listitem>Go to Start &gt;&gt; Settings &gt;&gt; Control Panel &gt;&gt; Administrative Tools &gt;&gt; Data Sources (ODBC) </listitem>
<listitem>Go to tab &quot;User DSN&quot; and click &quot;Add&quot; </listitem>
<listitem>Select the &quot;<ulink url="OpenLink">OpenLink</ulink> Virtuoso (version)&quot; driver and click &quot;Finish&quot; </listitem>
<listitem>Enter &quot;Name&quot;: Local Virtuoso</listitem>
<listitem>Enter &quot;Description&quot;: My Local Virtuoso</listitem>
<listitem>For &quot;Server&quot;, enter your Virtuoso&#39;s hostname and ISQL port, e.g., localhost:1116</listitem>
<listitem>Click &quot;Next&quot; </listitem>
<listitem>Enter a username for &quot;Login ID&quot;, e.g., dba</listitem>
<listitem>Enter the user&#39;s &quot;Password&quot;.
 For dba, the default password is dba</listitem>
<listitem>Click &quot;Next&quot; </listitem>
<listitem>Click &quot;Finish&quot;.
</listitem>
</orderedlist></listitem>
</itemizedlist></listitem>
<listitem>From ISQL, execute: <programlisting>SQL&gt; DB.DBA.VAD_INSTALL(&#39;tmp/mediawiki_fs.vad&#39;,0);
</programlisting>This will install MediaWiki version 1.18.4 and Semantic MediaWiki version 1.8 .
</listitem>
<listitem>Go to http://<emphasis>yourvirtuosohost:port</emphasis>/MediaWiki This will show the start page of the MediaWiki installer and will look like this: <figure><graphic fileref="OdsIntegrationMediaWiki/mw.png" /></figure> </listitem>
<listitem>Click the <emphasis>complete the installation</emphasis> link.
 This will open a Language selection page.
<emphasis>Tip:</emphasis> If you have run the mediawiki installer before it may remember you settings and not start the installation from the beginning.
 In this case you should click the <emphasis>restart installation</emphasis> link in the menu on the right hand side.
<figure><graphic fileref="OdsIntegrationMediaWiki/Install.png" /></figure> </listitem>
<listitem>Select your language and click the <emphasis>Continue</emphasis> button.
 This will open the Welcome to MediaWiki page.
</listitem>
<listitem>About half way down the page there should be a green message saying <emphasis>The environment has been checked.
 You can install <ulink url="MediaWiki">MediaWiki</ulink>.</emphasis>  Click the <emphasis>Continue</emphasis> button at the bottom of the page.
 This will take you to the Connect to Database page.
</listitem>
<listitem>Virtuoso should be selected for you.
 When using Virtuoso there are no further settings required so just click the <emphasis>Continue</emphasis> button.
</listitem>
<listitem>Setup the name of your wiki the and Administrator account.
 Select <emphasis>Ask me more questions</emphasis> before clicking <emphasis>Continue</emphasis> to enable <emphasis><ulink url="VirtuosoAuth">VirtuosoAuth</ulink></emphasis>.
</listitem>
<listitem>On the Options page in the Extensions section select VirtuosoAuth.
 Click <emphasis>Continue</emphasis>.
</listitem>
<listitem>Once the tables have been created you will be propmpted to download LocalSetting.php.
<figure><graphic fileref="OdsIntegrationMediaWiki/mediawiki.png" /></figure> </listitem>
<listitem>Move the downloaded LocalSettings.php  into <emphasis>virtuoso</emphasis> <emphasis>installation</emphasis> <emphasis>folder</emphasis>/vsp/vad/vsp/MediaWiki.
</listitem>
<listitem>To enable VirtuosoAuth edit LocalSettings.php and add the following <programlisting>enableVirtuosoAuth();
</programlisting>after <programlisting>require_once( &quot;$IP/extensions/VirtuosoAuth/VirtuosoAuth.php&quot; );
</programlisting></listitem>
<listitem>Click on the <emphasis>enter your wiki</emphasis> link or go to http://<emphasis>yourvirtuosohost:port</emphasis>/MediaWiki you should see something like this: <figure><graphic fileref="OdsIntegrationMediaWiki/complete.png" /></figure></listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">User Authentication with the VirtuosoAuth Extension</bridgehead>
The VirtuosoAuth extension extends the way users can be authenticated in MediaWiki.With the extension enabled, usernames and passwords are authenticated by Virtuoso as well as MediaWiki.  What this means is that an existing Virtuoso user does not have to specifically set up a MediaWiki account, just use her Virtuoso username and password in the MediaWiki login dialog.In addition, the extension allows users to authenticate themselves using an OpenId or WebID.  In either case a matching MediaWiki user is silently created the first time the user logins in.  In order to use a WebID you will need to do some further configuration.  Please see the Additional setup required for WebId Setup section.In the case where authentication is via an OpenId or WebId and the username from the OpenId or WebId matches an existing MediaWiki username then the user is prompted for the mediawiki password.  The OpenId or WebId is then associated with that MediaWiki user.If your instance of Virtuoso has the ODS-Framework installed then the VirtuosoAuth extension will attempt to authenticate users as ODS users.  Additionally, when a new mediawiki user is created an ODS account will also be created for that user.  New MediaWiki/ODS users can be created from a username and password or from an existing OpenId or WebId.<bridgehead class="http://www.w3.org/1999/xhtml:h4">Using the VirtuosoAuth extension with a Private Wiki</bridgehead>
 MediaWiki can be configured as a private wiki which means that users must be logged in to read any pages.
 If you are using the <ulink url="VirtuosoAuth">VirtuosoAuth</ulink> extension with a private wiki then the VirtuosoAuth login page must be added to the white list of pages that can be read before logging in.
 This is done by adding the following line to LocalSettings.php <programlisting>$wgWhitelistRead = array( &quot;Special:VOILogin&quot; );
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Additional setup required for <ulink url="http://webid.info/">WebId</ulink>.</bridgehead>
<para>If you want to be able to login using a <ulink url="WebId">WebId</ulink> you will need to set up a secure sockets server in Virtuoso.</para>
<orderedlist spacing="compact"><listitem>Open the Virtuoso Conductor, http://<emphasis>yourvirtuosohost:port</emphasis>/conductor.
</listitem>
<listitem>Select the <emphasis>System Admin</emphasis> tab and then the <emphasis>Security</emphasis> tab.
 This opens a form for creating a security certificate.
 <figure><graphic fileref="OdsIntegrationMediaWiki/Cert.png" /></figure> </listitem>
<listitem>Fill in the fields and click the <emphasis>Generate</emphasis> button.
 This will create the certificate.
 You should now see the <emphasis>Configure HTTPS Listeners</emphasis> button.
</listitem>
<listitem>Click the <emphasis>Configure HTTPS Listeners</emphasis> button and fill in the Host or Domain name and the Listening Interface in the listener configuration form.
 <figure><graphic fileref="OdsIntegrationMediaWiki/Interface.png" /></figure> </listitem>
<listitem>Generate a new key by clicking the <emphasis>Generate New</emphasis> button.
 Click <emphasis>Save</emphasis>.
</listitem>
<listitem>You should now see a <emphasis>Configure ODS Endpoints</emphasis> button.
 Click this button.
</listitem>
<listitem>Click the link to <emphasis>Create a New End Point</emphasis>.
<figure><graphic fileref="OdsIntegrationMediaWiki/endpoint.png" /></figure> </listitem>
<listitem>Click the <emphasis>Save</emphasis> button.
</listitem>
<listitem>You can test the endpoint clicking the endpoint link.
 <emphasis>Tip:</emphasis> If there is a problem finding the certificate, you may need to restart your browser.
</listitem>
<listitem>You can now edit LocalSettings.php so that $wgSecureServer is set to your https listener.</listitem>
</orderedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">Access Control Lists and the <ulink url="VirtuosoAuth">VirtuosoAuth</ulink> Extension</bridgehead>
<para>The <ulink url="VirtuosoAuth">VirtuosoAuth</ulink> extension now has suppport for Webid based access control lists.
 It can be configured using the LocalSetting.php file in root of your <ulink url="MediaWiki">MediaWiki</ulink> installation.</para>
<para>The <ulink url="VirtuosoAuth">VirtuosoAuth</ulink> extension must be enabled and the global variables $wgRequireODSAccount and $wgUseVirtuosoACL must both be set to true.
The $wgAllowMWUsers global array is basically a white list of users and should contain the name of the wiki administrator.
 In my case theis is admin so I have this line in LocalSetting.php </para>
<programlisting>$wgAllowMWUsers = array ( &quot;admin&quot; );
</programlisting><para> So, the section of LocalSettings.php that contains the config information for the <ulink url="VirtuosoAuth">VirtuosoAuth</ulink> extension looks like this </para>
<programlisting>require_once( &quot;$IP/extensions/VirtuosoAuth/VirtuosoAuth.php&quot; );
$wgRequireODSAccount = true;
$wgAllowMWUsers = array ( &quot;admin&quot; );
enableVirtuosoAuth();
$wgUseVirtuosoACL = true;
</programlisting><para> The access control list is set up using a custom tag in the wiki page like this: </para>
<programlisting>&lt;accesscontrollist user=http://id.myopenlink.net/dataspace/person/jhand#this mode=Read /&gt;
&lt;accesscontrollist user=http://id.myopenlink.net/dataspace/person/jhand#this mode=Write /&gt;
&lt;accesscontrollist user=http://localhost:8890/dataspace/person/TestUser1#this mode=Read /&gt;
&lt;accesscontrollist user=http://localhost:8890/dataspace/person/TestUser1#this mode=Write /&gt;
</programlisting><para> If there are no <span style="color: red">
      UNKNOWN tag:
      http://www.w3.org/1999/xhtml:accesscontrollist tags in the document then it is readable and writable by all users.</span></para>
<para>If there is an <span style="color: red">
      UNKNOWN tag:
      http://www.w3.org/1999/xhtml:accesscontrollist tag on a page then the current users is silently given read and write access to the page when it is saved(they must already have write access because they are editing the page).
 This avoids the situation where you forget to add yourself to the ACL and once the page is saved you can never access it again.
 Note that as soon as a page is edited by another user then that user will get read and write access and the original page creator will lose it unless they are added to the access control list.</span></para>
<para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">Installing Extensions on a Virtuoso Hosted MediaWiki</bridgehead>
<para>Extensions let you customize how MediaWiki looks and works.
 There are many extensions available to <ulink url="http://www.mediawiki.org/wiki/Special:ExtensionDistributor">download</ulink>  from the MediaWiki web site.
 For general instructions on installing extensions see the <ulink url="http://www.mediawiki.org/wiki/Manual:Extensions">Extensions manual page</ulink>.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4">Download the Extension.</bridgehead>
<para>Extensions can be downloaded using the the <ulink url="http://www.mediawiki.org/wiki/Special:ExtensionDistributor">Extensions Distributor</ulink> or from the extensions page on the MediaWiki web site.</para>
<figure><graphic fileref="OdsIntegrationMediaWiki/download1.png" /></figure><para>Select the required extension from the drop down list.
 Click the <emphasis>Continue</emphasis> button.</para>
<figure><graphic fileref="OdsIntegrationMediaWiki/download2.png" /></figure><para>If there are different versions of the extension available you can choose the one that matches your version of MediaWiki.  If you have installed the Virtuoso VAD then you have MediaWiki version 1.18.
 Once you have selected the version click the <emphasis>Continue</emphasis> button.
 You will then see a confirmation screen with some instructions for unpacking the download.
 Your download should start automatically.</para>
<figure><graphic fileref="OdsIntegrationMediaWiki/download3.png" /></figure><bridgehead class="http://www.w3.org/1999/xhtml:h4">Unpack the Extension</bridgehead>
<para>Move the downloaded file to the extensions folder of your MediaWiki installation.
 This will be in <emphasis>your Virtuoso installation folder</emphasis>/vsp/vad/vsp/MediaWiki/extensions.
 Unzip the extension.</para>
<bridgehead class="http://www.w3.org/1999/xhtml:h4">Enable the Extension</bridgehead>
<para>Extensions are enabled in the LocalSettings.php file in the root of your MediaWiki installation.
 Typically, this will mean adding a line similar to the following at the end of LocalSettings.php.
</para>
<programlisting>require_once( &quot;$IP/extensions/extension_name/extension_name.php&quot; );
</programlisting><para>Some extensions will have additional settings that can be modified by adding them to LocalSettings.php.
 See the documentation for the particular extension that you are installing.</para>
<para>For example, if you are installing the Widgets extension then you would add the following line to LocalSettings.php to enable it: </para>
<programlisting>require_once(&quot;$IP/extensions/Widgets/Widgets.php&quot;);
</programlisting><para> The Widgets extension also needs the following to be set in LocalSettings.php: </para>
<programlisting>$wgGroupPermissions[&#39;sysop&#39;][&#39;editwidgets&#39;] = true;
&lt;/verbatim&gt;/


---+++Linked Data View Scripts

After you have installed the &lt;nowiki&gt;MediaWiki&lt;/nowiki&gt; mediawiki_fs.vad package you may want to set up Linked Data Views of the MediaWiki database tables.  The benefits of doing so are described in [[http://virtuoso.openlinksw.com/wiki/main/Main/MediaWikiSIOCRef][MediaWiki SIOC Reference]].

Setting up the views is simply a matter of executing a script in ISQL.  The script is included in the MediaWiki VAD and can be found in &lt;i&gt;your Virtuoso installation folder&lt;/i&gt;/vsp/vad/vsp/MediaWiki/maintenance/virtuoso/MediaWiki_rdf_views_script.sql 

&lt;verbatim&gt;
isql localhost:1116 dba dba MediaWiki_rdf_views_script.sql
</programlisting><orderedlist spacing="compact"><listitem><itemizedlist mark="bullet" spacing="compact"><listitem>The MediaWiki Linked Data Views script can also be found <ulink url="http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/VirtRDFViewMediaWiki">here</ulink>.</listitem>
</itemizedlist></listitem>
</orderedlist><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h3">URI Schemes</bridgehead>
 <programlisting>http://&lt;your-instance-cname&gt;/MediaWiki/user/&lt;ods-user-id&gt;
</programlisting><para> </para>
<bridgehead class="http://www.w3.org/1999/xhtml:h2">Download</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem>You can download the MediaWiki VAD package from <ulink url="https://virtuoso.openlinksw.com/download/">here</ulink>.</listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h2">References</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://www.mediawiki.org/">MediaWiki</ulink></listitem>
</itemizedlist><bridgehead class="http://www.w3.org/1999/xhtml:h3">See Also</bridgehead>
<itemizedlist mark="bullet" spacing="compact"><listitem><ulink url="http://virtuoso.openlinksw.com/wiki/main/Main/MediaWikiSIOCRef">MediaWiki SIOC Reference</ulink> </listitem>
<listitem><ulink url="VirtDeploSemanticMediaWiki">Installing and Configuring SemanticMediaWiki using Virtuoso</ulink> </listitem>
<listitem><ulink url="VirtDeployLinkedWikiV2">Installing and Configuring the LinkedWiki v2.0.1 Extension</ulink> </listitem>
<listitem><ulink url="VirtDeployLinkedWikiV1">Installing and Configuring the LinkedWiki v1.0.1.2 Extension</ulink></listitem>
</itemizedlist><para> <ulink url="CategoryRDF">CategoryRDF</ulink> <ulink url="CategorySIOC">CategorySIOC</ulink> <ulink url="CategorySPARQL">CategorySPARQL</ulink> <ulink url="CategoryWiki">CategoryWiki</ulink>  <ulink url="CategoryVirtuoso">CategoryVirtuoso</ulink></para>
</section></docbook>