Tutorial by @JeroenDeDauw
bit.ly/smw-arch
SMWCon Fall 2013, Berlin
SMWStore: reading
SMWSemanticData getSemanticData(SMWDIWikiPage $subject)
SMWDataItem[] getPropertyValues($subject, SMWDIProperty $property)
SMWDIWikiPage[] getPropertySubjects(SMWDIProperty $property, $value)
SMWDIProperty[] getProperties(SMWDIWikiPage $subject)
SMWStore: writing
updateData(SMWSemanticData $data)
deleteSubject(Title $title)
clearData(SMWDIWikiPage $di)
SMWStore: query answering
SMWQueryResult getQueryResult(SMWQuery $query)
Domain layer query answering
string SMWQueryProcessor::getResultFromQuery(SMWQuery $query, array $params)
Domain layer query answering: SMWQuery
Core workflow: page save
Core workflow: inline queries
Takes an SMWQueryResult, returns a string
Implementations implement SMWIResultPrinter,
typically derive from SMW\ResultPrinter
includes/queryprinters
semantic-mediawiki.org/wiki/Writing_result_formats
protected function getResultText(SMWQueryResult $res, $outputMode) {
// ...
return 'some string computed from $res';
}
public function getParamDefinitions(array $definitions) {
$definitions[] = array(
'type' => 'string',
'name' => 'conference',
'default' => 'SMWCon',
'message' => 'smw-paramdesc-conference',
);
// ...
return $definitions;
}
protected function getResultText(SMWQueryResult $res, $outputMode) {
// ...
if ( $this->params['displaylolcats'] ) {
// ...
}
// ...
}
includes/specials
includes/api
$wgHooks['someEvent'][] = function() {
// Handle the event
};
docs/hooks.md, ctrl+f "wfRunHooks"
SMWStore::updateData => SMWStore::updateData[Before/After]