Semantic MediaWiki: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
Line 191: Line 191:


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] and [http://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats] (Semantic-Mediawiki.org)
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] and [http://www.semantic-mediawiki.org/wiki/Help:Result_formats Result formats] (Semantic-Mediawiki.org)
Use the debug option to test your #ask expression
<source lang="bibtex">
{{#ask:[[Category:tutoriel]]
|?....
|format=debug
}}
</source>


== Special properties ==
== Special properties ==

Revision as of 18:57, 20 November 2013

Category:MediaWiki extension
Semantic MediaWiki
Extension name Semantic MediaWiki
About this article / disclaimer
Logo SMW Logo.SVG
Screenshot Placeholder.png
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 Any recent version
Dependencies DataValues, Validator
Related extensions (documented here) Semantic Drilldown, Semantic Forms, Semantic Forms Inputs, Semantic Maps, Semantic Result Formats
Related extensions
Discussion
Language support PHP
Status stable
First release date 2005/01/01
Last release date (as of 2013/06/26!) 2013/05/01
Last version number 1.8.0.5
Programming language PHP
Alternatives
Website home page
Publications
Support websites web site
Example websites
Last edited 2013/06/26

Draft

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

Inline queries

Semantic Mediawiki includes a query language for semantic search. According to the manual (7/2013), it can be used in three contexts:

  1. Through the form of the Special:Ask page,
  2. in so-called concepts, i.e. saved queries,
  3. and in inline queries.

Queries usually define three things:

  1. Which page(s) to select. Read Selecting pages (semantic-mediawiki.org)
  2. What information to display about those pages. Read Displaying information (semantic-mediawiki.org)
  3. 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

The following code selects all pages in the category software information 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:

By default, results that include properties 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 nameHas last revision numberIs developed by
Page FormsSemantic Forms2.6 (Dec 2013)Yaron Koren
Stephan Gambke
others
Semantic DrilldownSemantic Drilldown1.2.5 (June 2013)Yaron Koren
David Loomer
Semantic Forms InputsSemantic Forms Inputs0.7Stephan Gambke
Yaron Koren
Jeroen De Dauw
Sanyam Goyal
Yury Katkov
others
Semantic Result FormatsSemantic Result Formats1.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

Read more in Inline queries, Displaying information and Result formats (Semantic-Mediawiki.org)

Use the debug option to test your #ask expression

{{#ask:[[Category:tutoriel]]
|?....
|format=debug
}}

Special properties

(needs to be completed ....)

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:

  1. List all properties using Special:Properties
  2. Hover the mouse over the red links, the wiki will tell if it's a special property
  3. Click on the red link
  4. Create with form
  5. Select type=text (not so sure about this....)

Good for debugging:

Understanding were you get your values from:

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:

Download and Installation

Tested for MW 1.17 (24 August 2011), MW 1.19, MW 1.20. Do not install both the Mediawiki software and Semantic MediaWiki in one shot. Install the wiki first, then add SMW and then run its installation script.

Download either a zip file or with git.

Using the zip Archive:

  • You first need to install the Validator extensions ! Download of Validator was included in a released SMW download (when last checked). In addition, you also should install ParserFunctions that will allow you to create fancy templates.
  • Download SMW from Sourceforge.
Development version (MW 1.22alpha tested in aug/sept. 2013)

With Git (latest version). As of summer 2013, you also need the DataValues extension !

cd your_MediWiki_installation (MW 21.x or higher)
cd extensions
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataValues.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/ParserFunctions.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Validator.git 
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticMediaWiki.git
PHP requirements

The mbstrings non-default extension must be installed.

Under Ubuntu 10+, it should be there, but check:

php --info | grep mbstring
Configure LocalSettings.php (mandatory)
$smwgNamespaceIndex = 106; // on top of others, adjust to yours
require_once( "$IP/extensions/Validator/Validator.php" );
include_once( "$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php" );
enableSemantics('edutechwiki.unige.ch'); // adjust to yours
Configure options in LocalSettings.php (there are many many!)
$smwgShowFactbox = SMW_FACTBOX_NONEMPTY; 
Setup the database
Testing

Create a page like:

Then enter something like:

Testing - adding a property called "testproperty" with value [[testproperty::SandBox]]

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 "master".

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:

Upgrading

After each version upgrade, you should launch the maintenance script. I also can be run by admins from the special pages (if we are correct ...)

cd extensions/SemanticMediaWiki/maintenance
php SMW_setup.php

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.

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 SMW_refreshData.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 SMW_refreshData.php -f -d 100 -v -s 4220

You will notice that all bad properties are gone now if you look at special:properties

Semantic MediaWiki extensions

  • Semantic Drilldown provides a page for drilling down through a site's data, using categories and filters on semantic properties.
  • 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).
  • 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.

Git copy/paste list

Git copy/paste list of important extensions for installation on a bleeding edge server (MW 1.22alpha, August 2013). ParamProcessor is the new name for Validator, but the git archive is still called validator.

git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataValues.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/Validator.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticMediaWiki.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticForms.git
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/Maps.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticMaps.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/SemanticResultFormats.git
git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/AdminLinks.git

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.

Links

Official other important SMW sites

Events

Manuals and introductions

See also: User manual, which includes additional links

Official
  • Quick Reference Guide: PNG or PDF
  • 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

  • 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)

Various

  • blog (Jeroen De Dauw, a SWM key developer, interesting posts)
  • SMWCon also known as the Semantic MediaWiki Conference, is a twice-yearly gathering for users, developers and enthusiasts of Semantic MediaWiki,

Semantic MediaWiki sites

Indexes (listed sites below were more or less randomly chosen)
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
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
  • 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, 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., & 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.
  • 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.
  • Yao, W. (2012). Specifying semantic information on functional requirements. MA Thesis. University of Tampere (PDF)