PHP namespaces


PHP namespaces are used in SMW as of version Semantic MediaWiki 1.9.0.

Namespaces follow these general rules:

  • Code for a component goes into this namespace: \SMW\Component. Example: SMW\QueryProcessor
  • Sub components are handled as follows: \SMW\Component\Subcomponent Example: SMW\Store\SQLStore3
  • PHPUnit tests for class Foo go into a FooTest class in the same namespace as Foo but starting with \SMW\Test rather then just \SMW
  • The namespace should typically closely resemble the directory structure
  • Little code should end up floating in the top level SMW namespace

Below are already defined components and sub components. Since we are just starting with the introduction of namespaces, many of these are not reflected in the codebase and many components are still missing. You can introduce them on the go and add them in the table below.

Path classes
\SMW\Api The API modules of SMW
\SMW\Store The store code of SMW
\SMW\Store\SQLStore3 SQLStore3 implementation of the SMW store

Components not to be migrated as they will undergo changes making this pointless in the near future:

  • DataItems
  • DataValues