Extension talk:Semantic Result Formats

format=sum problem with units used Math/SRF_Math.php
(using MW, SMW, and SemanticResultFormats all svn latest as of Dec 11th 2010)

I have a qurey:

That returns:

1124144918, 44631246.000001 , 27997942713 , 128971180 , 1052694759 , 716736495

When I add |format=sum

the result is:

0.0018172367330518 (well.. I only included the first line of the integers above so it's not really this number, but you get the point)

The reason is that it's summing up using the 1:1 units for the type instead of the default units defined for Property:TorrentDataSize:

Property:TorrentDataSize:

This is a property of type Has type::FileSize. display units::bytes

The values for the various instances of TorrentDataSize are all defined in bytes.

Type:FileSize: Corresponds to::1 Petabyte, petabyte, PetaByte, PB Corresponds to::1024 Terabyte, terabyte, TeraByte, TB Corresponds to:: Gigabyte, gigabyte, GigaByte, GB Corresponds to:: Megabyte, megabyte, MegaByte, MB Corresponds to:: Kilobyte, kilobyte, KiloByte, KB Corresponds to::1125899906842624 Byte, byte, Bytes, bytes, B Corresponds to::9007199254740990 Bits, bits

Note the above have brackets, it's just that I dont know how to make them display here.

-jkeogh

Exhibit
I downloaded the release 1.5.1 (2010-08-26) my previos pages using exhibit do not work anymore. With previous releas 1.5.0 is ok. Bugs ?

--77.58.252.132 22:07, 27 October 2010 (UTC)

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


 * Hi, I'm also receiving this error even with the latest SRF.

Undefined property:SMWWikiPageValue::$display_options in C:\\w\\www\\tids\\extensions\\SemanticResultFormats\\Calendar\\SRF_Calendar.php on line 114


 * SRF latest svn, MW 1.16, SMW 1.5 Msevero 05:55, 24 April 2010 (UTC)


 * This is actually an unrelated error, but I just fixed that one too (I think) in SVN. Please let me know if the fix worked for you... Yaron Koren 21:55, 27 April 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; +	} }

exhibit bug?
Hi

I'm getting this error when using exhibit

File does not exist: C:/UniServer/www/tids/extensions/SemanticResultFormats/Exhibit/exhibit/locales/en-US, referer: http://localhost/tids/index.php?title=Test

and

File does not exist: C:/UniServer/www/tids/__history__.html, referer: http://localhost/tids/index.php?title=Test

cheers

Msevero 03:31, 26 March 2010 (UTC)

(math) Thousand separator
Hi

I'm using SVN version recently a code was added for a thousand separator.Its nice to have that separator but problem is if the result is being parsed (#expr:) it create a parser error. I was wondering if there's any solution or work around ?

cheers

Msevero 06:26, 7 April 2010 (UTC)


 * This is a bug that should be fixed, IMO. I propose that, when at least one of the additional properties has the 'raw' output format specified (?Additional property#-), the math result formats' output should also be 'raw', i.e. without thousands separators. If that's not possible, there should be a new parameter to the math result formats to get the old behaviour back. In our Wiki, the output of an #ask query with 'sum' result format gets multiplied by a number, using the #expr parser function. This multiplication does no longer work, because of the thousands separator. --Patrick Nagel 06:28, 5 July 2010 (UTC)
 * For now I changed line 24 of Math/SRF_Math.php to 'return $this->getResultText($results, SMW_OUTPUT_HTML)' to get back the old behaviour. --Patrick Nagel 06:36, 5 July 2010 (UTC)

latest available version
Hi Yaron,

though 1.4.5 was officially released it is presently only possible to get older versions conveniently


 * MediaWiki Extensions downloader → latest available version is 1.4.3 (trunk switched off)
 * SourceForge → latest available version is 1.4.2
 * Semantic Bundle extension set → latest available version is 1.4.3

Is there anything that may be done to change this at least to 1.4.5? I just saw 1.5 might be ante portas soon. :-)

Cheers --kgh 17:05, 13 April 2010 (UTC)


 * The current version of Semantic Bundle includes SRF 1.4.5, doesn't it? Yaron Koren 20:16, 13 April 2010 (UTC)


 * You are right. Do not ask me how I came to think 1.4.3 was still included instead of 1.4.5. Thus I would like to apologise. However I hope my post was not entirely useless with regard to the other two sources. Cheers --kgh 20:48, 13 April 2010 (UTC)

SRF Pop UP
Has anyone one else has an issue with SRF producing a pop up ad? when ever I would got to a page that used SRF it would produce a pop up. At first I thought my security had been compromised but then narrowed it down to SRF. I commented out the call to SRF in my code and do not have the issue any more.

kpf 06/21/2010


 * What format(s) were you using? Yaron Koren 19:36, 21 June 2010 (UTC)


 * format=exhibit
 * views=map,tiles,tabular

I suppose it could be my local version of SRF although SRF seems to make some sort of contact with a computer at MIT.

kpf 06/21/2010 16:36 PDT


 * Ah - that's the 'exhibit' format, then. I don't know what the issue is there, but using the rest of SRF shouldn't cause problems. Yaron Koren 12:02, 22 June 2010 (UTC)

Seems that Timeline/SRF_Timeline.php needs update
It uses deprecated functions getXSDValue and getNumericValue which results in a error "Fatal error: Call to undefined method SMWPropertyValue::getXSDValue"... with MediaWiki v.1.16.0, SemanticMediaWiki v.1.5.2 and Semantic Result Formats v.1.4.6. I have simply replaced getXSDValue by getWikiValue and getNumericValue by getValueKey in /Timeline/SRF_Timeline.php file, and timeline started to work fine. I'm new to MW&SMW, so I can mistake with the versions compatibility... --Peryshkin 20:47, 14 September 2010 (UTC)


 * You should switch to a more recent version of Semantic Result Formats - 1.5 or higher. Yaron Koren 05:59, 15 September 2010 (UTC)


 * But I've downloaded the extension by "Download snapshot" link, choosing 1.16.x MW version. How can I get SRF 1.5? I tried to "Browse source code" (http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticResultFormats/Timeline/SRF_Timeline.php?view=markup) and immediately ran into getXSDValue at line #69... --Peryshkin 11:24, 15 September 2010 (UTC)


 * Same with "Development Version (trunk)"--Peryshkin 11:26, 15 September 2010 (UTC)


 * Hi - you should definitely always use the "Development Version" one; the other ones are just pointless and misleading. And yes, that function is in the code, but it's within an 'if' call so that it shouldn't get called if you're using the latest SMW. What is your current version of SRF, according to the Special:Version page? Yaron Koren 11:48, 15 September 2010 (UTC)


 * Hi! Thanks for comments. Now I see, I just wanted the 'stable' release :). With development version it shows "1.5.2 alpha". Sorry for bothering, the third day of experiments with MediaWiki...--Peryshkin 12:46, 15 September 2010 (UTC)


 * If it gives you an error with the latest version of SMW and SRF, that's a real bug - I would write the semediawiki-user mailing list about it. Yaron Koren 15:38, 15 September 2010 (UTC)


 * No, with 1.5.2a it's okay. --Peryshkin 17:14, 15 September 2010 (UTC)


 * Ah, now I get it. Yaron Koren 20:34, 15 September 2010 (UTC)

extending exhibit views
I'd like to extend this so I can add some new views to the Semantic Result Formats exhibit format, but I'm having trouble figuring out the best way to get started. Does anyone have any tips or know of some good tutorials I could look at? Thanks! --Klh5u 22:15, 8 November 2010 (UTC)

Streamlining author list
Hi, why not streamlining the list of authors shown on Special:Version since this extension now moves into the third line? An example would be Semantic MediaWiki. There the core contributors are shown together with a list of all contributors, e. g. for this extension http://www.ohloh.net/p/srf/contributors] Cheers --&#91;&#91;kgh&#93;&#93; 15:35, 17 December 2010 (UTC)