Extension talk:Semantic Result Formats

exhibit again
With following extension is the exhibit rendering with format= exhibit, views = map not working anymore

Is there a reason for tha?

Mediawiki 1.17

Semantic Forms (Version 2.2) 	(r92541)

Semantic Maps (Version 1.0.1 alpha) 	(r92632)

Semantic MediaWiki (Version 1.6 RC1) 	(r92547)

Semantic Result Formats (Version 1.6 rc1)

Maps 1..

Cheers Solab

Google Pie Features
here is my example: http://www.ratingstars.org/en/test

1)i'd like to limit results in chart to some number. "|limit=10" doesn't work. all the other votes should be displays as "other". 2)some text is doubled

Display Average Of
my article contains a few the same properties (ratings from different sources)
 * rating: 5.0
 * rating: 10.0

i want to display the average (7.5), but when i use format=sum it shows "5.0, 10.0". i even tried MathStatFunctions Extension to display but i don't know how to insert smw properies inside this query  ???


 * Did you try "format=average"? Yaron Koren 19:08, 3 January 2011 (UTC)


 * yes i tried, but i don't get any other result other than the default format=table.

check out here: section "test average"


 * Where's the link? Yaron Koren 22:20, 10 January 2011 (UTC)

http://www.ratingstars.org/en/ratings_and_reviews


 * Ah - it's because your properties aren't defined, and thus are assumed to be of type "Page". You have to define them as type "Number". Yaron Koren 17:39, 11 January 2011 (UTC)

okay, i've defined the properties. and i have the same results (nothing is displayed when i use format=sum or =average


 * I think you need to capitalize both "Has type" and "Number". As long as the values show up as links, it means it hasn't been done correctly. Yaron Koren 18:05, 11 January 2011 (UTC)

okay, i did it. right now the page is blank and my server error log show this error.the same on my both reviews sites.ratingstars and komentarz.org (polish version) PHP Fatal error: Call to undefined method SMWNumberValue::getNumericValue in /www/oftaldent/html/ratingstars/english/extensions/SemanticResultFormats/Math/SRF_Math.php on line 41, referer: http://www.ratingstars.org/english/index.php?title=ratings_and_reviews&action=edit


 * You should upgrade your version of SRF - you're using a very old one. Yaron Koren 18:26, 11 January 2011 (UTC)

works perfect now. thank you so much Yaron! right now i'll be working on using W4G Rating Bar with semantic mediawiki to aggregate own ratings and external updated manually like imdb for movies, tucows for software etc. it will be a great website. join the project if you like it.http://www.ratingstars.org/en/michael_jackson

include php inside atribute
i'd like to put some number (number of users) from mysql inside a atribute users::I WANT NUMBER HERE .how can i do that?i tried by creating a php file and extension called "Include" but it doesn't work like this: users::


 * You should use the External Data extension. Yaron Koren 23:15, 12 January 2011 (UTC)

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
 * $srfgFormats = array('graph', 'process', 'googlebar', 'googlepie', 'jqplotbar', 'jqplotpie', 'ploticus', 'timeline', 'eventline', 'calendar', 'average', 'sum', 'product', 'min', 'max', 'median', 'bibtex', 'icalendar', 'vcard', 'gallery', 'exhibit', 'outline', 'tagcloud');

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)
 * It looks like this was reported in 2010: https://bugzilla.wikimedia.org/show_bug.cgi?id=23184 Badon 01:20, 22 July 2011 (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)


 * The problem is that SRF doesn't have a set of core contributors the way SMW and other extensions do - each format is pretty much standalone. There are probably some names that could be removed, but not that many, short of removing, say, everyone other than me and Markus. Yaron Koren 19:33, 3 January 2011 (UTC)


 * True. Since everyone who contributed a format type or maintains this extension deserves to be named everything should stay as it is now. I guess not even every contributor is on ohloh.net either. So this is not an option. Cheers --&#91;&#91;kgh&#93;&#93; 13:07, 4 January 2011 (UTC)

[outline] Table instead of bulleted list
Hi, is it possible to get tables/broadtables within the hierchical structures of the outline format, i.e. having a result table instead of a bulleted list for each outlined property that exist? If not, that would be a nice feature. Thanks --Mlirette 19:20, 4 January 2011 (UTC)


 * It's not possible, and yes, it would be a nice feature - it's on the to-do list. Yaron Koren 23:24, 4 January 2011 (UTC)

Undefined variable
Hi, I got this error when trying to use GoogleBar Notice: Undefined variable: n in /media/dev/dev/public_html/rfwiki/extensions/SemanticResultFormats/GoogleCharts/SRF_GoogleBar.php on line 65 Notice: Undefined variable: n in /media/dev/dev/public_html/rfwiki/extensions/SemanticResultFormats/GoogleCharts/SRF_GooglePie.php on line 64

[outline] Depth greater than three
Imagine trying to use this format for a family tree. Almost everyone in a group would have a property PARENT::, except for the older generation. If you did this you would end up with most people on the list several times, once as a parent and again as a child. If you add an automatically-calculated property GRANDPARENT::, you could expand the search to but if you have more than three generations deep, you haven't solved the problem of people being listed more than once. You could add the criterion  and only get one branch of the tree, but that isn't really solving the problem.

Basically, is there no way to make an outline of things with a depth greater than three level? --Aquatiki 19:42, 5 February 2011 (UTC)

Timeline, Dates < 1000 bug
I've done some searching but can't find any solution to get SRF's Simile timeline to display dates before the year 1000. Instead, the whole timeline breaks, displaying only a grey background. It looks as though this bug has been noted once before in November, http://www.mail-archive.com/wikibugs-l@lists.wikimedia.org/msg53984.html, but I couldn't find any resolution. Does anyone know which javascript file this bug might be occurring in? --Zenithius 18:07, 28 March 2011 (UTC)

Timeline showing in Firefox but not IE9
I have nothing displaying in the timeline in IE9 but works just great in Firefox. Anyone know what could cause that?

Thanks,

Mats 173.11.1.205 18:50, 16 June 2011 (UTC)


 * Update: I get an Invalid Argument error in both IE8 & IE9 at line 36 in ether-painters.js. Am I the only one that gets this?
 * Query used:
 * Mats 173.11.1.205 16:26, 17 June 2011 (UTC)
 * Mats 173.11.1.205 16:26, 17 June 2011 (UTC)

exhibit
With following extension is the rendering with format= exhibit, view = map not working anymore

Is there a reason for tha?

Mediawiki 1.17

Semantic Forms (Version 2.2) 	(r92541)

Semantic Maps (Version 1.0.1 alpha) 	(r92632)

Semantic MediaWiki (Version 1.6 RC1) 	(r92547)

Semantic Result Formats (Version 1.6 rc1)

Maps 1..

Cheers Solab


 * Hey. Exhibit is no longer actively maintained. So I'm afraid no one will help you out on this one, and more importantly, I doubt the issue itself will get fixed. --Jeroen De Dauw 19:38, 20 July 2011 (UTC)


 * Just to clarify, it might be more accurate to say that the exhibit format is not currently maintained - I'd say there's a reasonable chance that someone will eventually work to fix all the bugs in it, given how much interest there still is in it. Yaron Koren 22:17, 20 July 2011 (UTC)

Smart Timeline
A group of students developed a Scalable Vector Graphic timeline as a SRF result printer. The code is not yet ready for a production environment but you might want to have a look.

Project Website

Demo Server (german)

Comments are welcome. --Pskiebe 23:01, 24 July 2011 (UTC)


 * This looks awesome! I think it would be a great addition to SRF, and I hope you can get it production-ready. My only comment is that maybe there's a better name for this format than "smarttimeline" - what does that say about the other timeline format? :) You could call it "svgtimeline", though that might be a bit boring... Yaron Koren 00:47, 25 July 2011 (UTC)


 * Whow, great work! And looks pretty stable already... - Keep going and hope to see this as part of SRF soon! --Achimbode 09:49, 28 July 2011 (UTC)

SRF 1.6 : problems with timelines
I get some trouble when I try to use timeline, after upgrading to SFR 1.6 + SMW 1.6. For instance : I just returned to SMW 1.5.6 and SRF 1.5.3 where it works --Varlin 18:49, 2 August 2011 (UTC)
 * Call to undefined method SMWTimeValue::getDayNumberForMonth....
 * and another error with a SMW_DV_Time.php... I don't remember

jqPlotBar: charting multiple properties (possible feature request?)
Is there any way to chart multiple properties in multiple bar colors whose x-axis label is grouped by PAGENAME? Such an example is in the image below (taken from the example from jqplot)?



Assuming some pages where PAGENAME = "May", PAGENAME = "June", et al. have the numeric properties hotel, event registration, and airfare, what I am imagining is the above chart being a result of such an SMW query:

Currently, such a query would return a chart with x-axis label whose value is PAGENAME and appear under each bar, which are all the same color.
 * It would be nice to see such a functionality but instead of having a separate logic, Extension:Semantic Compound Queries should be used to group relevant properties together so that format=jqplotbar could display them as compound group. This would require that format=jqplotbar and Semantic Compound Queries somehow work together.--MWJames 15:07, 9 August 2011 (UTC)


 * Yes, it would be great to have this functionality, but it's not possible yet. You can see from the first item here that such a thing has already been requested. Yaron Koren 20:17, 9 August 2011 (UTC)