[06:26:27] New patchset: Mwjames; "Move fixedProperties to Settings" [mediawiki/extensions/SemanticMediaWiki] (master) - https://gerrit.wikimedia.org/r/65681 [06:43:14] New patchset: Mwjames; "Move fixedProperties to Settings" [mediawiki/extensions/SemanticMediaWiki] (master) - https://gerrit.wikimedia.org/r/65681 [10:20:27] hi guys [10:21:10] can you help me please? ^^ [10:30:25] izabera: depends [10:30:31] what seems to be the matter? [10:30:53] hi :) [10:31:06] i need to do a query [10:31:59] it's about a semantic mediawiki implemented for wizard101, a mmorpg [10:33:06] my items have properties like [[StormDamage]] or [[FireDamage]] [10:33:27] how do i list those with StormDamage > FireDamage? [10:34:17] that sounds like work for a template [10:35:04] {{#ask: [[StormDamage::+]][[FireDamage::+]]|format=template|template=StormDamageGreaterThenFireDamage}} [10:35:47] then in that template, use {{#show:{{{1}}}|?StormDamage}} and {{#show:{{{1}}}|?FireDamage}} [10:36:56] ok [10:37:28] I see the props have unit "quantity" that is expressed as a percentage [10:37:47] you'll have to manipulate the results of the #show to bring them back to comparable numbers [10:38:37] or maybe change the units of Quantity to also return absolute numbers, i.e. 10% = 0.1 [10:38:59] i think those are absolute numbers already [10:40:28] mebby, but StormDamage has this: [10:40:29] [[Has type::Quantity]] [10:40:29] [[Corresponds to::1 %]] [10:41:06] thus, a #show will report in percent, with the percent sign. [10:42:21] ok and... about the manipulation part... [10:42:36] how do i compare them? XD [10:42:53] >.< [10:44:24] i thought it was possible to do something like [10:44:28] That's standard MediaWiki work [10:44:41] extension ParserFunctions, stuff like that [10:46:26] you have Variables and ParserFunctions enabled, so no prob there [10:46:52] if you stuff your properties in variables, you can do an #ifexpr on those [10:47:08] so... something like this? [10:47:11] {{#vardefine:stormdamage| {{#show:{{{1}}}|?StormDamage}} }} [10:47:12] {{#ask: {{#ifexpr: [[StormDamage]] > [[FireDamage]] | display-this-item | don-t-display-it}} [10:47:27] izabera: no you can't [10:47:41] yep i know i cant, i tried ;_; [10:48:01] the inline query selects pages, the format is {{#ask: |}} [10:48:23] but the condition you want cannot be expressed [10:48:46] thus you select all pages that have both properties set, then send those pages to a template that can decide to show the page or not [10:48:56] oh ok [10:49:28] in the template you grab the two props from the page that fits the cndition, compare them, then print if appropriate [10:50:55] ah, got it - you can lose the percentage sign according to http://semantic-mediawiki.org/wiki/Help:Displaying_information#Display_format [10:51:44] if you use {{#vardefine:stormdamage| {{#show:{{{1}}}|?StormDamage # -n}} }} in the template, then a consecutive {{#var:stormdamage}} should return a pure number [10:52:12] ok :) [10:52:18] then how do i compare the values? [10:53:10] {{#ifexpr: {{#var:stormdamage}} > {{#var:firedamage}} | }} [10:53:21] http://www.mediawiki.org/wiki/Help:Extension:ParserFunctions#.23ifexpr [10:53:40] aaand this goes into the template, right? [10:54:41] yes [10:55:11] hmm, you can even simplify that template by having the query itself report the properties to the template [10:55:45] {{#ask: [[StormDamage::+]][[FireDamage::+]]|?Stormdamage # -n|?FireDamage # -n|format=template|template=StormDamageGreaterThenFireDamage}} [10:56:08] then in the template, you've got the SD and FD ready for processing as fields {{{2}}} and {{{3}}} [10:56:24] no need for #show calls [10:56:29] great :D [10:57:59] you're awesome saruman, i owe you a beer [10:58:13] you're welcome [10:58:16] ^^ [10:59:27] well it's 13:00 here and this means lunch time for me XD [10:59:39] cya and tyvm :) [11:01:05] np have a nice lunch [16:13:49] Hello. Have problems combining my tag extension with SMW facts, doing things like: [16:13:50] [[Has Entrez ID::ENSG00000059804]] [16:13:56] ... won't work. [16:14:17] The value is shown on the wiki page, but is not recognized as a SMW fact. [16:14:31] Warning symbol with tooltip is shown, with message: "The given value was not understood." [16:14:43] prolly because of the < > symbols [16:15:09] Saruman, Yeah, was suspecting there is something with the parsing order [16:15:10] can you use [[Has Entrez ID::ENSG00000059804]] [16:15:24] Saruman, Will try! [16:15:42] and ofcourse this will always work: [[Has Entrez ID::ENSG00000059804|]]ENSG00000059804 [16:15:57] because the property is "invisible" because of the pipe [16:16:28] in a template this is easy: [[Has Entrez ID::{{{1}}}|]]{{{1}}} [16:17:12] Saruman, Hmm, this did not produce an error, but the desired behaviour, of converting the ID to another ID before setting the fact, did hot happen [16:17:20] s/hot/not/ [16:17:43] ah, your < > stuff needs to work on the prop? [16:17:48] ENSG00000059804 is supposed to be converted to something like 1607 [16:17:57] how about using the Variables extension [16:18:17] Saruman: Yeah, tried that too (Setting a variable first, and then use it), but I have the same problem. [16:18:43] well you're trying something funky [16:18:48] Even tried to add a small string to the converted ID, so that the fact that it is numerical only does not affect something ... still w/o success [16:19:07] Saruman: Yeah, seems I'm hitting some kind of corner case :/ [16:19:37] Unfortunately I have to do that part via a tag extension, I think, since it is querying an external URL to do the conversion. [16:19:53] (external REST service) [16:20:19] yah that's not what SMW is supposed to cover [16:20:33] it annotates information in the wiki itself [16:20:47] I get the impression that all templates / facts etc are parsed/expanded first, and only after that, tag extensions are taken care of ... :/ [16:21:00] prolly... [16:21:31] feels a bit like you must rethink your information model [16:22:28] Well, most things are normal facts. I just wanted to fill in facts with alternative ID types automatically, based on the primary ID type (which is used as PAGENAME)... [16:23:27] Maybe could do some javascript hack to fill in the actual fields in the Semantic Forms maybe ... [16:23:45] Will think about it. [16:23:56] Saruman, Anyways, thanks for the feedback! [16:24:15] you're welcome [16:25:14] I was also trying to get my tag extension to use another hook, but it seems the "ParserFirstCallInit" hook I'm using now, is already among the first ones ... [16:25:16] Well well. [16:28:32] samuell: I haven't been folllowing this whole conversation, but you might try calling "{{#tag:geneidconv|...}}" instead. [16:28:46] The difference between tag and parser functions might fix it. [16:28:53] yaron, will try! [16:29:11] Also, you could try #set instead of SMW's [[...]] notation - those two in combination might do it. [16:32:05] * samuell is trying ... [16:34:07] yaron, Nope ... neither only with #tag, #set, or in combination :/ [16:34:16] Really weird. [16:34:20] Oh well. :( [16:34:25] I should try to debug somehow ... [16:34:41] Could of course be something unrelated ... [16:34:46] You can look in the HTML to see if "geneidconv" is producing anything other than a simple string. [16:34:49] Think I have got such to work before [16:34:55] It might be adding some HTML to its output. [16:35:17] yaron, yep, I tried to do a PHP "echo" of the returned string, but it seemed to be clean ... [16:35:28] That won't work - look in the HTML source. [16:35:39] yaron, Ah, right ... will check [16:36:43] Nope, totally clean string. [16:39:12] Well, that's... very strange. [16:39:19] Same with the output of #tag? [16:43:38] yaron, Yeah [16:43:58] Weird! [16:44:14] Yes! [16:44:34] #vardefine and {{#var:... works fine for just displaying the value, but not for setting as fact! [16:44:45] So "{{#set:...an actual string...}}" works, but "{{#set:{{#tag:.....}} }}" fails? [16:45:25] I was first expecting it was something with the property, since it is has type string, and the value might have been interpreted as numerical ... [16:45:41] But tried to avoid that too, by adding a string bit to the value... [16:48:35] Ha! even this does not work: [[Entrez ID::a{{#var:Entrez}}b]] [16:48:53] ... should set "Entrez ID" to "ab" if the variable is empty, afaik [16:48:58] ... but nothing happens. [16:49:07] Gives an indication that something is really weird. [16:49:28] Probably some crap content coming from somewhere, somewhere. Gotta dig into that ... [17:37:37] Looking for idea, removed Page has default form from Template yet still persistes when looking at the pages properties [17:55:44] mightmare, You mean, the semantic data is not removed when the page is deleted? [17:56:09] * samuell has to leave