Semantic MediaWiki: Difference between revisions
m (→Introduction) |
m (→Trouble) |
||
(188 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{ | {{Mediawiki extension | ||
|name=Semantic MediaWiki | |name=Semantic MediaWiki | ||
|screenshot= | |about= | ||
|developers=Markus Krötzsch, Denny Vrandecic, Jeroen De Dauw | |logo=SMW Logo.SVG | ||
| | |screenshot= | ||
| | |developers=Markus Krötzsch, Denny Vrandecic, Jeroen De Dauw, others | ||
| | |author_location=Oxford, England | ||
| | |licences= | ||
| | |description=Semantic MediaWiki is an extension for managing structured data in your wiki and for querying that data to create dynamic representations: tables, timelines, maps, lists, etc. | ||
| | |mediawiki=Any recent version. | ||
| | |||
| | However, we suggest using MW 1.22 (dec 2013). This version includes support for [https://getcomposer.org/ Composer], a dependency manager that will ease installation. | ||
|dependencies=Validator, ParamProcessor | |||
|related=Semantic Drilldown, Semantic Forms, Semantic Forms Inputs, Semantic Maps, Semantic Result Formats | |||
|related_text= | |||
|discussion= | |||
|languages=Many | |languages=Many | ||
| | |status=stable | ||
| | |released=2005/01/01 | ||
| | |last_released=2014/04/28 | ||
|last_version=1.9.2 (40ea19e) | |||
|programming language=PHP | |||
|alternative= | |||
|website=http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki | |website=http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki | ||
| | |publication= | ||
|last_edit= | |support_website=http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki | ||
|example_website= | |||
|last_edit=2014/05/02 | |||
}} | }} | ||
{{Incomplete}} | |||
== Introduction == | |||
{{quotation|'''Semantic MediaWiki''' (SMW) is an extension of [[Mediawiki]] – the wiki application best known for powering Wikipedia – that helps to search, organise, tag, browse, evaluate, and share the wiki's content. While traditional wikis contain only text which computers can neither understand nor evaluate, SMW adds ''semantic annotations'' that allow a wiki to function as a collaborative database. Semantic MediaWiki was first released in 2005, and currently has over ten developers, and is in use on hundreds of sites. In addition, a large number of [http://semantic-mediawiki.org/wiki/Help:SMW_extensions related extensions] have been created that extend the ability to edit, display and browse through the data stored by SMW: the term "Semantic MediaWiki" is sometimes used to refer to this entire family of extensions. Semantic MediaWiki has been funded in part by projects of the [http://en.wikipedia.org/wiki/Framework_Programmes_for_Research_and_Technological_Development Framework Programmes (FP)] of the European Union, [http://semantic-mediawiki.org/wiki/SEKT SEKT] and [http://semantic-mediawiki.org/wiki/ACTIVE ACTIVE] and by project [http://semantic-mediawiki.org/wiki/Halo Halo].}} ([http://semantic-mediawiki.org/wiki/Introduction_to_SMW Introduction to Semantic MediaWiki], retrieved 14:31, 24 August 2011 (CEST)) | {{quotation|'''Semantic MediaWiki''' (SMW) is an extension of [[Mediawiki]] – the wiki application best known for powering Wikipedia – that helps to search, organise, tag, browse, evaluate, and share the wiki's content. While traditional wikis contain only text which computers can neither understand nor evaluate, SMW adds ''semantic annotations'' that allow a wiki to function as a collaborative database. Semantic MediaWiki was first released in 2005, and currently has over ten developers, and is in use on hundreds of sites. In addition, a large number of [http://semantic-mediawiki.org/wiki/Help:SMW_extensions related extensions] have been created that extend the ability to edit, display and browse through the data stored by SMW: the term "Semantic MediaWiki" is sometimes used to refer to this entire family of extensions. Semantic MediaWiki has been funded in part by projects of the [http://en.wikipedia.org/wiki/Framework_Programmes_for_Research_and_Technological_Development Framework Programmes (FP)] of the European Union, [http://semantic-mediawiki.org/wiki/SEKT SEKT] and [http://semantic-mediawiki.org/wiki/ACTIVE ACTIVE] and by project [http://semantic-mediawiki.org/wiki/Halo Halo].}} ([http://semantic-mediawiki.org/wiki/Introduction_to_SMW Introduction to Semantic MediaWiki], retrieved 14:31, 24 August 2011 (CEST)) | ||
Line 31: | Line 41: | ||
* [[Semantic Drilldown]] | * [[Semantic Drilldown]] | ||
* [[Semantic Result Formats]] | * [[Semantic Result Formats]] | ||
* [[Semantic Maps]] | |||
* [[Semantic MediaWiki special pages]] (a list of useful special pages) | * [[Semantic MediaWiki special pages]] (a list of useful special pages) | ||
== | == Semantic properties == | ||
=== Properties and semantic web triplets === | |||
At the core of Semantic MediaWiki are so-called '''properties'''. Properties can be understood as "categories of information" and they are encoded in a way that a machine can understand. If you use a property + value in a given page, you implicitly create a so-called '''triplet'''. | |||
''' | For example, if we would like to add the information that ''Semantic MediaWiki'' is related to ''Semantic Forms'' we get the following triplet: | ||
Semantic MediaWiki - Is related to - Semantic Forms | |||
(Subject) (predicate) (object) | |||
In Semantic MediaWiki, we create triplets by adding code defining property/value pair to a page. Therefore, with respect to the above example: | |||
* This page (Semantic MediaWiki) is the '''subject''' that we describe with a property | |||
* '''Is related''' is the '''property''' name, i.e. the so-called predicate | |||
* The [[Semantic Forms]] page is the '''value of the property''' and represents the '''object''' | |||
The corresponding wiki code looks likes this: | |||
<source lang="bibtex">[[Is related to::Semantic Forms]]</source> | |||
'''Similarities with RDF''' | |||
In the Resource Description Framework RDF, a fragment like the following defines the same relationship. | |||
<source lang="XML"> | |||
<swivt:Subject rdf:about="http://edutechwiki.unige.ch/en/Special:URIResolver/Semantic_MediaWiki"> | |||
<property:Is_related_to rdf:resource="http://edutechwiki.unige.ch/en/Special:URIResolver/Semantic_Forms"/> | |||
</swivt:Subject> | |||
</source> | |||
In some ways, Semantic MediaWiki is the Wiki equivalent of RDF. Semantic data of a page can be exported as RDF like this: | |||
:<code><nowiki>[http://edutechwiki.unige.ch/en/Special:ExportRDF/Semantic_MediaWiki RDF feed]</nowiki></code>, e.g. click on [http://edutechwiki.unige.ch/en/Special:ExportRDF/Semantic_MediaWiki RDF feed] | |||
=== Property types === | |||
Properties in a Semantic MediaWikis define typed data, in a similar way as in object-oriented programming. Properties are used with the <code><nowiki>[[property_name::property_value]]</nowiki></code> syntax. By default, the value of a property is a wiki page, i.e. default data type of a property is simply a wiki page. | |||
<nowiki>MediaWiki [[is a:: Wiki]]</nowiki> | <nowiki>MediaWiki [[is a:: Wiki]]</nowiki> | ||
The following example | The following example shows a value that is an URL. However, this does not yet mean the '''data type''' of <code>Has website</code> is an URL. Since default values for properties are wiki pages, we must explicitly create and edit the property page as explained further down. | ||
<nowiki>[[ | <nowiki>[[Has website:: http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki]]</nowiki> | ||
The above code will be shown as <code>[[Has_website:: http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki]]</code> ,i.e. the reader will see a clickable URL. Let's now look at property types. | |||
''' | '''Data types for property types''' | ||
There exist several types, for example: | There exist several property types, for example: | ||
* '''Page''' (a wiki page, this the value by default, i.e. if you don't define a data type a property will | * '''Page''' (a wiki page, this the value by default, i.e. if you don't define a data type, a property value will display as "blue" or "red" link to a normal wiki page) | ||
* '''String''' (a short text) | * '''String''' (a short text) | ||
* '''Text''' (a longer text) | * '''Text''' (a longer text) | ||
Line 54: | Line 92: | ||
* '''Number''' | * '''Number''' | ||
* '''Date''' | * '''Date''' | ||
* '''Enumeration''' (lists of | * '''Enumeration''' (lists of values, i.e. of all the other types) | ||
* '''Boolean''' | * '''Boolean''' | ||
'''Manual coding''' | '''Manual coding''' | ||
* Each property | * Each property is defined through a page in the '''properties''' namespace. To create a property with a''property_name'' and a value, just use the following syntax in any other page: | ||
<nowiki>[[property_name:: your_property_value]]</nowiki> | <nowiki>[[property_name:: your_property_value]]</nowiki> | ||
* You then can type the property. By default a property is of type ''page'', i.e. it will link to a normal wiki page. For example <nowiki>[[is a:: Wiki]]</nowiki> will declare that this is a Wiki and then link to the page Wiki like this: [[is a:: Wiki]] | * You then can type the property. By default a property is of type ''page'', i.e. it will link to a normal wiki page. For example <nowiki>[[is a:: Wiki]]</nowiki> will declare that this is a Wiki and then link to the page Wiki like this: [[is a:: Wiki]] | ||
To define a property and its type there are three methods | |||
''' (1a) Create a property instance with a value, then create/hand code the property page''' | |||
* Create the property using <code><nowiki>[[property_name:: your_property_value]]</nowiki></code> or use templates as explained in the [[Semantic Forms]] article | |||
* Create or edit the property:your_property page and add a type declaration like this: | |||
This is a property of type <nowiki>[[Has type::URL]].</nowiki> | This is a property of type <nowiki>[[Has type::URL]].</nowiki> | ||
''' | ''' (1b) Use the ''Create with Form'' ''' | ||
* Same principle, but it will allow selecting a data type from a pull down list. | |||
'''(2) Use Special:CreateProperty''' | |||
The easiest way to create a property (including its page and the type declaration) is to use the form in [[Special:CreateProperty]] "special" page. | The easiest way to create a property (including its page and the type declaration) is to use the form in [[Special:CreateProperty]] "special" page. | ||
The following screenshot shows a property page for property that is being used in page, but that is not defined yet. Do define it, either use method 1a or 1b as explained just above. | |||
.............. | |||
=== Displaying properties === | |||
(under construction ...) | |||
The way a property will be displayed depends on its type and an additional parameter. By default, only the value will be shown, either as simple text or as a link. | |||
'''Values that are not links''' | |||
We defined a data type of property ''has accronym'' as ''string'', therefore the value will not show as a wiki link (as per default data type): | |||
The following table shows what happens: | |||
{| class="wikitable" | |||
|- | |||
! input !! output !! description | |||
|- | |||
| <nowiki>[[has acronym::SMW]]</nowiki> || [[has acronym::SMW]] || Most typical use of properties | |||
|- | |||
| <nowiki>[[has acronym::SMW::TheFuture::]]</nowiki> || [[has acronym::SMW]] || Defining two values (shortcut) | |||
|- | |||
| <nowiki>[[has acronym::SMW| ]]</nowiki> || [[has acronym::SMW| ]] || Value will not be shown | |||
|- | |||
| <nowiki>[[has acronym::SMW|MWS]]</nowiki> || [[has acronym::SMW|MWS]]|| An alternative text will be shown | |||
|- | |||
| <nowiki>[[:has acronym :: SMW]]</nowiki> || [[:has acronym :: SMW]] || Creates a link instead of a property (useless) | |||
|} | |||
=== Annotated values === | === Annotated values === | ||
:<nowiki>The Swiss Grading scale goes from 0 to [[grading scale:=6]] </nowiki> | |||
:Gives: The Swiss Grading scale goes from 0 to [[grading scale:=6]] | |||
=== Finding properties === | |||
There are several options that could help finding properties. | |||
; Default tools: | |||
* Use [[special:properties]] | |||
; Extensions that help browsing / listing | |||
* [http://www.mediawiki.org/wiki/Extension:Semantic_Drilldown Semantic_Drilldown extension] | |||
* [http://www.mediawiki.org/wiki/Extension:AkAPI Extension:AkAPI] allows to list properties of categories, a page and show values of certain attibutes. | |||
== Inline queries == | |||
Semantic Mediawiki includes a query language for semantic search. According to [http://www.semantic-mediawiki.org/wiki/Help:Semantic_search the manual] (7/2013), it can be used in three contexts: | |||
# Through the form of the [[Special:Ask]] page, | |||
# in so-called '''concepts''', i.e. saved queries, | |||
# and in '''inline queries'''. | |||
Most frequent use seem to be inline queries. | |||
Queries usually define three things: | |||
# Which page(s) to select. Read [http://www.semantic-mediawiki.org/wiki/Help:Selecting_pages Selecting pages] (semantic-mediawiki.org) | |||
# What information to display about those pages. Read [http://www.semantic-mediawiki.org/wiki/Help:Displaying_information Displaying information] (semantic-mediawiki.org) | |||
# How the results should be formatted. Additional extensions like [[Semantic Result Formats]] add further possibilities. | |||
'''Inline queries''' dynamically include query results as in the examples below. This functionality is implemented with so-called parser functions. | |||
* The '''#ask''' function takes a number of parameters, in particular: page selection, information to display, and how. | |||
* the #show function displays information for a single page, i.e. it's a kind of shortcut for the #ask function. | |||
One simple query would list all pages in a category. The following code: | |||
<source lang="perl"> | |||
{{#ask: [[Category: MediaWiki extension]]}} | |||
</source> | |||
produces a simple line: | |||
: {{#ask: [[Category: MediaWiki extension]]}} | |||
=== Simple queries === | |||
By definition, various query clauses are combined with an AND operator | |||
The following code selects all pages in the category ''software information'' '''and''' that include a property value ''Yaron Koren'' for the property ''Is developed by''. | |||
<source lang="perl"> | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]] | |||
| ?Has name | |||
| format=ul | |||
}} | |||
</source> | |||
It will produce this: | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::+]] | |||
| ?Has name | |||
| format=ul | |||
}} | |||
We also can use wildcards, e.g. if we wanted to list all pages that do include a property "Is developed by", we would use the following expression: | |||
<source lang="perl"> | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::+]] | |||
| ?Has name | |||
| format=ul | |||
}} | |||
</source> | |||
It will produce this: | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::+]] | |||
| ?Has name | |||
| format=ul | |||
}} | |||
=== Ask syntax === | |||
==== Overview ==== | |||
Roughly speaking, syntax of <code>#ask:</code> is the following: It it includes three groups of information: | |||
# Ask for pages that satisfy some conditions | |||
# Tell which information to show, e.g. property/values, | |||
# Define how to render the results, e.g. display items as a table or graph, sort results, add labels and table headers etc. See [[Semantic Result Formats]] for a more detailed introduction. | |||
<source lang="bibtex"> | |||
{{#ask | |||
search_clause_1 | |||
search_clause_2 | |||
...... | |||
| ?Information_1 to display | |||
| ?Information_2 to display | |||
| ?...... | |||
| Result_format_parameter 1 = x | |||
| Result_format_parameter 2 = y | |||
|.... | |||
}} | |||
</source> | |||
By default, queries will return a list '''wiki pages''' (i.e. without telling which other information to show and whether the page itself should be skipped). | |||
Search conditions (clauses) can include property/values (including wildcards and comparators), categories and some other stuff. In addition, you can use disjunctions (or's). | |||
==== Searching within categories and pages ==== | |||
To search within a category and ''all'' subcategories, simply use the normal wiki syntax, e.g. | |||
<source lang="bibtex"> | |||
[[Category: MediaWiki extension]] | |||
</source> | |||
A query including just this condition would return all the pages in the ''MediaWiki extension'''. For example, the query | |||
<source lang="bibtex" enclose="none"> {{#ask: [[Category: MediaWiki extension]]}} | |||
</source> | |||
produces this list: {{#ask: [[Category: MediaWiki extension]]}} | |||
Notice: This makes me wonder what happens if you have circular category structures ... | |||
==== Searching for property values ==== | |||
Property conditions can take several forms, i.e. define a value, use a wildcard, or include comparators | |||
'''Simple property value search''' | |||
To search for a property with a given value, use the normal property syntax, e.g. | |||
<source lang="bibtex"> | |||
[[Developed with::MediaWiki software]] | |||
</source> | |||
The query <source lang="bibtex" enclose="none"> {{#ask: [[Developed with::MediaWiki software]]}} | |||
</source> | |||
produces this list of pages: {{#ask: [[Developed with::MediaWiki software]]}} | |||
'''Wildcards''' | |||
* Use a '''+''' for wildcards | |||
The query <source lang="bibtex" enclose="none"> {{#ask: [[Supports languages::+]]}} | |||
</source> | |||
produces this list of pages: {{#ask: [[Supports languages::+]]}} | |||
See also the <code>~</code> (like) operator below for string comparison. | |||
'''Comparators''' | |||
Comparators work with property values and they are placed after the <code>::</code> in property conditions. | |||
: '''>>''' and '''<<''': "greater than" and "less than" | |||
: '''>''' and '''<''': "greater than or equal" and "less than or equal" | |||
:: However, if <tt>[https://www.semantic-mediawiki.org/wiki/Help:Configuration#smwStrictComparators $smwStrictComparators]] = true;</tt>, you get normal behavior, i.e. "greater than" and "less than" | |||
: '''≥''' and '''≤''': "greater than or equal" and "less than or equal" | |||
: '''!''': "not" ("unequal") | |||
: '''~''': «like» comparison for strings. | |||
:: In the comparison sting you can use "*" to match a chain of characters and "?" to match any single character | |||
: '''!~''': «not like» comparison for strings | |||
The query <source lang="bibtex" enclose="none"> {{#ask: [[Was last edited::>1 September 2013]]}} | |||
</source> | |||
produces this list of pages: {{#ask: [[Was last edited::>1 September 2013]]}} | |||
The query <source lang="bibtex" enclose="none"> {{#ask: [[Has field of science::~bio*]]}} | |||
</source> | |||
produces this list of pages: ''{{#ask: [[Has field of science::~bio*]]}}'', i.e. it will return pages whose <code>Has field of science</code> property includes at least one "bio". Below, a table that also lists the property values found | |||
:{{#ask: [[Has field of science::~bio*]] |?Has field of science}} | |||
Some comparisons can be hairy, e.g. values that are rounded for display, coordinates and such. | |||
==== Subqueries ==== | |||
<source lang="XML"> | |||
<q> .... </q> | |||
</source> | |||
Examples: | |||
* [http://semantic-mediawiki.org/wiki/Semantic_Maps_examples/Querying_with_additional_properties Semantic Maps examples/Querying with additional properties] | |||
=== Displaying results === | |||
Read the main article: [[Semantic Result Formats]] for more information about this topic, in particular if you are interested in visualizations made with JavaScript libraries. | |||
By default, results that include more than one property to be shown are shown as a table. The following code selects the same pages as above, but also displays ''has last revision number'' values. | |||
<source lang="perl"> | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]] | |||
| ?Has name | |||
| ?has last revision number | |||
| ?Is developed by | |||
}} | |||
</source> | |||
produces this: | |||
{{#ask: [[Category: MediaWiki extension{{{related_text|}}}]] [[Is developed by::Yaron Koren]] | |||
| ?Has name | |||
| ?has last revision number | |||
| ?Is developed by | |||
}} | |||
[[Semantic Result Formats]] allows to produce graphics. The following displays all pages where Yaron Koren is defined as developer plus the participations of other developers. | |||
<source lang="perl"> | |||
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]] | |||
| ?Is developed by | |||
| distribution=yes | |||
| min=0 | |||
| format=jqplotchart | |||
| mainlabel=- | |||
}} | |||
</source> | |||
produces this: | |||
{{#ask: [[Category: MediaWiki extension{{{related_text|}}}]] [[Is developed by::Yaron Koren]] | |||
| ?Is developed by | |||
| distribution=yes | |||
| min=0 | |||
| format=jqplotchart | |||
| mainlabel=- | |||
}} | |||
Read more in [http://www.semantic-mediawiki.org/wiki/Help:Inline_queries Inline queries], [http://www.semantic-mediawiki.org/wiki/Help:Displaying_information Displaying information], [http://semantic-mediawiki.org/wiki/Help:Semantic_templates Help:Semantic templates] and [http://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats] (Semantic-Mediawiki.org) | |||
=== Query operators === | |||
SMW queries can include comparators and allows '''OR''' (disjunctions) | |||
* Read [http://www.semantic-mediawiki.org/wiki/Help:Selecting_pages Help:Selecting pages] | |||
=== Troubleshooting === | |||
Use the debug option to test your #ask expression | |||
<source lang="bibtex"> | |||
{{#ask:[[Category:tutoriel]] | |||
|?.... | |||
|format=debug | |||
}} | |||
</source> | |||
Be aware that by default inline #ask only returns 50 results. Use the <code>limit=..</code> parameter to change this. Alternatively reset the value of [https://www.semantic-mediawiki.org/wiki/Help:Configuration#smwgQDefaultLimit $smwgQDefaultLimit]. | |||
== Special properties and compound data == | |||
(needs to be completed ....) | |||
=== Special properties === | |||
Special properties are automatically generated by the system and have all sorts of functions. By default, these properties are not yet defined. In order to make use of them, we suggest the following procedure: | |||
# List all properties using [[Special:Properties]] | |||
# Hover the mouse over the red links, the wiki will tell if it's a special property | |||
# Click on the red link | |||
# Create with form | |||
# Select type=text (not so sure about this....) | |||
* See also: [[Semantic MediaWiki special pages]] (a list of useful special pages) | |||
Good for debugging: | |||
* [[Property:Has improper value for]]: Lists pages that have illegal values for properties. | |||
Understanding were you get your values from: | |||
* [[Property:Gets values from category]] | |||
=== Compound data === | |||
(this section needs to be written) | |||
SMW has a page-based approach. This makes it difficult with data like "the teacher owns 3 bananas", i.e. he "has bananas" and "he has 3" | |||
You either can use ''subobjects'' or ''semantic internal objects'' to deal with this problem. Both have the same syntax, but work differently. | |||
<source lang="bibtex"> | |||
{{#subobject:Owns row|Owns fruit=bananas |Has quantity=4}} | |||
{{#set_internal:Is row in possions|Owns fruit=tomatoes|Has quantity=4}} | |||
</source> | |||
{{#subobject:Owns row|Owns fruit=bananas |Has quantity=3}} | |||
== Semantic MediaWiki software == | == Semantic MediaWiki software == | ||
Line 77: | Line 414: | ||
Most semantic MediaWiki sites make use of a whole range of extensions that are built on top of the basic Semantic MediaWiki infrastructure. For exemple, a popular extension is [[Semantic Forms]]. | Most semantic MediaWiki sites make use of a whole range of extensions that are built on top of the basic Semantic MediaWiki infrastructure. For exemple, a popular extension is [[Semantic Forms]]. | ||
=== | Read official documentation & download information: | ||
* [http://semantic-mediawiki.org/wiki/Help:Installation Installation] | |||
* [http://semantic-mediawiki.org/wiki/Help:Download Download] | |||
* [http://semantic-mediawiki.org/wiki/Help:Configuration Help:Configuration] | |||
'''Notice:''': Read [http://edutechwiki.unige.ch/mediawiki/index.php?title=Semantic_MediaWiki&oldid=50146 this old version], if you have an older MediaWiki or if you prefer manual installs. | |||
=== Fresh install === | |||
(Summer 2015 for MW 1.25, updated summer 2016 for MW 1.26 and 1.27) | |||
* Install composer first if necessary (see below) | |||
* In the your installation (root) directory - and not the extension directory - type: | |||
composer require mediawiki/semantic-media-wiki "~2.4" | |||
composer require mediawiki/maps "*" | |||
composer require mediawiki/semantic-maps "*" | |||
composer require mediawiki/semantic-result-formats "*" | |||
php maintenance/update.php | |||
* Verify: You composer.json file should have something like these lines | |||
.... | |||
"mediawiki/semantic-media-wiki": "~2.4", | |||
"mediawiki/maps": "*", | |||
"mediawiki/semantic-maps": "*", | |||
"mediawiki/semantic-result-formats": "*", | |||
"mediawiki/sub-page-list": "~1.2", | |||
"mediawiki/graph-viz": "^1.6", | |||
"mediawiki/image-map": "@dev" | |||
..... | |||
'''Page Forms''' (formerly called '''Semantic Forms''') | |||
* It is not recommended to install with Composer, rather install manually as explained in [[Page Forms]] | |||
composer require mediawiki/semantic-forms | |||
composer require mediawiki/page-forms | |||
* In LocalSettings.php: | |||
// If needed, define a special namespace, can help if other custom extensions are used. Not necessary for fresh MediaWiki installs | |||
$smwgNamespaceIndex = 108; // Adjust to yours | |||
: Note people [were talking about a [https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/1406 ConfirmEdit] issue, which I could not replicate (good for me...). Maybe because I did set an index ? | |||
// This seems to be still required in summer 2016 for MW 1.26.3 and SMW 2.4.1 | |||
enableSemantics('edutechwiki.unige.ch'); // adjust to yours | |||
=== Old MediaWiki 1.22 and SMW 1.9x installation/upgrade === | |||
After mid-november 2013, you should learn how to use composer, a PHP dependency manager. | |||
==== Prerequisites ==== | |||
* PHP 5.3.2+ | |||
* MySQL 5.0.2+ | |||
* CURL (you should have that) | |||
* MediaWiki 1.22 (nov 2013) or better. | |||
If your server doesn't meet these requirements (in particular a new 1.22 MediaWiki), you should stop reading and find another source of information. | |||
==== Install composer ==== | |||
If you run several wikis, it's probably best to install composer on system level: | |||
cd /some/src | |||
curl -sS https://getcomposer.org/installer | php | |||
mv composer.phar /usr/local/bin/composer | |||
==== Prepare for updating SMW ==== | |||
* Go to your MediaWiki installation (NOT the extension directory) | |||
cd /your-mediawiki-install | |||
* If you already got SMW installed, kill it | |||
rm -r extensions/SemanticMediaWiki | |||
rm -r extensions/Validator | |||
rm -r extensions/DataValues | |||
* Same for SMW extensions, most should be killed (As of Jan 2014, SemanticForms is the notable exception, install it manually !!) | |||
* | |||
rm -r extensions/Maps/ | |||
rm -r extensions/SemanticMaps/ | |||
rm -r extensions/SemanticResultFormats | |||
'''Changes to Localsettings.php''' | |||
(1) kill '''all''' the lines that load SMW and required extensions. You really have to start clean, for example '''kill''' | |||
$ | require_once( "$IP/extensions/DataValues/DataValues.php" ); | ||
require_once( "$IP/extensions/Validator/Validator.php" ); | require_once( "$IP/extensions/Validator/Validator.php" ); | ||
include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" ); | include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php") | ||
(2) Keep the following: | |||
$smwgNamespaceIndex = 108; // Adjust to yours, in case other custom extensions were use before. Not necessary for fresh mediawiki installs | |||
enableSemantics('edutechwiki.unige.ch'); // adjust to yours | enableSemantics('edutechwiki.unige.ch'); // adjust to yours | ||
; | * '''Make damn sure''' that the line defining start of SMW namespaces (e.g. <code>$smwgNamespaceIndex = 108;</code> in our case) is '''the very first line of code that deals with SMW'''. E.g. if PHP sees the line <code>enableSemantics(...)</code> first, it will start numbering SMW extensions at 104 or something and you won't see your properties, forms, etc. defined in your existing wiki. You then may panic and do weird stuff that won't help your wiki very much. | ||
(3) Comment out all other MediaWiki extensions | |||
; | * E.g. maps, semanticMaps, semanticresultformats, etc. | ||
==== (Re)install SMW ==== | |||
* Now get and install SemanticMediaWiki 1.9, plus its dependencies with composer | |||
* Again, '''do not cd to the extensions directory''', keep sitting in the main MW installation directory ! | |||
composer require mediawiki/semantic-media-wiki "~2.0" | |||
* '''Alternatively''', in case you want to use bleeding edge code (sometimes you should, sometimes not) | |||
composer require mediawiki/semantic-media-wiki "dev-master" | |||
* In your MediaWiki installations you now will have: | |||
: A ''vendor'' directory | |||
: Additions to the ''extensions'' directory | |||
* There is no need to edit LocalSetting.php. All extensions will auto-load, i.e. MW 1.22 provides direct support for composer !! However, you later can edit LocalSettings.php to change settings. | |||
==== (Re)configure SMW ==== | |||
php maintenance/update.php | |||
==== Install (some) SMW extensions using the composer ==== | |||
As you can see, it is better not to provide any version information. These extensions should know what version to use with what SMW version. | |||
composer require mediawiki/maps "*" | |||
composer require mediawiki/semantic-maps "*" | |||
composer require mediawiki/semantic-result-formats "*" | |||
; LocalSettings.php | |||
* Again, do '''not''' add any includes. These files are loaded (I believe) trough vendor/autoload.php | |||
==== Add other SMW extension through GIT ==== | |||
<source lang="XML"> | |||
cd extensions | |||
// git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git | |||
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/PageForms | |||
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git | |||
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticDrilldown.git | |||
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git | |||
</source> | |||
Of course, you then have to edit LocalSettings.php to include these files, for example it could look like this: | |||
<source lang="php"> | |||
$smwgNamespaceIndex = 108; | |||
enableSemantics('edutechwiki.unige.ch'); // adjust to yours | |||
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY; | |||
// $smwgShowFactbox = SMW_FACTBOX_HIDDEN; | |||
include_once("$IP/extensions/SemanticForms/SemanticForms.php"); | |||
# If one or more of your fields can contain internal links entered by users (e.g., "This is a [[cat]]") | |||
$smwgLinksInValues = true; | |||
# Semantic Drilldown. Needs yet another namespace | |||
$sdgNamespaceIndex = 118; | |||
include_once("$IP/extensions/SemanticDrilldown/SemanticDrilldown.php"); | |||
# Semantic Forms Inputs | |||
# Is now available through composer (summer 2015) | |||
# require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php"); | |||
# AdminLinks | |||
include_once("$IP/extensions/AdminLinks/AdminLinks.php"); | |||
</source> | |||
=== Upgrading MW 1.22+ / composer-based installations === | |||
* Go to the base directory (not extensions or anything else !!) | |||
cd /your/mediawiki_installation_directory | |||
* (Maybe) update the composer itself | |||
composer self-update | |||
For MW 1.22 or better .... | |||
Typing the following won't work if you already have SMW installed | |||
composer require mediawiki/semantic-media-wiki "~2.0" | |||
In the root directory, edit file <code>composer.json</code> and change the SMW line: | |||
"mediawiki/semantic-media-wiki": "~2.0", | |||
If you do the same for the various Semantic Mediawiki extension, the JSON section could look something like this (but extensions and version numbers may change). It is best to follow instructions on each extension page as shown on the [https://packagist.org/search/?tags=Semantic%20MediaWiki packagist web site] or the mediawiki extension page. | |||
<source lang="javascript"> | |||
"require": { | |||
"php": ">=5.3.2", | |||
"psr/log": "1.0.0", | |||
"mediawiki/semantic-media-wiki": "~2.0", | |||
"mediawiki/semantic-result-formats": "*", | |||
"mediawiki/sub-page-list": "~1.1", | |||
"mediawiki/semantic-maps": "*", | |||
"mediawiki/maps": "*" | |||
"mediawiki/semantic-forms": "^3.4" | |||
}, | |||
</source> | |||
* Update all composer-managed extensions (including the ones that rely on SMW) | |||
composer update | |||
* Run the MW update script (e.g. to change database tables) | |||
php maintenance/update.php | |||
* Sometimes you also have to run the SMW update script, i.e. rebuild all tables | |||
php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v | |||
=== Non standard setups === | |||
From the Readme file: | |||
It is required to set the environment variable MW_INSTALL_PATH | |||
to the root of your MediaWiki installation first. This is also required if | |||
you use a symbolic link from ./extensions/SemanticMediaWiki to the actual | |||
installation directory of SMW. Setting environment variables is different | |||
for different operating systems and shells, but can normally be done from | |||
the command line right before the php call. On Bash(Linux), e.g., one can | |||
use the following call to execute SMW_setup.php with different MW location. | |||
export MW_INSTALL_PATH="/path/to/mediawiki" && php SMW_setup.php | |||
=== Trouble === | |||
If you work with GIT and use the (default) "master" (the development branch), really make sure that all your extensions are match, e.g. you could the "master" development versions. | |||
cd extenstions/extension_X | |||
git pull origin master | |||
It also may happen that you installed a new version that does not work using <code>git pull</code>. In that case: | |||
git tag -l | sort -V | |||
git checkout <tag name> | |||
For example: | |||
cd extensions/SemanticForms | |||
git tag -l | |||
git checkout 2.5.2 | |||
Otherwise, there are various support options: | |||
* Each extension does have a discussion page | |||
* There is a global [https://lists.sourceforge.net/lists/listinfo/semediawiki-user SMW mailing list] | |||
If you get something like: | |||
php maintenance/update.php | |||
MediaWiki 1.31.0 Updater | |||
mediawiki/semantic-media-wiki: 2.5.8 installed, ~2.5 required. | |||
mediawiki/maps: 5.6.0 installed, ~5.1 required. | |||
mediawiki/semantic-result-formats: 2.5.6 installed, ~2.5 required. | |||
mediawiki/sub-page-list: 1.5.0 installed, ~1.5 required. | |||
mediawiki/graph-viz: 3.1.0 installed, * required. | |||
Error: your composer.lock file is not up to date. Run "composer update --no-dev" to install newer dependencies | |||
try: | |||
php maintenance/update.php --skip-external-dependencies | |||
Frankly, this is riculous. I thought that composer would be able to handle minor variantgs. using the ~ syntax. | |||
=== Upgrading === | === Upgrading === | ||
After each version upgrade, you should launch the maintenance script. A slower version also can be run by admins from the special pages. Finally, if you just run the global MW update script in the "normal" maintenance directory, it also will trigger running the SMW update script. | |||
cd extensions/SemanticMediaWiki/maintenance | cd extensions/SemanticMediaWiki/maintenance | ||
php SMW_setup.php | php SMW_setup.php | ||
Upgrading can go wrong, however since all SMW information (at least at our level of use) sits within wiki pages, you will not have to worry about messing up information that sits in semantic mediawiki database tables. If you made mistakes, e.g. killed lines defining namespaces index numbers in LocalSettings.php, simply rebuild all the SMW-related tables. SMW Database tables are just for performance, i.e. they are a secondary store. Just to make sure: Do never ever mess up other tables, we just talk about SMW tables here ! | |||
Furthermore, it cannot hurt to dump the whole database before you upgrade the MW software or just the SMW extensions. I usually do not do that, since I first upgrade a test server or a less critical production wiki. We also got daily backups if things really become bad. The main problem I had with MW/SMW upgrades is just that some less critical extensions stop working. I then usually try to find a fix and if I don't, I'll trash these minor extensions. | |||
See the next point about rebuilding the SMW databases ! | |||
=== Cleaning up / repairing the Semantic MediaWiki tables === | |||
'''Disclaimer''': If the following kills your wiki, erases your hard disk and burns down your office, do not blame me ! Read the documentation at the beginning of the script and evaluate the risks ! | |||
Let's assume that you created lots of useless parameters, that you created weird templates that produce illegal parameters etc. Time to clean up ! Although you could use the tools available in wiki's special pages, it maybe time to play with the maintenance scripts. | |||
Read '''https://www.semantic-mediawiki.org/wiki/Help:RebuildData.php RebuildData.php''' | |||
The rebuild data script will rebuild the database from SMW information found in pages. | |||
The following script, if you use the '''-f''' option, will empty all semantic mediawiki tables and create the data again. Since all information is stored in both normal wiki pages and semantic MediaWiki namespaced pages, e.g. property:, the tables will be rebuilt by going through all wikipages in all namespaces. In other words, by erasing all the database tables, you should not loose any information. | |||
: -f - kill everything | |||
: -d 100 - parse a page every 100 milliseconds | |||
: -v - be verbose | |||
cd SemanticMediaWiki/maintenance | |||
php rebuildData.php -f -d 100 -v | |||
The script may choke on a page with a broken extension. E.g. in this wiki it was [[UML activity diagram]]. This page has ID=4219. If such a thing happens, just move on. Restart the script with the next page, e.g. | |||
php rebuildData.php -d 100 -v -s 4220 | |||
Exemple, refreshing without killing anything, doing it a bit faster and without verbose output. | |||
php rebuildData.php -d 50 | |||
'''The refreshData''' script is deprecated !! | |||
You will notice that all bad properties are gone now if you look at [[special:properties]] | |||
=== The SMW database updating process === | |||
The SMW database should update each time a user does something. | |||
To speed this, up you could run cronjobs. | |||
Read [https://www.semantic-mediawiki.org/wiki/Help:Maintenance Help:Maintenance] | |||
=== Semantic MediaWiki extensions === | === Semantic MediaWiki extensions === | ||
Line 128: | Line 726: | ||
** [http://semantic-mediawiki.org/wiki/Help:Process_format Process format]. See e.g. [http://www.aifb.kit.edu/web/Inproceedings1911 Collaborative Process Development using Semantic MediaWiki] | ** [http://semantic-mediawiki.org/wiki/Help:Process_format Process format]. See e.g. [http://www.aifb.kit.edu/web/Inproceedings1911 Collaborative Process Development using Semantic MediaWiki] | ||
* [ | * [http://www.mediawiki.org/wiki/Extension:Semantic_Maps Semantic Maps] - [http://mapping.referata.com/wiki/Semantic_Maps Semantic Maps] (documentation) | ||
** Installed (soon): See [[Semantic Maps]] | |||
* [http://www.mediawiki.org/wiki/Extension:Semantic_Watchlist Semantic Watchlist] extends Semantic MediaWiki by adding the capability to watch/follow sets of properties for groups of pages (that can be specified with categories and namespaces). | * [http://www.mediawiki.org/wiki/Extension:Semantic_Watchlist Semantic Watchlist] extends Semantic MediaWiki by adding the capability to watch/follow sets of properties for groups of pages (that can be specified with categories and namespaces). | ||
* [http:// | * [https://www.mediawiki.org/wiki/Extension:Survey Surveys extension] (not tested, not sure that is maintained) | ||
* [http://www.mediawiki.org/wiki/Extension:Semantic_Extra_Special_Properties Semantic Extra Special Properties] | |||
** Will add some more built-in properties to pages, so that you could extract more information from all pages, e.g. contributing users, views, etc. (not tested so far) | |||
; Other useful extensions to use with SMW | |||
* [http://www.mediawiki.org/wiki/Extension:MyVariables MyVariables]. This simple extensions defines some extra variables (magic words) you could use, in particular <code><nowiki>{{CURRENTUSER}}</nowiki></code> that you could use for reporting/tracking applications. | |||
* [http://www.mediawiki.org/wiki/Extension:External_Data External Data] (aka "ED"), allows MediaWiki pages to retrieve, filter, and format structure data from one or more sources. These sources can include an external URLs, a regular wiki page, an uploaded file, an LDAP directory and a database. | |||
=== Data import/export === | === Data import/export === | ||
Line 141: | Line 749: | ||
* [http://smwforum.ontoprise.com/ SMW+] is a prepackaged version of MediaWiki/Semantic Wiki described as "semantic enterprise wiki that lets you create and share knowledge with your team." Both a free version and a pro version are available. | * [http://smwforum.ontoprise.com/ SMW+] is a prepackaged version of MediaWiki/Semantic Wiki described as "semantic enterprise wiki that lets you create and share knowledge with your team." Both a free version and a pro version are available. | ||
=== Programming SMW extensions === | |||
Read: | |||
* [http://semantic-mediawiki.org/wiki/Programmer%27s_guide_to_SMW Programmer's guide to SMW] | |||
* [http://semantic-mediawiki.org/wiki/Architecture_guide SMW Architecture guide] | |||
Code documentation: | |||
* http://semantic-mediawiki.org/doc/ | |||
Tutorials and examples: | |||
* [http://semantic-mediawiki.org/wiki/User:Yury_Katkov/programming_examples User:Yury Katkov/programming examples] | |||
* [http://semantic-mediawiki.org/wiki/SMWCon_Fall_2013/Tutorial_day SMWCON Fall 2013 Tutorial Day], e.g. Toni Hermoso Pulido's [https://slid.es/similis/mediawiki-extensions https://slid.es/similis/mediawiki-extensions] and Jeroen De Dauw's [http://jeroendedauw.github.io/slides/smwcon/2013fall/dev/#/ tutorial slides on SMW programming] | |||
== Links == | == Links == | ||
Line 150: | Line 771: | ||
* [http://referata.com/ Referata] (wiki hosting site plus support materials) | * [http://referata.com/ Referata] (wiki hosting site plus support materials) | ||
* [http://smwforum.ontoprise.com/smwforum/index.php/Main_Page SMWforum] | * [http://smwforum.ontoprise.com/smwforum/index.php/Main_Page SMWforum] | ||
=== Events === | |||
* [https://semantic-mediawiki.org/wiki/SMWCon_Fall_2013 SMWCon Fall 2013] | |||
=== Manuals and introductions === | === Manuals and introductions === | ||
Line 163: | Line 788: | ||
* Quick Reference Guide: [http://semantic-mediawiki.org/wiki/File:SMW_quick_reference.png PNG] or [http://semantic-mediawiki.org/wiki/File:SMW_quick_reference.pdf PDF] | * Quick Reference Guide: [http://semantic-mediawiki.org/wiki/File:SMW_quick_reference.png PNG] or [http://semantic-mediawiki.org/wiki/File:SMW_quick_reference.pdf PDF] | ||
; | * http://workingwithmediawiki.com (the book written by Yaron Koren) | ||
* [http://semantic-mediawiki.org/wiki/Help:Repairing_SMW%27s_data Help:Repairing SMW's data]. Since all SMW data is stored in wiki pages, data cannot be truly lost or corrupted. You can easily rebuild the database tables. | |||
* [http://edutechwiki.unige.ch/mediawiki/api.php The API] includes some specific SMW actions] | |||
; Tips | |||
* [http://smw.referata.com/wiki/Category:Tips Tips] at Referata.com | |||
=== Tutorials === | === Tutorials === | ||
Line 170: | Line 803: | ||
* [http://www.slideshare.net/jiaxinwang/smwcon-spring2011-tutorial-applied-semantic-mediawiki Applied SMW] by Jesse Wang et al. (Spring 2011 SMWCon) | * [http://www.slideshare.net/jiaxinwang/smwcon-spring2011-tutorial-applied-semantic-mediawiki Applied SMW] by Jesse Wang et al. (Spring 2011 SMWCon) | ||
* [https://wiki.nci.nih.gov/display/VKC/Introduction+to+Semantic+MediaWiki Introduction to Semantic MediaWiki]. Short intro from the National Cancer Institute. | |||
* [http://creationwiki.org/Help:Semantic_annotation Help:Semantic annotation] | |||
* [http://blog.semantic-web.at/2008/11/05/short-semantic-mediawiki-tutorial/ The Semantic Puzzle], Short Semantic MediaWiki Tutorial (with link to sandbox), November 5, 2008 by Thomas Schandl (but the demo wiki is broken as of July 2013) | |||
* [http://www.linux-magazin.de/Ausgaben/2009/07/Struktur-fuers-Wiki Die Wiki-Erweiterungen Semantic Mediawiki und Semantic Forms], Struktur fürs Wiki, by Rolf Strathewerd, Linux Magazin, July 2009. | |||
* [http://www.heise.de/ct/inhalt/2013/19/158/ Organisationstalent, Wissen verwalten mit Semantic MediaWiki], by Robert Seetzen, C'T Magazin, No 19, 2013. {{ar}}, Euro 4.20 | |||
* [http://clkoerner.com/2012/08/28/use-semantic-mediawiki-semantic-forms-to-create-a-folksonomy-for-tagging-related-pages/ Use Semantic Mediawiki & Semantic Forms to Create a Folksonomy for Tagging Related Pages], Posted on August 28, 2012 by Chris Koerner. | |||
* [http://kontext.fraunhofer.de/haenelt/kurs/folien/Haenelt_SemWikiModelling.pdf Information Modelling With a Semantic MediaWiki] (2008), slides by Karin Hanelt, Fraunhofer. | |||
=== Various === | === Various === | ||
Line 193: | Line 840: | ||
=== Semantic MediaWiki sites === | === Semantic MediaWiki sites === | ||
; Indexes ( | ; Indexes (listed sites below were more or less randomly chosen) | ||
* [http://wikiapiary.com/wiki/Semantic_statistics Semantic Statistics] List and statistics for semantic mediawiki sites at Wikiapiary. | * [http://wikiapiary.com/wiki/Semantic_statistics Semantic Statistics] List and statistics for semantic mediawiki sites at Wikiapiary. | ||
Line 216: | Line 863: | ||
* [http://www.swiss-experiment.ch/ Swiss Experimnet], A platform to enable real-time environmental experiments through wireless sensor networks and a common, modern, generic cyber-infrastructure. | * [http://www.swiss-experiment.ch/ Swiss Experimnet], A platform to enable real-time environmental experiments through wireless sensor networks and a common, modern, generic cyber-infrastructure. | ||
* [http://acawiki.org/Home AcaWiki] enables you to easily post summaries and literature reviews of peer-reviewed research | * [http://acawiki.org/Home AcaWiki] enables you to easily post summaries and literature reviews of peer-reviewed research | ||
* [http://wiki.creativecommons.org/ Creative Commons Wiki] Quote: The purpose of this wiki is to help you learn more about CC and give you a chance to collaborate with us. | * [http://wiki.creativecommons.org/ Creative Commons Wiki] Quote: The purpose of this wiki is to help you learn more about CC and give you a chance to collaborate with us. Read [http://labs.creativecommons.org/2010/09/08/smw-case-study/ Case study of a simple but highly effective use of Semantic MediaWiki on the CC Wiki] by Alex Kozak, September 8th, 2010 | ||
; Computer science and digital design/fabrication | ; Computer science and digital design/fabrication | ||
Line 225: | Line 872: | ||
== Bibliography == | == Bibliography == | ||
See also: [https://semantic-mediawiki.org/wiki/Semantic_MediaWiki_publications Semantic MediaWiki publications] at semantic-mediawiki.org | |||
* Bao, J., Ding, L., & Hendler, J. (2008). Knowledge representation and query in semantic mediawiki: A formal study. Tetherless World Constellation (RPI) Technical Report. [http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.4263&rep=rep1&type=pdf PDF]. (I found this to be a good introduction to the formal aspects of SMW, although some parts are quite heavy..- [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 12:27, 28 June 2013 (CEST)) | |||
* Boulos, Maged N. Kamel (2009). Semantic Wikis: A Comprehensible Introduction with Examples from the Health Sciences, Journal of Emerging Technologies in Web Intelligence, Vol 1, No 1 (2009), 94-96, Aug 2009 [http://ojs.academypublisher.com/index.php/jetwi/article/viewArticle/01019496 doi:10.4304/jetwi.1.1.94-96] | |||
* Dengler, Frank and Hans-Jörg Happel. 2010. Collaborative modeling with semantic MediaWiki. In Proceedings of the 6th International Symposium on Wikis and Open Collaboration (WikiSym '10). ACM, New York, NY, USA, Article 23 , 2 pages. DOI=10.1145/1832772.1832802 http://doi.acm.org/10.1145/1832772.1832802 | * Dengler, Frank and Hans-Jörg Happel. 2010. Collaborative modeling with semantic MediaWiki. In Proceedings of the 6th International Symposium on Wikis and Open Collaboration (WikiSym '10). ACM, New York, NY, USA, Article 23 , 2 pages. DOI=10.1145/1832772.1832802 http://doi.acm.org/10.1145/1832772.1832802 | ||
Line 230: | Line 883: | ||
* García, R. R., Gil, R. R., Gimeno, J. M., Granollers, T. T., López, J. M., Oliva, M. M., & Pascual, A. A. (2010). Semantic wiki for quality management in software development projects. IET Software, 4(6), 386-395. doi:10.1049/iet-sen.2010.0044 | * García, R. R., Gil, R. R., Gimeno, J. M., Granollers, T. T., López, J. M., Oliva, M. M., & Pascual, A. A. (2010). Semantic wiki for quality management in software development projects. IET Software, 4(6), 386-395. doi:10.1049/iet-sen.2010.0044 | ||
* | * Herzig, Daniel M. and Basil Ell: [http://www.aifb.kit.edu/web/Inproceedings3113 ''Semantic MediaWiki in Operation: Experiences with Building a Semantic Portal.''] Proceedings of the 9th International Semantic Web Conference (ISWC-10). Springer 2010. [http://www.aifb.kit.edu/images/8/80/Herzig-SemanticMediaWiki-in-Operation.pdf PDF] | ||
* | * Koren, Yaron (2012). Working with MediaWiki, WikiWorks Press, ISBN 978-0615720302, http://workingwithmediawiki.com/ | ||
* | * Krötzsch, Markus; Denny Vrandecic, Max Völkel, Heiko Haller & Rudi Studer. Semantic Wikipedia. (2007). ''Journal of Web Semantics'' 5, pp. 251-261. Elsevier 2007. | ||
* Krötzsch. M and D. Vrandecic. [http://wikimania2006.wikimedia.org/wiki/Proceedings:DV2 Wikipedia and the Semantic Web, part 2], Second International Wikimedia Conference, Wikimania2006, Cambridge, MA, USA. | * Krötzsch. M and D. Vrandecic. [http://wikimania2006.wikimedia.org/wiki/Proceedings:DV2 Wikipedia and the Semantic Web, part 2], Second International Wikimedia Conference, Wikimania2006, Cambridge, MA, USA. | ||
Line 240: | Line 893: | ||
* Krötzsch. M, D. Vrandecic, M. Völkel, H. Haller, and R. Studer. [http://www.aifb.uni-karlsruhe.de/Publikationen/showPublikation?publ_id=1202 Semantic Wikipedia] (ESWC2006 demo), European Semantic Web Conference, ESWC2006, Budva, Montenegro. Best Poster Award. | * Krötzsch. M, D. Vrandecic, M. Völkel, H. Haller, and R. Studer. [http://www.aifb.uni-karlsruhe.de/Publikationen/showPublikation?publ_id=1202 Semantic Wikipedia] (ESWC2006 demo), European Semantic Web Conference, ESWC2006, Budva, Montenegro. Best Poster Award. | ||
* | * Krötzsch. M, D. Vrandecic, and M. Völkel (2005) [http://www.aifb.uni-karlsruhe.de/Publikationen/showPublikation?publ_id=963 Wikipedia and the Semantic Web - The Missing Links], First International Wikimedia Conference, Wikimania2005, Frankfurt, Germany. | ||
** [http:// | |||
* Krötzsch, M., & Vrandecic, D. (2009). Semantic wikipedia. In Social Semantic Web (pp. 393-421). Springer Berlin Heidelberg. | |||
* Krötzsch, M., & Vrandečić, D. (2011). Semantic mediawiki. In Foundations for the Web of Information and Services (pp. 311-326). Springer Berlin Heidelberg. | |||
* Kumar, S., Schiffer, P. H., & Blaxter, M. (2012). 959 Nematode Genomes: a semantic wiki for coordinating sequencing projects. Nucleic acids research, 40(D1), D1295-D1300. [http://nar.oxfordjournals.org/content/40/D1/D1295.short Abstract/HTML/PDF] (Describes http://www.nematodes.org/nematodegenomes/) | |||
* Millard, Ian, Afraz Jaffri, H. Glaser, and UB. Rodriguez-Castro. [http://eprints.ecs.soton.ac.uk/12869/ Using a Semantic MediaWiki to Interact with a Knowledge Based Infrastructure], International Conference on Knowledge Engineering and Knowledge Management, Podebrady, Czech Republic, 2006. | |||
* Reutelshoefer, J., Lemmerich, F., Haupt, F., & Baumeister, J. (2009). An extensible semantic wiki architecture. In 4th Semantic Wiki Workshop (SemWiki). [http://ceur-ws.org/Vol-464/paper-07.pdf PDF Preprint ?] | |||
* Sateli, B., S. S. Rajivelu, E. Angius, and R. Witte, "ReqWiki: A Semantic System for Collaborative Software Requirements Engineering", The 8th International Symposium on Wikis and Open Collaboration (WikiSym 2012), Linz, Austria : ACM, 08/2012 (Describes [http://www.semanticsoftware.info/reqwiki ReWiki], a software requirements engineerin "bundle" based on SMW) | |||
* Sateli, B., E. Angius, S. S. Rajivelu, and R. Witte, "Can Text Mining Assistants Help to Improve Requirements Specifications?", Mining Unstructured Data (MUD 2012), Kingston, Ontario, Canada, October 17, 2012. | |||
* Schaffert, Sebastian, Joachim Baumeister, François Bry and Malte Kiesel (2008). Semantic Wikis. ''IEEE Software'', 25 (4) 8-11. | |||
* Schaffert, Sebastian; Diana Bischof, Tobias Bürger, Andreas Gruber, Wolf Hilzensauer and Sandra Schaffert (2006). Learning with Semantic Wikis. In: Proceedings of the 1st Workshop on Semantic Wikis | |||
* Rutledge, Lloyd and Rineke Oostenrijk (2011). Applying and Extending Semantic Wikis for Semantic Web Courses. International Workshop on eLearning Approaches for the Linked Data Age, Heraclion, Crete, Greece. | |||
* Vrandecic, Denny; Yaron Koren, Daniel Kinzler (2011). [http://wikimania2011.wikimedia.org/wiki/Submissions/Towards_a_Semantic_Wikipedia Towards a Semantic Wikipedia], Open submission for Wikimania 2011. (Abstract only) | |||
* Völkel, M et al. (2006). [http://www.arbeitskreis-wissensmanagement.org/efiles/AK-Sitzungen/20060330_ontoprise_voelkel-web20-wiki.pdf Web 2.0, Social Tagging & Co] at the [http://www.arbeitskreis-wissensmanagement.org/index2479.htm Presentation at AKWM], Karlsruhe. | * Völkel, M et al. (2006). [http://www.arbeitskreis-wissensmanagement.org/efiles/AK-Sitzungen/20060330_ontoprise_voelkel-web20-wiki.pdf Web 2.0, Social Tagging & Co] at the [http://www.arbeitskreis-wissensmanagement.org/index2479.htm Presentation at AKWM], Karlsruhe. | ||
* | * Völkel. M, M. Krötzsch, D. Vrandecic, H. Haller, R. Studer. [http://www.aifb.uni-karlsruhe.de/Publikationen/showPublikation?publ_id=1055 Semantic Wikipedia], presented at WWW2006 | ||
** [http://km.aifb.uni-karlsruhe.de/ws/semwiki2006/smw/2006-05-26-WWW2006-slides.pdf slides as PDF] | |||
* | * Yao, W. (2012). Specifying semantic information on functional requirements. MA Thesis. University of Tampere ([http://tutkielmat.uta.fi/pdf/gradu05971.pdf PDF]) | ||
Line 253: | Line 928: | ||
[[Category: Knowledge representation]] | [[Category: Knowledge representation]] | ||
[[Category: Knowledge and idea management]] | [[Category: Knowledge and idea management]] | ||
[[Category: Wikis]] | [[Category: Wikis]] | ||
[[Category: Semantic Mediawiki]] |
Latest revision as of 09:27, 12 September 2018
Category:MediaWiki extension Semantic MediaWiki | |
---|---|
Extension name | Semantic MediaWiki |
About this article / disclaimer | |
Logo | |
Screenshot | [[Image:|135px]] |
Location of the main author | Oxford, England |
Coordinates of the main authors | 51.752013, -1.25785 |
Developers | Markus Krötzsch, Denny Vrandecic, Jeroen De Dauw, others |
Licences | |
Description | Semantic MediaWiki is an extension for managing structured data in your wiki and for querying that data to create dynamic representations: tables, timelines, maps, lists, etc. |
Mediawiki requirements | [[Needs MediaWiki versions::Any recent version.
However, we suggest using MW 1.22 (dec 2013). This version includes support for Composer, a dependency manager that will ease installation.]] |
Dependencies | Validator, ParamProcessor |
Related extensions (documented here) | Semantic Drilldown, Semantic Forms, Semantic Forms Inputs, Semantic Maps, Semantic Result Formats |
Related extensions | |
Discussion | |
Language support | Many |
Status | stable |
First release date | 2005/01/01 |
Last release date (as of 2014/05/02!) | 2014/04/28 |
Last version number | 1.9.2 (40ea19e) |
Programming language | PHP |
Alternatives | |
Website | home page |
Publications | |
Support websites | web site |
Example websites | |
Last edited | 2014/05/02 |
Introduction
“Semantic MediaWiki (SMW) is an extension of Mediawiki – the wiki application best known for powering Wikipedia – that helps to search, organise, tag, browse, evaluate, and share the wiki's content. While traditional wikis contain only text which computers can neither understand nor evaluate, SMW adds semantic annotations that allow a wiki to function as a collaborative database. Semantic MediaWiki was first released in 2005, and currently has over ten developers, and is in use on hundreds of sites. In addition, a large number of related extensions have been created that extend the ability to edit, display and browse through the data stored by SMW: the term "Semantic MediaWiki" is sometimes used to refer to this entire family of extensions. Semantic MediaWiki has been funded in part by projects of the Framework Programmes (FP) of the European Union, SEKT and ACTIVE and by project Halo.” (Introduction to Semantic MediaWiki, retrieved 14:31, 24 August 2011 (CEST))
According to Semantic MediaWiki, “is currently in active use in hundreds of sites, in many languages, around the world, including Fortune 500 companies, biomedical projects, government agencies and consumer directories”.
See also:
- Semantic Forms
- Semantic Drilldown
- Semantic Result Formats
- Semantic Maps
- Semantic MediaWiki special pages (a list of useful special pages)
Semantic properties
Properties and semantic web triplets
At the core of Semantic MediaWiki are so-called properties. Properties can be understood as "categories of information" and they are encoded in a way that a machine can understand. If you use a property + value in a given page, you implicitly create a so-called triplet.
For example, if we would like to add the information that Semantic MediaWiki is related to Semantic Forms we get the following triplet:
Semantic MediaWiki - Is related to - Semantic Forms (Subject) (predicate) (object)
In Semantic MediaWiki, we create triplets by adding code defining property/value pair to a page. Therefore, with respect to the above example:
- This page (Semantic MediaWiki) is the subject that we describe with a property
- Is related is the property name, i.e. the so-called predicate
- The Semantic Forms page is the value of the property and represents the object
The corresponding wiki code looks likes this:
[[Is related to::Semantic Forms]]
Similarities with RDF
In the Resource Description Framework RDF, a fragment like the following defines the same relationship.
<swivt:Subject rdf:about="http://edutechwiki.unige.ch/en/Special:URIResolver/Semantic_MediaWiki">
<property:Is_related_to rdf:resource="http://edutechwiki.unige.ch/en/Special:URIResolver/Semantic_Forms"/>
</swivt:Subject>
In some ways, Semantic MediaWiki is the Wiki equivalent of RDF. Semantic data of a page can be exported as RDF like this:
[http://edutechwiki.unige.ch/en/Special:ExportRDF/Semantic_MediaWiki RDF feed]
, e.g. click on RDF feed
Property types
Properties in a Semantic MediaWikis define typed data, in a similar way as in object-oriented programming. Properties are used with the [[property_name::property_value]]
syntax. By default, the value of a property is a wiki page, i.e. default data type of a property is simply a wiki page.
MediaWiki [[is a:: Wiki]]
The following example shows a value that is an URL. However, this does not yet mean the data type of Has website
is an URL. Since default values for properties are wiki pages, we must explicitly create and edit the property page as explained further down.
[[Has website:: http://www.semantic-mediawiki.org/wiki/Semantic_MediaWiki]]
The above code will be shown as http://www.semantic-mediawiki.org/wiki/Semantic MediaWiki
,i.e. the reader will see a clickable URL. Let's now look at property types.
Data types for property types
There exist several property types, for example:
- Page (a wiki page, this the value by default, i.e. if you don't define a data type, a property value will display as "blue" or "red" link to a normal wiki page)
- String (a short text)
- Text (a longer text)
- Code (same but pre-formatted)
- URL (various kinds of URIs, including http://)
- Number
- Date
- Enumeration (lists of values, i.e. of all the other types)
- Boolean
Manual coding
- Each property is defined through a page in the properties namespace. To create a property with aproperty_name and a value, just use the following syntax in any other page:
[[property_name:: your_property_value]]
- You then can type the property. By default a property is of type page, i.e. it will link to a normal wiki page. For example [[is a:: Wiki]] will declare that this is a Wiki and then link to the page Wiki like this: Wiki
To define a property and its type there are three methods
(1a) Create a property instance with a value, then create/hand code the property page
- Create the property using
[[property_name:: your_property_value]]
or use templates as explained in the Semantic Forms article - Create or edit the property:your_property page and add a type declaration like this:
This is a property of type [[Has type::URL]].
(1b) Use the Create with Form
- Same principle, but it will allow selecting a data type from a pull down list.
(2) Use Special:CreateProperty
The easiest way to create a property (including its page and the type declaration) is to use the form in Special:CreateProperty "special" page.
The following screenshot shows a property page for property that is being used in page, but that is not defined yet. Do define it, either use method 1a or 1b as explained just above.
..............
Displaying properties
(under construction ...)
The way a property will be displayed depends on its type and an additional parameter. By default, only the value will be shown, either as simple text or as a link.
Values that are not links
We defined a data type of property has accronym as string, therefore the value will not show as a wiki link (as per default data type): The following table shows what happens:
input | output | description |
---|---|---|
[[has acronym::SMW]] | SMW | Most typical use of properties |
[[has acronym::SMW::TheFuture::]] | SMW | Defining two values (shortcut) |
[[has acronym::SMW| ]] | Value will not be shown | |
[[has acronym::SMW|MWS]] | MWS | An alternative text will be shown |
[[:has acronym :: SMW]] | has acronym :: SMW | Creates a link instead of a property (useless) |
Annotated values
- The Swiss Grading scale goes from 0 to [[grading scale:=6]]
- Gives: The Swiss Grading scale goes from 0 to 6
Finding properties
There are several options that could help finding properties.
- Default tools
- Extensions that help browsing / listing
- Semantic_Drilldown extension
- Extension:AkAPI allows to list properties of categories, a page and show values of certain attibutes.
Inline queries
Semantic Mediawiki includes a query language for semantic search. According to the manual (7/2013), it can be used in three contexts:
- Through the form of the Special:Ask page,
- in so-called concepts, i.e. saved queries,
- and in inline queries.
Most frequent use seem to be inline queries.
Queries usually define three things:
- Which page(s) to select. Read Selecting pages (semantic-mediawiki.org)
- What information to display about those pages. Read Displaying information (semantic-mediawiki.org)
- How the results should be formatted. Additional extensions like Semantic Result Formats add further possibilities.
Inline queries dynamically include query results as in the examples below. This functionality is implemented with so-called parser functions.
- The #ask function takes a number of parameters, in particular: page selection, information to display, and how.
- the #show function displays information for a single page, i.e. it's a kind of shortcut for the #ask function.
One simple query would list all pages in a category. The following code:
{{#ask: [[Category: MediaWiki extension]]}}
produces a simple line:
- Maps (MediaWiki extension), Mediawiki collection extension installation, Page Forms, Semantic Drilldown, Semantic Forms Inputs, Semantic Maps, Semantic MediaWiki, Semantic Result Formats, VisualEditor
Simple queries
By definition, various query clauses are combined with an AND operator
The following code selects all pages in the category software information and that include a property value Yaron Koren for the property Is developed by.
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]]
| ?Has name
| format=ul
}}
It will produce this:
- Maps (MediaWiki extension) (Has name: Maps)
- Mediawiki collection extension installation (Has name: Collection)
- Page Forms (Has name: Semantic Forms)
- Semantic Drilldown (Has name: Semantic Drilldown)
- Semantic Forms Inputs (Has name: Semantic Forms Inputs)
- Semantic Maps (Has name: Semantic Maps)
- Semantic MediaWiki (Has name: Semantic MediaWiki)
- Semantic Result Formats (Has name: Semantic Result Formats)
We also can use wildcards, e.g. if we wanted to list all pages that do include a property "Is developed by", we would use the following expression:
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::+]]
| ?Has name
| format=ul
}}
It will produce this:
- Maps (MediaWiki extension) (Has name: Maps)
- Mediawiki collection extension installation (Has name: Collection)
- Page Forms (Has name: Semantic Forms)
- Semantic Drilldown (Has name: Semantic Drilldown)
- Semantic Forms Inputs (Has name: Semantic Forms Inputs)
- Semantic Maps (Has name: Semantic Maps)
- Semantic MediaWiki (Has name: Semantic MediaWiki)
- Semantic Result Formats (Has name: Semantic Result Formats)
Ask syntax
Overview
Roughly speaking, syntax of #ask:
is the following: It it includes three groups of information:
- Ask for pages that satisfy some conditions
- Tell which information to show, e.g. property/values,
- Define how to render the results, e.g. display items as a table or graph, sort results, add labels and table headers etc. See Semantic Result Formats for a more detailed introduction.
{{#ask
search_clause_1
search_clause_2
......
| ?Information_1 to display
| ?Information_2 to display
| ?......
| Result_format_parameter 1 = x
| Result_format_parameter 2 = y
|....
}}
By default, queries will return a list wiki pages (i.e. without telling which other information to show and whether the page itself should be skipped).
Search conditions (clauses) can include property/values (including wildcards and comparators), categories and some other stuff. In addition, you can use disjunctions (or's).
Searching within categories and pages
To search within a category and all subcategories, simply use the normal wiki syntax, e.g.
[[Category: MediaWiki extension]]
A query including just this condition would return all the pages in the MediaWiki extension'. For example, the query
{{#ask: [[Category: MediaWiki extension]]}}
produces this list: Maps (MediaWiki extension), Mediawiki collection extension installation, Page Forms, Semantic Drilldown, Semantic Forms Inputs, Semantic Maps, Semantic MediaWiki, Semantic Result Formats, VisualEditor
Notice: This makes me wonder what happens if you have circular category structures ...
Searching for property values
Property conditions can take several forms, i.e. define a value, use a wildcard, or include comparators
Simple property value search
To search for a property with a given value, use the normal property syntax, e.g.
[[Developed with::MediaWiki software]]
The query {{#ask: [[Developed with::MediaWiki software]]}}
produces this list of pages: CS4CS, Transcribe Bentham
Wildcards
- Use a + for wildcards
The query {{#ask: [[Supports languages::+]]}}
produces this list of pages: Maps (MediaWiki extension), Mediawiki, Mediawiki collection extension installation, Page Forms, Semantic Drilldown, Semantic MediaWiki, Some software
See also the ~
(like) operator below for string comparison.
Comparators
Comparators work with property values and they are placed after the ::
in property conditions.
- >> and <<: "greater than" and "less than"
- > and <: "greater than or equal" and "less than or equal"
- However, if $smwStrictComparators] = true;, you get normal behavior, i.e. "greater than" and "less than"
- ≥ and ≤: "greater than or equal" and "less than or equal"
- !: "not" ("unequal")
- ~: «like» comparison for strings.
- In the comparison sting you can use "*" to match a chain of characters and "?" to match any single character
- !~: «not like» comparison for strings
The query {{#ask: [[Was last edited::>1 September 2013]]}}
produces this list of pages: Semantic MediaWiki, Semantic Result Formats, VisualEditor
The query {{#ask: [[Has field of science::~bio*]]}}
produces this list of pages: Budburst, Notes from Nature, Plankton Portal, Worm Watch Lab, i.e. it will return pages whose Has field of science
property includes at least one "bio". Below, a table that also lists the property values found
Has field of science Budburst biology Notes from Nature biology
taxonomy
biological classificationPlankton Portal biology
biological oceanography
planktology
climatologyWorm Watch Lab biology
genetics
medicine
neuroscience
Some comparisons can be hairy, e.g. values that are rounded for display, coordinates and such.
Subqueries
<q> .... </q>
Examples:
Displaying results
Read the main article: Semantic Result Formats for more information about this topic, in particular if you are interested in visualizations made with JavaScript libraries.
By default, results that include more than one property to be shown are shown as a table. The following code selects the same pages as above, but also displays has last revision number values.
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]]
| ?Has name
| ?has last revision number
| ?Is developed by
}}
produces this:
Has name | Has last revision number | Is developed by | |
---|---|---|---|
Page Forms | Semantic Forms | 2.6 (Dec 2013) | Yaron Koren Stephan Gambke others |
Semantic Drilldown | Semantic Drilldown | 1.2.5 (June 2013) | Yaron Koren David Loomer |
Semantic Forms Inputs | Semantic Forms Inputs | 0.7 | Stephan Gambke Yaron Koren Jeroen De Dauw Sanyam Goyal Yury Katkov others |
Semantic Result Formats | Semantic Result Formats | 1.9.1 alpha (9482833) | Jeroen De Dauw Frank Dengler Steren Giannini James Hong Kong Fabian Howahl Yaron Koren Markus Krötzsch David Loomer Joel Natividad Denny Vrandecic Nathan Yergler others |
Semantic Result Formats allows to produce graphics. The following displays all pages where Yaron Koren is defined as developer plus the participations of other developers.
{{#ask: [[Category: MediaWiki extension]] [[Is developed by::Yaron Koren]]
| ?Is developed by
| distribution=yes
| min=0
| format=jqplotchart
| mainlabel=-
}}
produces this:
Read more in Inline queries, Displaying information, Help:Semantic templates and Result formats (Semantic-Mediawiki.org)
Query operators
SMW queries can include comparators and allows OR (disjunctions)
- Read Help:Selecting pages
Troubleshooting
Use the debug option to test your #ask expression
{{#ask:[[Category:tutoriel]]
|?....
|format=debug
}}
Be aware that by default inline #ask only returns 50 results. Use the limit=..
parameter to change this. Alternatively reset the value of $smwgQDefaultLimit.
Special properties and compound data
(needs to be completed ....)
Special properties
Special properties are automatically generated by the system and have all sorts of functions. By default, these properties are not yet defined. In order to make use of them, we suggest the following procedure:
- List all properties using Special:Properties
- Hover the mouse over the red links, the wiki will tell if it's a special property
- Click on the red link
- Create with form
- Select type=text (not so sure about this....)
- See also: Semantic MediaWiki special pages (a list of useful special pages)
Good for debugging:
- Property:Has improper value for: Lists pages that have illegal values for properties.
Understanding were you get your values from:
Compound data
(this section needs to be written)
SMW has a page-based approach. This makes it difficult with data like "the teacher owns 3 bananas", i.e. he "has bananas" and "he has 3"
You either can use subobjects or semantic internal objects to deal with this problem. Both have the same syntax, but work differently.
{{#subobject:Owns row|Owns fruit=bananas |Has quantity=4}}
{{#set_internal:Is row in possions|Owns fruit=tomatoes|Has quantity=4}}
Semantic MediaWiki software
Most semantic MediaWiki sites make use of a whole range of extensions that are built on top of the basic Semantic MediaWiki infrastructure. For exemple, a popular extension is Semantic Forms.
Read official documentation & download information:
Notice:: Read this old version, if you have an older MediaWiki or if you prefer manual installs.
Fresh install
(Summer 2015 for MW 1.25, updated summer 2016 for MW 1.26 and 1.27)
- Install composer first if necessary (see below)
- In the your installation (root) directory - and not the extension directory - type:
composer require mediawiki/semantic-media-wiki "~2.4" composer require mediawiki/maps "*" composer require mediawiki/semantic-maps "*" composer require mediawiki/semantic-result-formats "*" php maintenance/update.php
- Verify: You composer.json file should have something like these lines
.... "mediawiki/semantic-media-wiki": "~2.4", "mediawiki/maps": "*", "mediawiki/semantic-maps": "*", "mediawiki/semantic-result-formats": "*", "mediawiki/sub-page-list": "~1.2", "mediawiki/graph-viz": "^1.6", "mediawiki/image-map": "@dev" .....
Page Forms (formerly called Semantic Forms)
- It is not recommended to install with Composer, rather install manually as explained in Page Forms
composer require mediawiki/semantic-forms composer require mediawiki/page-forms
- In LocalSettings.php:
// If needed, define a special namespace, can help if other custom extensions are used. Not necessary for fresh MediaWiki installs $smwgNamespaceIndex = 108; // Adjust to yours
- Note people [were talking about a ConfirmEdit issue, which I could not replicate (good for me...). Maybe because I did set an index ?
// This seems to be still required in summer 2016 for MW 1.26.3 and SMW 2.4.1 enableSemantics('edutechwiki.unige.ch'); // adjust to yours
Old MediaWiki 1.22 and SMW 1.9x installation/upgrade
After mid-november 2013, you should learn how to use composer, a PHP dependency manager.
Prerequisites
- PHP 5.3.2+
- MySQL 5.0.2+
- CURL (you should have that)
- MediaWiki 1.22 (nov 2013) or better.
If your server doesn't meet these requirements (in particular a new 1.22 MediaWiki), you should stop reading and find another source of information.
Install composer
If you run several wikis, it's probably best to install composer on system level:
cd /some/src curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer
Prepare for updating SMW
- Go to your MediaWiki installation (NOT the extension directory)
cd /your-mediawiki-install
- If you already got SMW installed, kill it
rm -r extensions/SemanticMediaWiki rm -r extensions/Validator rm -r extensions/DataValues
- Same for SMW extensions, most should be killed (As of Jan 2014, SemanticForms is the notable exception, install it manually !!)
rm -r extensions/Maps/ rm -r extensions/SemanticMaps/ rm -r extensions/SemanticResultFormats
Changes to Localsettings.php
(1) kill all the lines that load SMW and required extensions. You really have to start clean, for example kill
require_once( "$IP/extensions/DataValues/DataValues.php" ); require_once( "$IP/extensions/Validator/Validator.php" ); include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php")
(2) Keep the following:
$smwgNamespaceIndex = 108; // Adjust to yours, in case other custom extensions were use before. Not necessary for fresh mediawiki installs enableSemantics('edutechwiki.unige.ch'); // adjust to yours
- Make damn sure that the line defining start of SMW namespaces (e.g.
$smwgNamespaceIndex = 108;
in our case) is the very first line of code that deals with SMW. E.g. if PHP sees the lineenableSemantics(...)
first, it will start numbering SMW extensions at 104 or something and you won't see your properties, forms, etc. defined in your existing wiki. You then may panic and do weird stuff that won't help your wiki very much.
(3) Comment out all other MediaWiki extensions
- E.g. maps, semanticMaps, semanticresultformats, etc.
(Re)install SMW
- Now get and install SemanticMediaWiki 1.9, plus its dependencies with composer
- Again, do not cd to the extensions directory, keep sitting in the main MW installation directory !
composer require mediawiki/semantic-media-wiki "~2.0"
- Alternatively, in case you want to use bleeding edge code (sometimes you should, sometimes not)
composer require mediawiki/semantic-media-wiki "dev-master"
- In your MediaWiki installations you now will have:
- A vendor directory
- Additions to the extensions directory
- There is no need to edit LocalSetting.php. All extensions will auto-load, i.e. MW 1.22 provides direct support for composer !! However, you later can edit LocalSettings.php to change settings.
(Re)configure SMW
php maintenance/update.php
Install (some) SMW extensions using the composer
As you can see, it is better not to provide any version information. These extensions should know what version to use with what SMW version.
composer require mediawiki/maps "*" composer require mediawiki/semantic-maps "*" composer require mediawiki/semantic-result-formats "*"
- LocalSettings.php
- Again, do not add any includes. These files are loaded (I believe) trough vendor/autoload.php
Add other SMW extension through GIT
cd extensions
// git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/PageForms
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticFormsInputs.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticDrilldown.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git
Of course, you then have to edit LocalSettings.php to include these files, for example it could look like this:
$smwgNamespaceIndex = 108;
enableSemantics('edutechwiki.unige.ch'); // adjust to yours
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY;
// $smwgShowFactbox = SMW_FACTBOX_HIDDEN;
include_once("$IP/extensions/SemanticForms/SemanticForms.php");
# If one or more of your fields can contain internal links entered by users (e.g., "This is a [[cat]]")
$smwgLinksInValues = true;
# Semantic Drilldown. Needs yet another namespace
$sdgNamespaceIndex = 118;
include_once("$IP/extensions/SemanticDrilldown/SemanticDrilldown.php");
# Semantic Forms Inputs
# Is now available through composer (summer 2015)
# require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php");
# AdminLinks
include_once("$IP/extensions/AdminLinks/AdminLinks.php");
Upgrading MW 1.22+ / composer-based installations
- Go to the base directory (not extensions or anything else !!)
cd /your/mediawiki_installation_directory
- (Maybe) update the composer itself
composer self-update
For MW 1.22 or better ....
Typing the following won't work if you already have SMW installed
composer require mediawiki/semantic-media-wiki "~2.0"
In the root directory, edit file composer.json
and change the SMW line:
"mediawiki/semantic-media-wiki": "~2.0",
If you do the same for the various Semantic Mediawiki extension, the JSON section could look something like this (but extensions and version numbers may change). It is best to follow instructions on each extension page as shown on the packagist web site or the mediawiki extension page.
"require": {
"php": ">=5.3.2",
"psr/log": "1.0.0",
"mediawiki/semantic-media-wiki": "~2.0",
"mediawiki/semantic-result-formats": "*",
"mediawiki/sub-page-list": "~1.1",
"mediawiki/semantic-maps": "*",
"mediawiki/maps": "*"
"mediawiki/semantic-forms": "^3.4"
},
- Update all composer-managed extensions (including the ones that rely on SMW)
composer update
- Run the MW update script (e.g. to change database tables)
php maintenance/update.php
- Sometimes you also have to run the SMW update script, i.e. rebuild all tables
php extensions/SemanticMediaWiki/maintenance/SMW_refreshData.php -d 50 -v
Non standard setups
From the Readme file:
It is required to set the environment variable MW_INSTALL_PATH to the root of your MediaWiki installation first. This is also required if you use a symbolic link from ./extensions/SemanticMediaWiki to the actual installation directory of SMW. Setting environment variables is different for different operating systems and shells, but can normally be done from the command line right before the php call. On Bash(Linux), e.g., one can use the following call to execute SMW_setup.php with different MW location.
export MW_INSTALL_PATH="/path/to/mediawiki" && php SMW_setup.php
Trouble
If you work with GIT and use the (default) "master" (the development branch), really make sure that all your extensions are match, e.g. you could the "master" development versions.
cd extenstions/extension_X git pull origin master
It also may happen that you installed a new version that does not work using git pull
. In that case:
git tag -l | sort -V git checkout <tag name>
For example:
cd extensions/SemanticForms git tag -l git checkout 2.5.2
Otherwise, there are various support options:
- Each extension does have a discussion page
- There is a global SMW mailing list
If you get something like:
php maintenance/update.php MediaWiki 1.31.0 Updater
mediawiki/semantic-media-wiki: 2.5.8 installed, ~2.5 required. mediawiki/maps: 5.6.0 installed, ~5.1 required. mediawiki/semantic-result-formats: 2.5.6 installed, ~2.5 required. mediawiki/sub-page-list: 1.5.0 installed, ~1.5 required. mediawiki/graph-viz: 3.1.0 installed, * required. Error: your composer.lock file is not up to date. Run "composer update --no-dev" to install newer dependencies
try:
php maintenance/update.php --skip-external-dependencies
Frankly, this is riculous. I thought that composer would be able to handle minor variantgs. using the ~ syntax.
Upgrading
After each version upgrade, you should launch the maintenance script. A slower version also can be run by admins from the special pages. Finally, if you just run the global MW update script in the "normal" maintenance directory, it also will trigger running the SMW update script.
cd extensions/SemanticMediaWiki/maintenance php SMW_setup.php
Upgrading can go wrong, however since all SMW information (at least at our level of use) sits within wiki pages, you will not have to worry about messing up information that sits in semantic mediawiki database tables. If you made mistakes, e.g. killed lines defining namespaces index numbers in LocalSettings.php, simply rebuild all the SMW-related tables. SMW Database tables are just for performance, i.e. they are a secondary store. Just to make sure: Do never ever mess up other tables, we just talk about SMW tables here !
Furthermore, it cannot hurt to dump the whole database before you upgrade the MW software or just the SMW extensions. I usually do not do that, since I first upgrade a test server or a less critical production wiki. We also got daily backups if things really become bad. The main problem I had with MW/SMW upgrades is just that some less critical extensions stop working. I then usually try to find a fix and if I don't, I'll trash these minor extensions.
See the next point about rebuilding the SMW databases !
Cleaning up / repairing the Semantic MediaWiki tables
Disclaimer: If the following kills your wiki, erases your hard disk and burns down your office, do not blame me ! Read the documentation at the beginning of the script and evaluate the risks !
Let's assume that you created lots of useless parameters, that you created weird templates that produce illegal parameters etc. Time to clean up ! Although you could use the tools available in wiki's special pages, it maybe time to play with the maintenance scripts.
Read https://www.semantic-mediawiki.org/wiki/Help:RebuildData.php RebuildData.php
The rebuild data script will rebuild the database from SMW information found in pages.
The following script, if you use the -f option, will empty all semantic mediawiki tables and create the data again. Since all information is stored in both normal wiki pages and semantic MediaWiki namespaced pages, e.g. property:, the tables will be rebuilt by going through all wikipages in all namespaces. In other words, by erasing all the database tables, you should not loose any information.
- -f - kill everything
- -d 100 - parse a page every 100 milliseconds
- -v - be verbose
cd SemanticMediaWiki/maintenance php rebuildData.php -f -d 100 -v
The script may choke on a page with a broken extension. E.g. in this wiki it was UML activity diagram. This page has ID=4219. If such a thing happens, just move on. Restart the script with the next page, e.g.
php rebuildData.php -d 100 -v -s 4220
Exemple, refreshing without killing anything, doing it a bit faster and without verbose output.
php rebuildData.php -d 50
The refreshData script is deprecated !!
You will notice that all bad properties are gone now if you look at special:properties
The SMW database updating process
The SMW database should update each time a user does something.
To speed this, up you could run cronjobs.
Read Help:Maintenance
Semantic MediaWiki extensions
- Extension:Semantic Forms is an extension to Semantic MediaWiki that allows users to add, edit and query structure data using forms.
- Installed in this wiki, see also: Semantic Forms
- Semantic Drilldown provides a page for drilling down through a site's data, using categories and filters on semantic properties.
- Semantic Result Formats is a Semantic MediaWiki extension that bundles a number of further result formats for SMW's inline queries. It supports formats such as graphing, plotting, timelines, etc. Examples:
- Semantic Maps - Semantic Maps (documentation)
- Installed (soon): See Semantic Maps
- Semantic Watchlist extends Semantic MediaWiki by adding the capability to watch/follow sets of properties for groups of pages (that can be specified with categories and namespaces).
- Surveys extension (not tested, not sure that is maintained)
- Semantic Extra Special Properties
- Will add some more built-in properties to pages, so that you could extract more information from all pages, e.g. contributing users, views, etc. (not tested so far)
- Other useful extensions to use with SMW
- MyVariables. This simple extensions defines some extra variables (magic words) you could use, in particular
{{CURRENTUSER}}
that you could use for reporting/tracking applications.
- External Data (aka "ED"), allows MediaWiki pages to retrieve, filter, and format structure data from one or more sources. These sources can include an external URLs, a regular wiki page, an uploaded file, an LDAP directory and a database.
Data import/export
- Support for RDF triplestores (via SPARQL)
SMW packaged services and distributions
- SMW+ is a prepackaged version of MediaWiki/Semantic Wiki described as "semantic enterprise wiki that lets you create and share knowledge with your team." Both a free version and a pro version are available.
Programming SMW extensions
Read:
Code documentation:
Tutorials and examples:
- User:Yury Katkov/programming examples
- SMWCON Fall 2013 Tutorial Day, e.g. Toni Hermoso Pulido's https://slid.es/similis/mediawiki-extensions and Jeroen De Dauw's tutorial slides on SMW programming
Links
Official other important SMW sites
- SMW - Semantic MediaWiki
- SMW Community Wiki
- Referata (wiki hosting site plus support materials)
- SMWforum
Events
Manuals and introductions
See also: User manual, which includes additional links
- Official
- User manual (Entry page)
- Admin manual (Entry page)
- http://workingwithmediawiki.com (the book written by Yaron Koren)
- Help:Repairing SMW's data. Since all SMW data is stored in wiki pages, data cannot be truly lost or corrupted. You can easily rebuild the database tables.
- The API includes some specific SMW actions]
- Tips
- Tips at Referata.com
Tutorials
- Mediawiki and Semantic MediaWiki tutorial.pdf (Spring 2011 SMWCon)
- Applied SMW by Jesse Wang et al. (Spring 2011 SMWCon)
- Introduction to Semantic MediaWiki. Short intro from the National Cancer Institute.
- The Semantic Puzzle, Short Semantic MediaWiki Tutorial (with link to sandbox), November 5, 2008 by Thomas Schandl (but the demo wiki is broken as of July 2013)
- Die Wiki-Erweiterungen Semantic Mediawiki und Semantic Forms, Struktur fürs Wiki, by Rolf Strathewerd, Linux Magazin, July 2009.
- Organisationstalent, Wissen verwalten mit Semantic MediaWiki, by Robert Seetzen, C'T Magazin, No 19, 2013. (Access restricted), Euro 4.20
- Use Semantic Mediawiki & Semantic Forms to Create a Folksonomy for Tagging Related Pages, Posted on August 28, 2012 by Chris Koerner.
- Information Modelling With a Semantic MediaWiki (2008), slides by Karin Hanelt, Fraunhofer.
Various
- Semantic MediaWiki (Wikipedia)
- Semantic MediaWiki vs. Sharepoint at Wikiworks.com
- blog (Jeroen De Dauw, a SWM key developer, interesting posts)
- Semantic MediaWiki page at TechPresentations.org (includes some slides, etc.)
- New York Semantic Web Meetup (last updated 2010, includes pointers to events)
- SMW overview (short intro, referring to tables)
- SMWCon also known as the Semantic MediaWiki Conference, is a twice-yearly gathering for users, developers and enthusiasts of Semantic MediaWiki,
- W3C Semantic Web wiki (not directly related to SWM, but they use a SWM forms, e.g. a Tool template)
Semantic MediaWiki sites
- Indexes (listed sites below were more or less randomly chosen)
- Semantic Statistics List and statistics for semantic mediawiki sites at Wikiapiary.
- MediaWiki sites (Index) available at SMW Community Wiki
- Sites using Semantic MediaWiki (Index)
- Testimonials (not many)
- Plants
- Gardenology.org - Plant & Garden Wiki Encyclopedia is a complete plant and garden wiki encyclopedia. So far we have 21,980 plant entries and other articles written and edited by gardeners from around the globe (June 2013).
- Practical Plants. Practical Plants is a collaboratively edited encyclopedia and database of information on plants cultivated with a practical intention. Over 7400 plant articles covering edible, medicinal and material uses, propagation and cultivation information, plant associations and polycultures, and everything else you need to know to grow and benefit from practical plants.
- food finds
- Pest Information Wiki includes 117299 research publications and other information on pests, diseases and weeds. Organized by the International Society for Pest Information (ISPI)
- Biology
- SNPedia, a wiki investigating human genetics.
- Research and artifacts
- Swiss Experimnet, A platform to enable real-time environmental experiments through wireless sensor networks and a common, modern, generic cyber-infrastructure.
- AcaWiki enables you to easily post summaries and literature reviews of peer-reviewed research
- Creative Commons Wiki Quote: The purpose of this wiki is to help you learn more about CC and give you a chance to collaborate with us. Read Case study of a simple but highly effective use of Semantic MediaWiki on the CC Wiki by Alex Kozak, September 8th, 2010
- Computer science and digital design/fabrication
- AIFB Web Portal, at Institute of Applied Informatics and Formal Description Methods (AIFB) at Karlsruhe Institute of Technology. (Includes prime contributors to the Semantic MediaWiki code).
- catalogs useful free software that runs under free operating systems
- Hackerspaces. Quote: are community-operated physical places, where people can meet and work on their projects. This website is for Anyone and Everyone who wants to share their hackerspace stories and questions with the global hackerspaces community.
- Domotiki.eu, base de connaissance sur la domotique : Matériels, Logiciels, Protocoles, Revendeurs, Installateurs, Constructeurs...
Bibliography
See also: Semantic MediaWiki publications at semantic-mediawiki.org
- Bao, J., Ding, L., & Hendler, J. (2008). Knowledge representation and query in semantic mediawiki: A formal study. Tetherless World Constellation (RPI) Technical Report. PDF. (I found this to be a good introduction to the formal aspects of SMW, although some parts are quite heavy..- Daniel K. Schneider (talk) 12:27, 28 June 2013 (CEST))
- Boulos, Maged N. Kamel (2009). Semantic Wikis: A Comprehensible Introduction with Examples from the Health Sciences, Journal of Emerging Technologies in Web Intelligence, Vol 1, No 1 (2009), 94-96, Aug 2009 doi:10.4304/jetwi.1.1.94-96
- Dengler, Frank and Hans-Jörg Happel. 2010. Collaborative modeling with semantic MediaWiki. In Proceedings of the 6th International Symposium on Wikis and Open Collaboration (WikiSym '10). ACM, New York, NY, USA, Article 23 , 2 pages. DOI=10.1145/1832772.1832802 http://doi.acm.org/10.1145/1832772.1832802
- García, R. R., Gil, R. R., Gimeno, J. M., Granollers, T. T., López, J. M., Oliva, M. M., & Pascual, A. A. (2010). Semantic wiki for quality management in software development projects. IET Software, 4(6), 386-395. doi:10.1049/iet-sen.2010.0044
- Herzig, Daniel M. and Basil Ell: Semantic MediaWiki in Operation: Experiences with Building a Semantic Portal. Proceedings of the 9th International Semantic Web Conference (ISWC-10). Springer 2010. PDF
- Koren, Yaron (2012). Working with MediaWiki, WikiWorks Press, ISBN 978-0615720302, http://workingwithmediawiki.com/
- Krötzsch, Markus; Denny Vrandecic, Max Völkel, Heiko Haller & Rudi Studer. Semantic Wikipedia. (2007). Journal of Web Semantics 5, pp. 251-261. Elsevier 2007.
- Krötzsch. M and D. Vrandecic. Wikipedia and the Semantic Web, part 2, Second International Wikimedia Conference, Wikimania2006, Cambridge, MA, USA.
- Krötzsch. M, D. Vrandecic, M. Völkel, H. Haller, and R. Studer. Semantic Wikipedia (ESWC2006 demo), European Semantic Web Conference, ESWC2006, Budva, Montenegro. Best Poster Award.
- Krötzsch. M, D. Vrandecic, and M. Völkel (2005) Wikipedia and the Semantic Web - The Missing Links, First International Wikimedia Conference, Wikimania2005, Frankfurt, Germany.
- Krötzsch, M., & Vrandecic, D. (2009). Semantic wikipedia. In Social Semantic Web (pp. 393-421). Springer Berlin Heidelberg.
- Krötzsch, M., & Vrandečić, D. (2011). Semantic mediawiki. In Foundations for the Web of Information and Services (pp. 311-326). Springer Berlin Heidelberg.
- Kumar, S., Schiffer, P. H., & Blaxter, M. (2012). 959 Nematode Genomes: a semantic wiki for coordinating sequencing projects. Nucleic acids research, 40(D1), D1295-D1300. Abstract/HTML/PDF (Describes http://www.nematodes.org/nematodegenomes/)
- Millard, Ian, Afraz Jaffri, H. Glaser, and UB. Rodriguez-Castro. Using a Semantic MediaWiki to Interact with a Knowledge Based Infrastructure, International Conference on Knowledge Engineering and Knowledge Management, Podebrady, Czech Republic, 2006.
- Reutelshoefer, J., Lemmerich, F., Haupt, F., & Baumeister, J. (2009). An extensible semantic wiki architecture. In 4th Semantic Wiki Workshop (SemWiki). PDF Preprint ?
- Sateli, B., S. S. Rajivelu, E. Angius, and R. Witte, "ReqWiki: A Semantic System for Collaborative Software Requirements Engineering", The 8th International Symposium on Wikis and Open Collaboration (WikiSym 2012), Linz, Austria : ACM, 08/2012 (Describes ReWiki, a software requirements engineerin "bundle" based on SMW)
- Sateli, B., E. Angius, S. S. Rajivelu, and R. Witte, "Can Text Mining Assistants Help to Improve Requirements Specifications?", Mining Unstructured Data (MUD 2012), Kingston, Ontario, Canada, October 17, 2012.
- Schaffert, Sebastian, Joachim Baumeister, François Bry and Malte Kiesel (2008). Semantic Wikis. IEEE Software, 25 (4) 8-11.
- Schaffert, Sebastian; Diana Bischof, Tobias Bürger, Andreas Gruber, Wolf Hilzensauer and Sandra Schaffert (2006). Learning with Semantic Wikis. In: Proceedings of the 1st Workshop on Semantic Wikis
- Rutledge, Lloyd and Rineke Oostenrijk (2011). Applying and Extending Semantic Wikis for Semantic Web Courses. International Workshop on eLearning Approaches for the Linked Data Age, Heraclion, Crete, Greece.
- Vrandecic, Denny; Yaron Koren, Daniel Kinzler (2011). Towards a Semantic Wikipedia, Open submission for Wikimania 2011. (Abstract only)
- Völkel, M et al. (2006). Web 2.0, Social Tagging & Co at the Presentation at AKWM, Karlsruhe.
- Völkel. M, M. Krötzsch, D. Vrandecic, H. Haller, R. Studer. Semantic Wikipedia, presented at WWW2006
- Yao, W. (2012). Specifying semantic information on functional requirements. MA Thesis. University of Tampere (PDF)