Semantic Maps: Difference between revisions

The educational technology and digital learning wiki
Jump to navigation Jump to search
 
(29 intermediate revisions by the same user not shown)
Line 3: Line 3:
|about=This is '''not''' official documentation
|about=This is '''not''' official documentation
|developers=Jeroen De Dauw, others
|developers=Jeroen De Dauw, others
|author_location=Gent, Belgium
|licences=GPL v2+
|licences=GPL v2+
|description=Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate.
|description=Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate.
|mediawiki=1.17.* or greater
|mediawiki=1.17.* or greater. Probably 1.21 or better works best
|dependencies=Maps, Semantic MediaWiki, ParamProcessor
|dependencies=Maps (MediaWiki extension), Semantic MediaWiki, ParamProcessor
|related=Semantic Forms, Semantic Forms Inputs, Semantic MediaWiki, Semantic Result Formats
|related=Semantic Forms, Semantic Forms Inputs, Semantic MediaWiki, Semantic Result Formats
|status=stable
|status=stable
Line 14: Line 15:
|programming language=PHP
|programming language=PHP
|website=http://www.semantic-mediawiki.org/wiki/Semantic_Maps
|website=http://www.semantic-mediawiki.org/wiki/Semantic_Maps
|support_website=https://www.mediawiki.org/wiki/Extension:Semantic_Maps
|support_website=https://www.mediawiki.org/wiki/Extension:Semantic_Maps,  http://www.semantic-mediawiki.org/wiki/Semantic_Maps
|last_edit=2013/08/15
|last_edit=2013/08/15
}}
}}
{{quotation|Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate. This includes the ability to add, edit, aggregate and visualize coordinate data stored through the Semantic MediaWiki extension. It is based on the Maps extension and replaces the earlier implementations Semantic Google Maps and Semantic Layers.|}} [http://www.semantic-mediawiki.org/wiki/Semantic_Maps Semantic Maps], retrieved Aug 2013
{{quotation|Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate. This includes the ability to add, edit, aggregate and visualize coordinate data stored through the Semantic MediaWiki extension. It is based on the Maps extension and replaces the earlier implementations Semantic Google Maps and Semantic Layers.|}} [http://www.semantic-mediawiki.org/wiki/Semantic_Maps Semantic Maps], retrieved Aug 2013


== Download, versions and dependencies ==
== Basic how to ==
 
Semantic maps are based on the [[Maps (MediaWiki extension)|Maps]] extension. This Maps extension has two types of features:
* Display maps with markers for a coordinates using varies mapping services
* One can use [http://semantic-mediawiki.org/wiki/Maps/Geocoding Geocoding], i.e. normal addresses instead of coordinates. However, this doesn't seem to work all the time - [[User:Daniel K. Schneider|Daniel K. Schneider]] ([[User talk:Daniel K. Schneider|talk]]) 19:30, 7 January 2014 (CET)
Read more in [[Maps (MediaWiki extension)|Maps]]
 
Semantic Maps, as suggested by its name, allows to retrieve coordinates from properties.
 
Let's look at some data:
<source lang="bibtex">
{{#ask: [[Category:MediaWiki extension]]
| ?Has address
| ?Has location
| format=table
}}
</source>
 
{{#ask: [[Category:MediaWiki extension]]
| ?Has address
| ?Has location
| format=table
}}
 
And produce a map from the "has location" properties
<source lang="bibtex">
{{#ask: [[Category:MediaWiki extension]]
| ?Has location
| format=map
}}
</source>
 
{{#ask: [[Category:MediaWiki extension]]
| ?Has location
| format=map
}}
 
* More tests: [[:Category:MediaWiki_extension]]
 
== Installation notes ==
 
=== Versions and dependencies ===


Semantic maps is based on other extensions. Typically, you must include Validator (or ParamProcessor), SMW, semantic Forms, Maps, and finally Semantic Maps.
Semantic maps is based on other extensions. Typically, you must include Validator (or ParamProcessor), SMW, semantic Forms, Maps, and finally Semantic Maps.
Line 25: Line 67:
As of August 2013, you have to make a choice between and older and a newer version. In addition, documentation for ParamProcessor isn't up-to-date, i.e. some confusion of what you need. Also read [https://meta.wikimedia.org/wiki/Wikidata/Notes/SMW_and_Wikidata Wikidata/Notes/SMW and Wikidata]
As of August 2013, you have to make a choice between and older and a newer version. In addition, documentation for ParamProcessor isn't up-to-date, i.e. some confusion of what you need. Also read [https://meta.wikimedia.org/wiki/Wikidata/Notes/SMW_and_Wikidata Wikidata/Notes/SMW and Wikidata]


=== Version 3.0.x ===
==== Version 3.0.x ====


Currently (Aug 2013), alpha but should be working fine if you also upgrade all the dependencies. Same setup as 2.0.x.
Currently (dec  2013), beta but should be working fine with MW 1.22 and SMW 1.9x
* We suggest using the composer dependency manager to install, read the [[Semantic MediaWiki]] article.


=== Version 2.0.x ===
==== Version 2.0.x ====


Download and instructions: [https://www.mediawiki.org/wiki/Extension:Semantic_Maps Extension:Semantic_Maps]
Download and instructions: [https://www.mediawiki.org/wiki/Extension:Semantic_Maps Extension:Semantic_Maps]
Line 39: Line 82:
* [[PHP]] 5.3 or above
* [[PHP]] 5.3 or above


=== Version 1.0.5 ===
==== Version 1.0.5 ====


Download and instructions: [https://www.mediawiki.org/wiki/Extension:Semantic_Maps Extension:Semantic_Maps] '''and''' [http://mapping.referata.com/wiki/Semantic_Maps the old documentation wiki]
Download and instructions: [https://www.mediawiki.org/wiki/Extension:Semantic_Maps Extension:Semantic_Maps] '''and''' [http://mapping.referata.com/wiki/Semantic_Maps the old documentation wiki]
Line 46: Line 89:
* [https://www.mediawiki.org/wiki/Validator Validator] later than 0.4.12
* [https://www.mediawiki.org/wiki/Validator Validator] later than 0.4.12


== Installation notes ==
=== Requirements ===
 
'''PHP and Mediawiki version'''


'''''Not stable, I just write down the steps I am currently playing with''''' - 17:35, 16 August 2013 (CEST)
You need some sort of "magic combo". We suggest upgrading the wiki to alpha (i.e. get all the code, including extension code from GET).


* There is a severe problem with Validator and SMW (relatated to the version of this wiki).  
Using MW 1.20x, default PHP of Ubuntu LTS 20.04, we had a severe problem with Validator and SMW (relatated to the version of this wiki).  
<source lang="bibtex" enclose="div">
  Class '\\ValueValidators\\RangeValidator' not found in /export/data/portails/mediawiki/extensions/Validator/includes/ParamProcessor/ParamDefinitionFactory.php on line 181, referer: http://edutechwiki.unige.ch/en/Semantic_Forms
  Class '\\ValueValidators\\RangeValidator' not found in /export/data/portails/mediawiki/extensions/Validator/includes/ParamProcessor/ParamDefinitionFactory.php on line 181, referer: http://edutechwiki.unige.ch/en/Semantic_Forms
</source>
This might be due to an older php version but we don't know ....


* On a test wiki (i.e. our Intranet wiki) which runs on alpha 1.22x, the extensions do seem to work...
After upgrading both the server and the wiki (see [[special:version]]) to bleeding edge code, it worked. See our [[Special:Version|Mediawiki version]]


=== Environment / SMW already installed ===
'''Semantic MediaWiki version'''
* Mediawiki version: [[Special:Version]] (this wiki)
* SMW and SMF installed and working


Read the [[Semantic MediaWiki]] article for some installation notes ...
SMW and SMF should be installed and working. Read the [[Semantic MediaWiki]] article for some installation notes ...


=== Download ===
=== Download ===


Keep a copy of directories that you will have to overwrite. Since Semantic Maps is under aggressive development, their latest versions only seem to work with the latest versions of SMW, SMF, etc. In other words, you are likely to break your wiki and therefore should be prepared to reinstall older versions ...
(tested on Jan 30, 2014)
 
Since MW 1.22 (end of 2013), we suggest to use the composer manager. Read the [[Semantic MediaWiki]] article for more details about this framework and how to install it.
 
cd /your/mediawiki-installation-directory
 
* To install the require maps extensions, type:
composer require mediawiki/maps "*"
 
* To install Semantic Maps, type:
composer require mediawiki/semantic-maps "dev-master"


cd extensions
* To update (all extensions), type:
  cp -rp Validator Validator.save
  composer update
cp -rp SemanticForms SemanticForms.save
cp -rp SemanticMediaWiki SemanticMediaWiki.save


Then install the latest versions....
However, this may change at some point, e.g. instead of downloading "dev-master", you rather should take a stable version.


git clone https://gerrit.wikimedia.org/r/p/mediawiki/extensions/DataValues.git
=== Configure LocalSettings.php for older MediaWikis ===
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://git.wikimedia.org/git/mediawiki/extensions/SemanticForms.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


=== Configure LocalSettings.php ===
This is '''before''' composer, do not use this for MW 1.22 or more recent !


(1) Add DataValues before Validator
(1) Add DataValues before Validator
Line 125: Line 174:
Since SemanticMaps are based on Maps, it's a good idea to understand how to use Maps first.
Since SemanticMaps are based on Maps, it's a good idea to understand how to use Maps first.


Read:
'''Read:'''
* [http://semantic-mediawiki.org/wiki/Maps/Coordinates coordinates]
* [http://semantic-mediawiki.org/wiki/Maps/Coordinates coordinates]
* [http://semantic-mediawiki.org/wiki/Maps/Geocoding geocoding]
* [http://semantic-mediawiki.org/wiki/Maps/Geocoding geocoding]
* [http://semantic-mediawiki.org/wiki/Maps/Displaying_maps Maps/Displaying maps]
* [http://semantic-mediawiki.org/wiki/Maps/Displaying_maps Maps/Displaying maps]


Try a simple Geocoding function like this:
'''Try a simple Geocoding function like this:'''
<source lang="bibtex">
{{#geocode:location=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}
</source>
It should show like this:
: {{#geocode:location=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}
 
'''Then, create a map, using geocoding:'''
<source lang="bibtex">
<source lang="bibtex">
{{#display_map:address=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}
{{#display_map:address=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}
</source>
</source>
It should produce something like that, i.e. the location where this very page has been written :)
{{#display_map:address=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}


Test the [[Special:MapEditor]] page
'''Test the [[Special:MapEditor]] page'''
* Insert stuff and export the wiki code, then paste into some page.
* Insert stuff and export the wiki code, then paste into some page.

Latest revision as of 19:06, 18 August 2014

Category:MediaWiki extension
Semantic Maps
Extension name Semantic Maps
About this article / disclaimer This is not official documentation
Logo Placeholder.png
Screenshot Placeholder.png
Location of the main author Gent, Belgium
Coordinates of the main authors 51.053829, 3.725012
Developers Jeroen De Dauw, others
Licences GPL v2+
Description Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate.
Mediawiki requirements 1.17.* or greater. Probably 1.21 or better works best
Dependencies Maps (MediaWiki extension), Semantic MediaWiki, ParamProcessor
Related extensions (documented here) Semantic Forms, Semantic Forms Inputs, Semantic MediaWiki, Semantic Result Formats
Related extensions
Discussion
Language support
Status stable
First release date 2009/07/01
Last release date (as of 2013/08/15!) 2012/12/13
Last version number 2.0.1 (2012-12-13)
Programming language PHP
Alternatives
Website home page
Publications
Support websites web site, web site
Example websites
Last edited 2013/08/15

“Semantic Maps is an extension to Semantic MediaWiki (SMW) that adds semantic capabilities to the Maps extension and adds the datatype Geographic coordinate. This includes the ability to add, edit, aggregate and visualize coordinate data stored through the Semantic MediaWiki extension. It is based on the Maps extension and replaces the earlier implementations Semantic Google Maps and Semantic Layers.” Semantic Maps, retrieved Aug 2013

Basic how to

Semantic maps are based on the Maps extension. This Maps extension has two types of features:

  • Display maps with markers for a coordinates using varies mapping services
  • One can use Geocoding, i.e. normal addresses instead of coordinates. However, this doesn't seem to work all the time - Daniel K. Schneider (talk) 19:30, 7 January 2014 (CET)

Read more in Maps

Semantic Maps, as suggested by its name, allows to retrieve coordinates from properties.

Let's look at some data:

{{#ask: [[Category:MediaWiki extension]]
| ?Has address
| ?Has location
| format=table
}}
 Has addressHas location
Maps (MediaWiki extension)Gent, Belgium51° 3' 15.63" N, 3° 43' 2.73" E
Mediawiki collection extension installationGermany51° 5' 0.31" N, 10° 25' 24.41" E
Page FormsNew York, USA40° 42' 45.82" N, 74° 0' 21.65" W
Semantic DrilldownNew York40° 42' 45.99" N, 74° 0' 21.50" W
Semantic Forms InputsNoordwijk52° 14' 23.96" N, 4° 27' 0.03" E
Semantic MapsGent, Belgium51° 3' 15.63" N, 3° 43' 2.73" E
Semantic MediaWikiOxford, England51° 45' 7.25" N, 1° 15' 28.26" W
Semantic Result FormatsGent, Belgium51° 3' 15.63" N, 3° 43' 2.73" E
VisualEditorBerlin52° 31' 1.33" N, 13° 23' 19.90" E

And produce a map from the "has location" properties

{{#ask: [[Category:MediaWiki extension]]
| ?Has location
| format=map
}}
Loading map...

Installation notes

Versions and dependencies

Semantic maps is based on other extensions. Typically, you must include Validator (or ParamProcessor), SMW, semantic Forms, Maps, and finally Semantic Maps.

As of August 2013, you have to make a choice between and older and a newer version. In addition, documentation for ParamProcessor isn't up-to-date, i.e. some confusion of what you need. Also read Wikidata/Notes/SMW and Wikidata

Version 3.0.x

Currently (dec 2013), beta but should be working fine with MW 1.22 and SMW 1.9x

  • We suggest using the composer dependency manager to install, read the Semantic MediaWiki article.

Version 2.0.x

Download and instructions: Extension:Semantic_Maps

  • Maps 2.0.1 or above
  • ParamProcessor 1.0 or above. This is a new version of Validator and it also keeps the validator extension directory.
  • DataValues (needed by ParamProcessor)
  • Mediawiki 1.18 or above
  • PHP 5.3 or above

Version 1.0.5

Download and instructions: Extension:Semantic_Maps and the old documentation wiki

Requirements

PHP and Mediawiki version

You need some sort of "magic combo". We suggest upgrading the wiki to alpha (i.e. get all the code, including extension code from GET).

Using MW 1.20x, default PHP of Ubuntu LTS 20.04, we had a severe problem with Validator and SMW (relatated to the version of this wiki).

 Class '\\ValueValidators\\RangeValidator' not found in /export/data/portails/mediawiki/extensions/Validator/includes/ParamProcessor/ParamDefinitionFactory.php on line 181, referer: http://edutechwiki.unige.ch/en/Semantic_Forms

This might be due to an older php version but we don't know ....

After upgrading both the server and the wiki (see special:version) to bleeding edge code, it worked. See our Mediawiki version

Semantic MediaWiki version

SMW and SMF should be installed and working. Read the Semantic MediaWiki article for some installation notes ...

Download

(tested on Jan 30, 2014)

Since MW 1.22 (end of 2013), we suggest to use the composer manager. Read the Semantic MediaWiki article for more details about this framework and how to install it.

cd /your/mediawiki-installation-directory
  • To install the require maps extensions, type:
composer require mediawiki/maps "*"
  • To install Semantic Maps, type:
composer require mediawiki/semantic-maps "dev-master"
  • To update (all extensions), type:
composer update

However, this may change at some point, e.g. instead of downloading "dev-master", you rather should take a stable version.

Configure LocalSettings.php for older MediaWikis

This is before composer, do not use this for MW 1.22 or more recent !

(1) Add DataValues before Validator

(2) Add the SemanticMaps after all the other SMW extensions (e.g. Validator, SMW and SMF and Maps).

Example configuration:

// Start of SMW namespaces (after 106/107 = Coap)
$smwgNamespaceIndex = 108;
# DataValues (needed for ParaProcessor)
require_once( "$IP/extensions/DataValues/DataValues.php" );
# aka ParamProcessor (needed for SMW)
require_once( "$IP/extensions/Validator/Validator.php" );
# SMW
include_once("$IP/extensions/SemanticMediaWiki/SemanticMediaWiki.php");
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 Result Forms
require_once("$IP/extensions/SemanticResultFormats/SemanticResultFormats.php");

# Semantic Forms Inpus
require_once("$IP/extensions/SemanticFormsInputs/SemanticFormsInputs.php");

# Maps
require_once( "$IP/extensions/Maps/Maps.php" );
# Semantic Maps
require_once( "$IP/extensions/SemanticMaps/SemanticMaps.php" );

Understanding and Testing Maps

Since SemanticMaps are based on Maps, it's a good idea to understand how to use Maps first.

Read:

Try a simple Geocoding function like this:

{{#geocode:location=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}

It should show like this:

Geocoding failed

Then, create a map, using geocoding:

{{#display_map:address=40 bouledvard du Pont-d'Arve, Geneva, Switzerland}}

It should produce something like that, i.e. the location where this very page has been written :)

Loading map...

Test the Special:MapEditor page

  • Insert stuff and export the wiki code, then paste into some page.