Extension talk:Semantic Result Formats

The download method for this extension is really annoying. I want a nice version numbered tar.gz. --Dmb 15:32, 22 January 2009 (UTC)

For example, the page says 1.4.1, but now I got it it says (under special version) 1.4.2. Does that mean I'm running a development version? The nice thing about version numbers is that you know where you are. --Dmb 15:38, 22 January 2009 (UTC)

All formats?
How do I enable (or just list) all results formats? It seems since 'upgrading' that "srfInit('all');" no longer does the trick. --Dmb 15:39, 22 January 2009 (UTC)
 * OK, I did some digging, the 'old' version was labeled 1.4.0, and the 'new' version is r45927

timeline - timelinesize hides events
When I have a query that creates some results (11 rows / 2 cols with default settings) and I then set timelinesize=100px most of the results will just be hidden. Is there a way to change this behaviour? --Fez 07:39, 31 August 2009 (UTC)

Pchart4mw
Hi, please consider adding compatibility with the new extension Pchart4mw. Very good. Comparable in quality to that of GooglePie and GoogleBar. But uses only the local server, ie no need to access external server, you need only install the GD library. Thank you. --Alexandre Porto 11:25, 20 November 2009 (UTC)
 * That is a really brilliant suggestion Msevero 00:53, 26 November 2009 (UTC)

Bug in the "calendar" output, patch included to fix it
When using SRF, the "calendar" output type generates an error when there are no results from the semantic query to put in the calendar. This error is: Notice: Undefined variable: events in /var/www/html/mediawiki/extensions/SemanticResultFormats/Calendar/SRF_Calendar.php on line 121 Here is the patch to fix it: Index: Calendar/SRF_Calendar.php

=
====================================================== --- Calendar/SRF_Calendar.php  (revision 61101) +++ Calendar/SRF_Calendar.php  (working copy) @@ -115,6 +115,8 @@                                       $color = $this->m_params['color']; foreach ($dates as $date) $events[] = array($title, $text, $date, $color); +                      } else  { +                        $events[] = null; }               }


 * This was fixed slightly differently in the SVN source code; thanks for pointing to the problem. Yaron Koren 16:01, 17 February 2010 (UTC)

IE6/7 Operation Aborted on loading Exhibit
This might be more an issue with the Exhibit JavaScript, but wanted to post here. When I have my ask query in a page using exhibit, the page loads fine under IE8 and Firefox, but I get the annoying operation aborted Popup under IE6 & 7. The default MS advice (http://support.microsoft.com/kb/927917) is to fix the javascript, and also disable debug messages.

The disabling of the "show friendly HTTP error Messages" allow the page to at least finish loading but I still cant get the "Tiles" interface to show up as it does in Firefox. Any help is appreciated.

-Dave


 * I would send an email about this to the semediawiki-user mailing list; I don't know if the Exhibit format developer(s) check this talk page. Yaron Koren 16:03, 17 February 2010 (UTC)


 * Thanks Yaron, issue seemed to subsided, I removed the table view and am not getting error. Will update if I get more info. - Dave Manzolillo


 * Hi, I'm still getting this with SRF 1.4.5. I don't use the table view, but get the crash. Could you please tell me what you did Dave to get this working?
 * Many thanks
 * mitchelln 18th March 2010

Feature request: node background color from category
I'm loving format=graph. It's so fast and simple to use. Thanks very much. Would it be possible to implement the following? To be able to set the background color (and perhaps other graphviz attributes) from the category that the node belongs to. Maybe something like this on a category page:

has graphviz node fillcolor::pink

or maybe this is possible with the string type, and would be more flexible:

has graphviz node attribute::fillcolor=pink

maybe even properties could have the "has graph edge attribute" property?

If you have a hierarchy of categories, I don't know if it would be possible to take the graphviz attributes from the "leaf-most" category? Maybe the attributes could also come from pages? 155.198.150.201 11:05, 23 February 2010 (UTC) (Bob)


 * Here is my first stab at this. It first looks for a node page property whose name matches this regexp: /graphviz.node.attrib/i and adds all the values of this property (e.g. "fillcolor=red") to the graphviz input.  If it didn't find any properties, then it looks in the categories of the node.  It does not follow the category hierarchy.  Perhaps someone could add that.  155.198.150.201 16:30, 25 February 2010 (UTC) (Bob)


 * Actually, thinking about it a bit more, you would probably want to start at the super-most category, adding the attributes to the Graphviz node, then traverse through the sub-categories, adding graphviz attributes as you go, finally you can add the node page's attributes. This is because the last-to-be-defined graphviz attributes are the ones which are used. (e.g. nodename [style=filled,fillcolor=red,fillcolor=green] will display green)  155.198.150.201 16:57, 26 February 2010 (UTC)


 * New patch does what I proposed in the previous comment. Usage is " Has graphviz node attribute::shape=box " on a category or node page 129.31.247.91 22:23, 12 March 2010 (UTC) (It's Bob again.)

Index: GraphViz/SRF_Graph.php

=
====================================================== --- GraphViz/SRF_Graph.php	(revision 62703) +++ GraphViz/SRF_Graph.php	(working copy) @@ -80,6 +80,7 @@ 		$graphInput .= "digraph $this->m_graphName {"; if ($this->m_graphSize!='') $graphInput .= "size=\"$this->m_graphSize\";"; $graphInput .= "rankdir=$this->m_rankdir;"; +		$store = smwfGetStore; while ( $row = $res->getNext ) { $firstcol = true; @@ -92,16 +93,38 @@ 					if ($firstcol) { $firstcolvalue = $object->getShortText($outputmode); - 					} +                                       $nodeAttributes = array; +					$nodeLinkTitle = Title::newFromText($text); if ($this->m_graphLink==true){ -						$nodeLinkTitle = Title::newFromText($text); $nodeLinkURL = $nodeLinkTitle->getLocalURL; -						$graphInput .= " \"$text\" [URL = \"$nodeLinkURL\"]; "; +						$nodeAttributes[] = "URL = \"$nodeLinkURL\""; } +					// add graphviz attributes from categories (deepest first) +					// then the node page itself (will override categories if needed) + +					$titles = SRFGraph::getAllCategories($nodeLinkTitle, 10); +					$titles[] = $nodeLinkTitle; + +					foreach ($titles as $title) { +					 $semantic_data = $store->getSemanticData($title); +					 $properties = $semantic_data->getProperties; +					 foreach ($properties as $prop) { +					   if (preg_match("/graphviz.node.attrib/i", $prop->getWikiValue)) { +					     $prop_vals = $semantic_data->getPropertyValues($prop); +					     foreach ($prop_vals as $prop_val) { +						$nodeAttributes[] = $prop_val->getWikiValue; +					     } +					    } +					  } +					} + +					if (sizeof($nodeAttributes) > 0) { +					 $graphInput .= " \"$text\" [".implode(",", $nodeAttributes)."]; "; +                                       } 					if (!$firstcol) { $graphInput .= " \"$firstcolvalue\" -> \"$text\" "; if (($this->m_graphLabel==true) || ($this->m_graphColor==true)){ @@ -151,4 +174,20 @@ 		} 		return $result; } + +	function getAllCategories($title, $depth) { +	 if ($depth == 0) { +	   return array; +	 } +	  $subcategories = array; +	 $result = array; +	 foreach (array_keys($title->getParentCategories) as $category) { +	   $t = Title::newFromText($category); +	   $subcategories[] = $result[] = $t; +	 } +	  foreach ($subcategories as $subcategory) { +	   $result = array_merge(SRFGraph::getAllCategories($subcategory, $depth - 1), $result); +	 } +	  return $result; +	} }