Open main menu

Extension talk:Semantic Graph


Error with Hypergraph and some data in ChineseEdit

Hi Rob,
A nice extension, but I have a problem with the extension. When I use Graph as Hypergraph with some data in Chinese. It returns an error content of Hypergraph. You can see it in the following image. SemanticGraphHypergraphError.png

Could you give me a hand--Roc michael 17:11, 2 May 2009 (UTC)

  • Fix the encoding.


'preamble' => ... encoding = "iso-8859-1"?>  //before
'preamble' => ... encoding = "utf-8"?> //after
  • Fix the font-name.
    • Make property file.

e.g.) image/hypergraph/hexplorer.prop

hypergraph.hyperbolic.text.fontName=Sim Sun
    • Add line


$output .= '<param name="properties" value="hexplorer.prop">';

See also

Property Files

Jelly beans (talk) 14:15, 23 October 2012 (UTC)

How is the integration into Semantic Result FormatsEdit

Is this extension still maintained and if yes how is the integration with Extension:Semantic Result Formats planned?--MWJames 12:26, 25 September 2010 (UTC)

Colour setting of incoming, outgoing relations and for different property types ...Edit


Is it somehow possible to allow some parameters to set the colour of incoming vs. outgoing relations and if more than one property type is displayed to allow to set different colour so that connections can be divided easily. --MWJames 18:21, 26 June 2011 (UTC)

Problems in cases the page title contains commaEdit

We encountered problems in cases where the page title contains a comma, Semantic Graph would show an error message no valid pages found for option resource while renaming the same page without a comma would display the hypergraph. --MWJames 13:32, 29 June 2011 (UTC)

Fatal error with mediawiki and semantic mediawiki svn trunkEdit

[Thu Sep 01 16:37:03 2011] [error] [client] PHP Catchable fatal error:  Argument 2 passed to SMWSQLStore2::getPropertyValues() must be an instance of SMWDIProperty, instance of SMWPropertyValue given, called in /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphQuery.php on line 49 and defined in /mnt/raid/grey/www/mediawiki/code/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php on line 191, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP Stack trace:, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   1. {main}() /mnt/raid/grey/www/mediawiki/code/api.php:0, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   2. ApiMain->execute() /mnt/raid/grey/www/mediawiki/code/api.php:115, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   3. ApiMain->executeActionWithErrorHandling() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:342, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   4. ApiMain->executeAction() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:358, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   5. ApiParse->execute() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:692, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   6. Parser->parse() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiParse.php:197, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   7. Parser->internalParse() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:345, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   8. Parser->replaceVariables() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:1184, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP   9. PPFrame_DOM->expand() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:3070, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  10. Parser->braceSubstitution() /mnt/raid/grey/www/mediawiki/code/includes/parser/Preprocessor_DOM.php:1042, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  11. call_user_func_array() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:3278, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  12. efSHypergraphParserFunction_Render() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:0, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  13. networkgraph->buildFromWiki() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraph2.php:112, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  14. GraphQuery->doQuery() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphBuilders.php:21, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  15. GraphQuery->getPagesFromSemantics() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphQuery.php:31, referer:
[Thu Sep 01 16:37:03 2011] [error] [client] PHP  16. SMWSQLStore2->getPropertyValues() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphQuery.php:49, referer:
[Thu Sep 01 16:37:16 2011] [error] [client] File does not exist: /var/www/skins-1.5, referer:*
Is their a chance you are running SMW 1.6+ because if so Semantic Graph is just not up for it, only works prior 1.6. Maybe next time you could add some information about what SMW version etc. you are using, it is hard for anyone to give advice with no related context while looking at an error log. Cheers --MWJames 16:55, 10 November 2011 (UTC)
Quick fix. In SemanticGraphQuery.php change getPagesFromSemantics function:
function getPagesFromSemantics( $titles, $p ) {
	// this may be computationally expensive :-) and it is inefficient.
	foreach ((array) $titles as $t) {
		$p = str_replace( 'Property:', '', $p ); // quick fix
		if ($this->args['direction'] != "incoming") {
			$thisTier = $this->SMWengine->getPropertyValues(SMWDIWikiPage::newFromTitle(Title::newFromDBkey($t)), SMWDIProperty::newFromUserLabel($p));
			foreach ($thisTier as $row) {
				if ($row->getDIType() == SMWDataItem::TYPE_WIKIPAGE) {
					//filter out results that are not of page type in the wiki & convert to array of titles
					if (!in_array(array($t, $p, $row->getTitle()->getPrefixedDBkey()), $this->graph['links'])) {
							if (!in_array(array($row->getTitle()->getPrefixedDBkey(), "(inv) ".$p, $t), $this->graph['links'])) {
									$this->graph['links'][] = array($t, $p, $row->getTitle()->getPrefixedDBkey());
					if (!in_array($row->getTitle()->getPrefixedDBkey(),$this->graph['nodes'])) {
						$this->graph['nodes'][] = $row->getTitle()->getPrefixedDBkey();
		if ($this->args['direction'] != "outgoing") {
			$thisIncoming = $this->SMWengine->getPropertySubjects(SMWDIProperty::newFromUserLabel($p), SMWDIWikiPage::newFromTitle(Title::newFromDBkey($t)));
			foreach ($thisIncoming as $row) {
				if (!in_array(array($row->getTitle()->getPrefixedDBkey(), $p, $t), $this->graph['links'])) {
					if (!in_array(array($t, "(inv) ".$p, $row->getTitle()->getPrefixedDBkey()), $this->graph['links'])) {
						$this->graph['links'][] = array($t, "(inv) ".$p, $row->getTitle()->getPrefixedDBkey());
				if (!in_array($row->getTitle()->getPrefixedDBkey(),$this->graph['nodes'])) {
					$this->graph['nodes'][] = $row->getTitle()->getPrefixedDBkey();

--Xavier Atero (talk) 21:46, 22 February 2013 (UTC)

Problem with MW v 1.20.2, and SMW 1.8Edit

I have applied the quick fix above proposed by Xavier, but I am now getting the following error:

Database error

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

   (SQL query hidden)

from within function "SMWSQLStore2::getSMWPageIDandSort". Database returned error "1146: Table 'collab_db.smw_ids' doesn't exist (localhost)".

Any quick fix for that? Many thanks!

--Update: Found the solution. You just have to change the SQL store to be SMWSQLStore3. Change in the SemanticGraphQuery.php file the below:

$this->SMWengine = new SMWSQLStore2; To: $this->SMWengine = new SMWSQLStore3;

Return to "Semantic Graph" page.