Services contain object definitions that with the help of a ContainerBuilder will manage the object build process and provides instance reuse if necessary. Object instances are normally accessed using dedicated factory methods.

Service files and specification

  • DataValueServiceFactory provides service and factory functions for DataValue objects that are specified in DataValueServices.php
  • ImporterServices.php provides services for the Importer
  • MediaWikiServices.php isolates MediaWiki specific functions and services
  • SharedServicesContainer.php contains common and shared object definitions used throughout the Semantic MediaWiki code base and are accessible via ApplicationFactory


$containerBuilder = new CallbackContainerFactory();
$containerBuilder = $callbackContainerFactory->newCallbackContainerBuilder();

$containerBuilder->registerCallbackContainer( new SharedServicesContainer() );
    $GLOBALS['smwgServicesFileDir'] . '/' . 'MediaWikiServices.php'

$smwgServicesFileDir describes the location of the service directory.

Example for a service[edit]

  • Extraneous language − provides "extraneous" language functions independent of MediaWiki required by Semantic MediaWiki and its registration system.