[[Semantic MediaWiki 1.5.6]]
Install instructions for the latest SMW version are also online in a more
convenient format for reading:
http://semantic-mediawiki.org/wiki/Help:Installation
Contents
* Disclaimer
* Requirements
* Installation
** Testing your Installation
** Customising Semantic MediaWiki
** Running SMW on older versions of MediaWiki
* Upgrading existing installations
** Upgrading geographic coordinates
** Upgrading n-ary (multivalued) properties
** Changed configuration options
* Troubleshooting
* SMW is installed. What should I do now?
* Contact
== Disclaimer ==
For a proper legal disclaimer, see the file "COPYING".
In general, the extension can be installed into a working wiki without making
any irreversible changes to the source code or database, so you can try out
the software without much risk (though no dedicated uninstall mechanism is
provided). Every serious wiki should be subject to regular database backups!
If you have any specific questions, please contact the authors.
== Requirements ==
* MediaWiki 1.15.4 or greater (tested on 1.16.0 to 1.17alpha (r63248).
* PHP 5.* or greater installed and working
* MySQL >= 4.0.14 (version required by MediaWiki) OR PostgreSQL >= 8.3
Note that Postgres support is still preliminary and might require special
setup, see http://semantic-mediawiki.org/wiki/PostgreSQL
Notes:
* SMW uses the PHP mb_*() multibyte functions such as mb_strpos in the
php_mbstring.dll extension. This is standard but not enabled by default on
some distributions of PHP.
See http://php.net/manual/en/ref.mbstring.php#mbstring.installation
* For installation and upgrade, SMW needs the rights to create new tables
(CREATE) and to alter tables (ALTER TABLE). Both can be removed again after
SMW was set up. The script SMW_setup.php can use the DB credentials from
AdminSettings.php for this purpose, avoiding the need of extra rights for
the wiki DB user.
* SMW creates and alters temporary tables for certain semantic queries. To do
this, your wikidb user must have privileges for CREATE TEMPORARY TABLES. The
according features can be disabled by adding the following to
Localsettings.php:
$smwgQSubcategoryDepth=0;
$smwgQPropertyDepth=0;
$smwgQFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY;
$smwgQConceptFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY &
~SMW_CONCEPT_QUERY;
== Installation ==
If you upgrade an existing installation of Semantic MediaWiki, also read the
remarks in the section "Notes on Upgrading" below!
(1) Extract the archive or check out the current files from SVN to obtain the
directory "SemanticMediaWiki" that contains all relevant files. Copy this
directory to "[wikipath]/extensions/" (or extract/download it there).
We abbreviate "[wikipath]/extensions/SemanticMediaWiki" as "[SMW_path]".
(2) Insert the following two lines into "[wikipath]/LocalSettings.php":
include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php");
enableSemantics('example.org');
where example.org should be replaced by your server's name (or IP address).
The latter is needed only once, using the "preferred" name of your server.
It is no problem to access a site by more than one servername in any case.
If you have custom namespaces (such as "Portal"), read the note below.
(3) In your wiki, log in as a user with admin status and go to the page
"Special:SMWAdmin" to do the final setup steps. Two steps are needed: at
first, trigger the database setup ("Database installation and upgrade").
Afterwards, activate the automatic data update ("Data repair and upgrade").
Note that the first step requires permissions to alter/create database
tables, as explained in the above note. The second step takes some time;
go to Special:SMWAdmin to follow its progress. SMW can be used before this
completes, but will not have access to all data yet (e.g. page categories).
Both of those actions can also be accomplished with the command-line PHP
scripts SMW_setup.php and SMW_refreshData.php. Read the documentation in
[SMW_path]/maintenance/README for details on how to run such scripts.
'''Remark:''' Semantic MediaWiki uses ten additional namespace indexes (see
http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces), in the range from
100 to 109. 100 and 101 are not used (they were used in early beta versions).
106 and 107 are reserved for the SemanticForms extension. If you have your own
custom namespaces, you have to set the parameter $smwgNamespaceIndex before
including SemanticMediaWiki.php. See the documentation $within SMW_Settings.php for
details. If you add more namespaces later on, then you have to assign them to
higher numbers than those used by Semantic MediaWiki.
=== Testing your Installation ===
If you are uncertain that everything went well, you can do some testing steps
to check if SMW is set up properly.
Go to the Special:Version page. You should see Semantic MediaWiki (version nn)
listed as a Parser Hook there.
Create a regular wiki page named "TestSMW", and in it enter the wiki text
Property test: [[testproperty::Dummypage]]
When previewing the page before saving, you should see a Factbox at the bottom
of the article that shows your input. After saving the page, click on the link
"Browse properties" in the page's toolbox. This view should show Testproperty
with value Dummypage.
If you don't get these results, check the steps in the Installation section,
consult the FAQ section, then contact the user support list (see the Contact
section).
=== Customising Semantic MediaWiki ===
Semantic MediaWiki can be customised by a number of settings. The available
options are detailed in http://semantic-mediawiki.org/wiki/Help:Configuration
=== Running SMW on older versions of MediaWiki ===
If your site is still running on PHP4, SMW is not supported. It would hardly
be possible to backport the code to the old PHP version. If you have PHP5 but
an older MediaWiki version, additional patches/modifications might be needed.
Download an older release of SMW and have a look at the included INSTALL
instructions to find out whether other changes are recommended therein.
== Upgrading existing installations ==
(Please read all of this before upgrading)
Installations of SMW 1.5.* can be upgraded by just replacing the files, and all
extensions compatible with SMW 1.5.1 should work without modification. If
problems occur, it is possible to go back to 1.5.1 by simply using the old
files, waiting with the upgrade until the relevant extensions provide updates.
If not done already, it is suggested to change the inclusion of SMW in
LocalSettings.php to the following as described in the installation
instructions above:
include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php");
Including SMW_Settings.php as in earlier versions will continue to work, but may
be disabled in some future version.
Existing SMW 1.4.* installations and all SMW installations that already use the
default store (SMWSQLStore2) can basically follow the above installation steps.
The latter covers all sites with SMW 1.2 to 1.3 that do not use a special
setting to switch back to the old store ("SMWSQLStore" or "SMWRAPStore").
Older versions of SMW can be upgrade in a similar fashion, but must ensure that
they do not depend on now peculiarities of the old version. Please read the
upgrade instructions for SMW version 1.2 and 1.3 for details. Moreover,
SMW 1.5.0 finally removed all backwards compatibility to SMW beta versions
below SMW 1.0. If your wiki still uses the setting $smwgSMWBetaCompatible=true
then you should not upgrade until you find that disabling this setting works
properly and without complications.
There are two changes in SMW functionality that may affect some sites that used
earlier versions. Additional steps are required if the wiki uses n-ary
(multivalued) properties or properties of type Geographic coordinate and the
required upgrade steps are described in separate sections below.
Directly after enabling SMW 1.5.1, it could potentially happen that the site
shows SQL errors due to background jobs trying to access the new DB structure
even before you initialised it. This can even block you from reaching SMWAdmin.
In this case, either use the script SMW_setup.php from the command-line, or
access your database and delete all entries in the table "job". After this, no
errors should show up while accessing the special page for initialisation.
When upgrading from SMW 1.4.* or older, extensions of SMW (e.g. Semantic Forms)
need to be updated to a version that is compatible with SMW 1.5.1. See your
extension's homepage for details. If used, it is also necessary to update to a
more recent version of SemanticResultFormats (SRF).
=== Upgrading geographic coordinates ===
The datatype Geographic coordinate has been moved from SMW to the Semantic Maps
extension. Wikis that use this type should install Semantic Maps version 0.6
or above. No other changes are needed, but it is recommended to install
Semantic Maps before upgrading SMW so as to avoid problems at any time. The
move has been done to concentrate geo-related features in one extension for
better maintenance and ease of use.
=== Upgrading n-ary (multivalued) properties ===
The way how these properties are declared on their property pages has changed
since SMW 1.4.3, and it is necessary to change the pages of all such properties
to use them again as before. Until SMW 1.4.*, such properties were declared by
type declarations as in the following example:
[[has type::Page; Number; String]]
In this case, a property with three fields of the specified types was declared.
You can use the inline query {{#ask: [[has type::~ *;*]] }} to obtain a list of
all properties in your wiki that are of this form at all. Since SMW 1.5.0, two
property assignments must be made on the property page instead:
[[has type::Record]]
[[has fields::Page; Number; String]]
In other words, all "n-ary" properties are now of the new datatype Record, and
the information about their fields is stated independently. This change allowed
for many improvements in SMW, and makes it possible to create new (better)
extensions for supporting compound property values in the future.
To upgrade, ''first'' install the new version of SMW, then use the above inline
query to efficiently find all properties that need to be changed. After
updating the pages as required, all values should be accessible as before
(possibly some repair jobs need to finish before this is really the case; check
your job queue). If you change the pages before the upgrade to SMW 1.5.1, then
it will be necessary to start a repair cycle of SMW to ensure that all affected
page are indeed updated.
=== Changed configuration options ===
Some configuration options (used in LocalSettings.php) have changed since SMW
1.0. All settings are documented in detail in the file SMW_Settings.php. The
following list gives the version in which a setting was first introduced, so it
can be ignored if you already run this version or a more recent one.
* [1.4] Up to version 1.4, the default for value for the setting
$smwgQComparators was '<|>|!'. It now has changed to '<|>|!|~' so the "like"
comparator ~ is enabled by default.
* [1.4] Version 1.4 still supported a setting $smwgSMWBetaCompatible to enable
the old query syntax and the Relation namespace. This backwards
compatibility has now been dropped and the setting is no longer used. Please
update your wiki to not use the outdated (and now undocumented) features.
* [1.3] Since SMW 1.3, the Factbox is hidden by default and will not appear.
As a compensation, the toolbox (usually on the left below the search field)
shows a link to Special:Browse. To use the display behaviour of the Factbox as
it was before SMW 1.3, set $smwgShowFactbox = SMW_FACTBOX_NONEMPTY; The new
link and the Factbox during editing can also be configured; see
SMW_Settings.php for details.
* [1.2.1] SMW will no longer support nested link syntax in property values by
default, since this was known to cause problems. To re-enable this, set
$smwgLinksInValues = true;
* [1.2] The syntax and the Relation: namespace have still been officially
supported in SMW 1.2, and were optionally available until SMW 1.4.*. Both are
now disabled and can no longer be used.
* [1.2] If you had a setting $smwgQDisjunctionSupport = false, then you now
need the following settings:
$smwgQFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY;
$smwgQConceptFeatures = SMW_ANY_QUERY & ~SMW_DISJUNCTION_QUERY & ~SMW_CONCEPT_QUERY;
Older configuration changes are found online, see
http://semantic-mediawiki.org/wiki/Help:Installation_1.3
== Troubleshooting ==
Some technical problems are well known and have easy fixes. Please view the
online manual: http://semantic-mediawiki.org/wiki/Help:Troubleshooting
See http://semantic-mediawiki.org/wiki/Help:Reporting_bugs for reporting and
looking up bugs. You can also send an email to
semediawiki-user@lists.sourceforge.net (subscribe first at
http://sourceforge.net/mailarchive/forum.php?forum_name=semediawiki-user)
== SMW is installed. What should I do now? ==
Semantic MediaWiki is there to help you to structure your data, so that you
can browse and search it easier. Typically, you should first add semantic
markup to articles that cover a topic that is typical for your wiki. A single
article, semantic or not, will not improve your search capabilities.
Start with a kind of article that occurs often in your wiki, possibly with
some type of articles that is already collected in some category, such as
cities, persons, or software projects. For these articles, introduce a few
properties, and annotate many of the articles with the property. As with
categories, less is often more in semantic annotation: do not use overly
specific properties. A property that is not applicable to at least ten
articles is hardly useful.
Templates can greatly simplify initial annotation. Create a flashy template
for your users to play with, and hide the semantic annotations in the code
of the template. Use the ParserFunctions extension to implement optional
parameters, so that your users can leave fields in the template unspecified
without creating faulty annotations.
Develop suitable inline queries ({{#ask: ... }}) along with any new
annotation. If you don't know how to use some annotation for searching, or
if you are not interested in searching for the annotated information anyway,
then you should probably not take the effort in the first place. Annotate
in a goal-directed way! Not all information can be extracted from the
annotations in your wiki. E.g. one can currently not search for articles that
are *not* in a given category. Think about what you want to ask for before
editing half of your wiki with new semantics ...
If in doubt, choose simple annotations and learn to combine them into more
complex information. For example, you do not need to have a category for
"European cities" -- just combine "located in::Europe" and "Category:City."
If European cities are important for your wiki, you can create a Concept
page for storing that particular query. In any case, if some annotation is
not sufficient, you can still add more information. Cleaning too specific
and possibly contradictory annotations can be more problematic.
Regularly review users' use of categories, properties, and types using
the Special pages for each.
== Contact ==
See "Contact" in the file README, or view the current online information
http://semantic-mediawiki.org/wiki/Contact
If you have remarks or questions, please send them to
semediawiki-user@lists.sourceforge.net
You can join this mailing list at
http://sourceforge.net/mail/?group_id=147937
Please report bugs to MediaZilla, http://bugzilla.wikimedia.org