Jump to content

Extension talk:Semantic Graph

Add topic
From mediawiki.org
Latest comment: 11 years ago by Xavi

Error with Hypergraph and some data in Chinese

[edit]

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.

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


  • Fix the encoding.

SemanticGraph/include/SemanticGraphSetting.php

'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

SemanticGraph/include/SemanticGraphFiles.php

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

See also

Property Files

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

How is the integration into Semantic Result Formats

[edit]

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)Reply

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

[edit]

Hi,

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)Reply

Problems in cases the page title contains comma

[edit]

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)Reply

Fatal error with mediawiki and semantic mediawiki svn trunk

[edit]
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] 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: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP Stack trace:, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   1. {main}() /mnt/raid/grey/www/mediawiki/code/api.php:0, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   2. ApiMain->execute() /mnt/raid/grey/www/mediawiki/code/api.php:115, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   3. ApiMain->executeActionWithErrorHandling() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:342, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   4. ApiMain->executeAction() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:358, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   5. ApiParse->execute() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiMain.php:692, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   6. Parser->parse() /mnt/raid/grey/www/mediawiki/code/includes/api/ApiParse.php:197, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   7. Parser->internalParse() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:345, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   8. Parser->replaceVariables() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:1184, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP   9. PPFrame_DOM->expand() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:3070, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  10. Parser->braceSubstitution() /mnt/raid/grey/www/mediawiki/code/includes/parser/Preprocessor_DOM.php:1042, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  11. call_user_func_array() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:3278, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  12. efSHypergraphParserFunction_Render() /mnt/raid/grey/www/mediawiki/code/includes/parser/Parser.php:0, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  13. networkgraph->buildFromWiki() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraph2.php:112, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  14. GraphQuery->doQuery() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphBuilders.php:21, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  15. GraphQuery->getPagesFromSemantics() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphQuery.php:31, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:03 2011] [error] [client 172.23.176.99] PHP  16. SMWSQLStore2->getPropertyValues() /mnt/raid/grey/www/mediawiki/code/extensions/SemanticGraph/includes/SemanticGraphQuery.php:49, referer: http://grey.colorado.edu/ccnlab/index.php?title=Sandbox&action=edit
[Thu Sep 01 16:37:16 2011] [error] [client 84.24.80.219] File does not exist: /var/www/skins-1.5, referer: http://grey.colorado.edu/emergent/load.php?debug=false&lang=en&modules=site&only=styles&skin=vector&*
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)Reply
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)Reply

Problem with MW v 1.20.2, and SMW 1.8

[edit]

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;