Semantic MediaWiki/Implementation/Code
Organization
editSemantic MediaWiki is an extension to MediaWiki. The Special:Version page displays its version and lists its hooks into MediaWiki.
Contributing
editSee https://www.semantic-mediawiki.org/wiki/Contributing_to_Semantic_MediaWiki
Architectural Overview
editsmwfParserHook() in SMW_Hooks.php looks for the special [[relation:page]] and [[attribute:=value]] patterns in wikitext and calls smwfParseRelationsCallback and smwfParseAttributesCallback. These functions extract the information for each relation or attribute and store it in the SMWSemanticData object implemented in SMW_SemanticData.php.
Attribute handling is more complicated than relation handling. SMWSemanticData creates a SMWDataValue instance for each attribute value. The datavalue figures out the datatype of the attribute and uses SMWTypeHandlerFactory to load the appropriate SMW_DT_*.php file with a SMW*TypeHandler (e.g. SMW_DateTimeHandler) that can parse the value. All the type handlers implement the SMWTypeHandler interface.
Some attributes and relations are built-in to SMW and are required for its operation, such as "Has type" and "main display unit". SMWSemanticData detects these and handles them separately, storing them in a special properties table.
Other hooks in SMW_Hooks.php store, delete, and move the semantic data by calling global functions and methods of the SMWSemanticData object. These call functions in SMW_Storage.php that talk to the SMW database tables.
The parser hook in SMW_Hooks.php also prints the factbox at the bottom of the page.
Querying is handled separately. SMW_InlineQueries.php sets a hook for <ask.
Development Tips
editUseful links in http://www.mediawiki.org/wiki/Development such as How to become a MediaWiki hacker.
Eclipse tips
editEclipse with the PHPEclipse plug-in is a reasonable development environment.
Eclipse will complain if you try to have two project, MediaWiki and SemanticMediaWiki, where the latter is nested inside the other. A workaround is to create MediaWiki and within it create a new folder, but in [Advanced] options Link to folder in file system and navigate to your Apache mediawiki folder.
If you have Subversion commit access, you can use the Subversive Ecliple plug-in to manage it.