Extension:BlueSpiceSMWConnector
BlueSpiceSMWConnector Release status: stable |
|
---|---|
Description | Integrates SemanticMediaWiki into BlueSpice. |
Author(s) | Hallo Welt! GmbH |
Maintainer(s) | Hallo Welt! GmbH |
Latest version | 4.5 |
Compatibility policy | For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension. |
MediaWiki | 1.39 (LTS) |
License | GNU General Public License 3.0 only |
Download | |
|
|
|
|
Quarterly downloads | 5 (Ranked 129th) |
Translate the BlueSpiceSMWConnector extension if it is available at translatewiki.net | |
Community Forum |
SMWConnector is the central interface between BlueSpice and Semantic MediaWiki.
Use BlueSpice VisualEditor in Free Text field
edit{{{standard input|free text|class=bsvisualeditor|rows=10}}}
Register custom special property
editTo create a special property as provided by Extension:Semantic Extra Special Properties, this connector offer a simple way to do this.
- add config definition
- define mapping function
- define language / i18n message key
- activate property in LocalSettings.php
- update semantic data tables
- Add the folowing config to your <Extension.php>:
<?php
$GLOBALS["bssDefinitions"]["_EXTENSION"] = array(
"id" => "___EXTENSION",
"type" => 9, //available types can be found in SMWDataItem class Definition or at the bottom of this wiki page
"show" => false,
"msgkey" => "prefs-extension",
"alias" => "prefs-extension",
"label" => "Property name",
"mapping" => "ExtensionClass::mappingFunction"
);
- Define mapping function for title link:
<?php
class ExtensionClass{
public static function mappingFunction( SMW\SemanticData $aSemanticData, WikiPage $aWikiPage, SMW\DIProperty $aProperty ) {
$oTitle = $aWikiPage->getTitle();
$fTitle = $oTitle->getFullText();
$sTitle = $oTitle->getSubpageText();
$pTitle = trim(substr( $fTitle, 0, strlen( $fTitle ) - strlen( $sTitle ) ), "/");
$aSemanticData->addPropertyObjectValue( //this is the only relevant step, data from above is just for example
$aProperty, SMW\DIWikiPage::newFromTitle( Title::newFromText( $pTitle ) )
);
}
}
- Define mapping function for string:
<?php
class ExtensionClass{
/**
* Callback for BlueSpiceSMWConnector that adds a semantic special property
* @param SMW\SemanticData $oSemanticData
* @param WikiPage $oWikiPage
* @param SMW\DIProperty $oProperty
*/
public static function smwDataMapping( SMW\SemanticData $oSemanticData, WikiPage $oWikiPage, SMW\DIProperty $oProperty ) {
//Prepare your data for selected page...
//..
$sData = "Example";
$oSemanticData->addPropertyObjectValue(
$oProperty, new SMWDIBlob( $sData )
);
}
}
- Define mapping function for boolean:
<?php
class ExtensionClass{
public static function mappingFunction( SMW\SemanticData $aSemanticData, WikiPage $aWikiPage, SMW\DIProperty $aProperty ) {
self::$bCheckboxFound = ( strpos( $oWikiPage->getContent()->getNativeData(), "<bs:checklist" ) === false ) ?
false : true;
$aSemanticData->addPropertyObjectValue( //this is the only relevant step, data from above is just for example
$oProperty, new SMWDIBoolean( self::$bCheckboxFound )
);
}
}
- Add message key "prefs-extension" in your language files.
- add "_EXTENSION" to "$GLOBALS[ 'bssSpecialProperties' ]" array definition in LocalSettings.php file:
<?php
$GLOBALS[ 'bssSpecialProperties' ] = array(
'_EXTENSION', ...
);
- go to your semantic admin page and update tables
Available SMWDataItem Types (from SMWDataItem)
edit /// Data item ID that can be used to indicate that no data item class is appropriate
const TYPE_NOTYPE = 0;
/// Data item ID for SMWDINumber
const TYPE_NUMBER = 1;
/**
* Data item ID for SMWDIString.
* @deprecated Will vanish after SMW 1.9; use TYPE_BLOB instead.
*/
const TYPE_STRING = 2;
/// Data item ID for SMWDIBlob
const TYPE_BLOB = 2;
/// Data item ID for SMWDIBoolean
const TYPE_BOOLEAN = 4;
/// Data item ID for SMWDIUri
const TYPE_URI = 5;
/// Data item ID for SMWDITimePoint
const TYPE_TIME = 6;
/// Data item ID for SMWDIGeoCoord
const TYPE_GEO = 7;
/// Data item ID for SMWDIContainer
const TYPE_CONTAINER = 8;
/// Data item ID for SMWDIWikiPage
const TYPE_WIKIPAGE = 9;
/// Data item ID for SMWDIConcept
const TYPE_CONCEPT = 10;
/// Data item ID for SMWDIProperty
const TYPE_PROPERTY = 11;
/// Data item ID for SMWDIError
const TYPE_ERROR = 12;
External links
edit- Helpdesk: SMWConnector
See also
edit- BlueSpiceDistributionConnector
- BlueSpiceEchoConnector
- BlueSpicePageFormsConnector
- BlueSpiceVisualEditorConnector