Extension talk:SemanticHistory

From mediawiki.org

Sort uncategorized pages by author[edit]

I would like to sort the list Special:UncategorizedPages by author. Is that possible?

Additionally, it would be great if I could have the property "author" appear in the factbox at the bottom of a page, like here: SemanticHistoryExampleWiki. I have already created the property "author" with "type:page", but I do not know what to do next. Laquestianne, 24.09.2009

User documentation[edit]

That's great extension, but the documentation is horrible! Is it possible to divide user documentation and the internal structure? I installed the extension and don't understand what I have to do to revision parameters in my #ask queries --Ganqqwerty 18:55, 25 February 2011 (UTC)[reply]

Fix for MW 1.16.x[edit]

  • Error when saving:
Detected bug in an extension! Hook fnSemanticHistorySave failed to return a value; should return true to continue hook processing or false to abort.
  • Fix:

In file SemanticHistory.php change:

function fnSemanticHistorySave(&$article, &$user, $text, $summary,
 &$minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{

to

function fnSemanticHistorySave(&$article, &$user, $text, $summary,
 $minoredit, $watchthis, $sectionanchor, &$flags, $revision, &$status, $baseRevId)
{

--Planetenxin 13:33, 12 September 2011 (UTC)[reply]

Fix for MW 1.17.x && SMW 1.6.1[edit]

SMW API as changed. Replace the code in function getTriple with the new one,

...
$page = SMWDataValueFactory::newTypeIDValue( '_wpg',  $title->getFullText());
$semdata = smwfGetStore()->getSemanticData($page->getDataItem() );	
...
foreach($semdata->getProperties() as $property){
	$propertyKey = SMWDataValueFactory::newDataItemValue( $property, null );

	$p =  $propertyKey->getShortWikiText();
	$p2 =  $propertyKey->getPropertyID();
	if (!$arr[$p]) $arr[$p] = array();
	
	// some pre-defined properties
	// http://semantic-mediawiki.org/doc/SMW__SQLStore2_8php-source.html		
	if ($p2 == '_MDAT') continue; //time stamp
	else if ($p2 == '_INST') $p = 'rdf:type';
	else if ($p2 == '_SUBC') $p = 'rdfs:subClassOf';
	else if ($p2 == '_SUBP') $p = 'rdfs:subPropertyOf';
	else if ($p2 == '_REDI') $p = 'owl:sameAs';
	else if ($p2 == '_TYPE') $p = 'has_type';
	else { $p = str_replace('Property:','',$p); }
    
	// Capitalize the first letter of the property name (as MW always does) 
	$p[0] = mb_strtoupper($p[0]);
	
	$propvalues = $semdata->getPropertyValues($property);
	foreach ($propvalues as $dataItem) {
		$propvalue = SMWDataValueFactory::newDataItemValue( $dataItem, $property );

		$o=$propvalue->getShortWikiText();		   
		//$text .= "$s $p $o;<br/>";
		$arr[$p][] =$o;
	}
}	

Evaleto 15:41, 12 December 2011 (UTC)[reply]

Typo correction[edit]

In the function flipFlag the following line has a typo:

   if(strpos($oldcontent,         "{{",$obsolete."|".$neg."}}") == true) 

The comma should be replaced with a dot:

   if(strpos($oldcontent,         "{{".$obsolete."|".$neg."}}") == true) 

--Goss 19:49, 8 January 2012 (UTC)[reply]