Re: [SMW-devel] Matrix result formatter

2011-06-01 Thread Patrick Nagel
Hi Igor,

On 2011-06-02 07:11, Igor Lobanov wrote:
> I'm looking for a way to produce matrices out of relations between
> arbitrary types of objects/pages in SMW. Simple example would be a
> 'traceability matrix' between pages within such categories as 'Business
> Requirement' and 'System Requirement'. Constructed matrix would have
> business requirements and system requirements as row and column headers
> respectively, while actual elements would be either emply (no
> traceability) or flagged (traceability exists).
> 
> Good example is provided in the Wikipedia article:
> http://en.wikipedia.org/wiki/Traceability_matrix
> 
> More complex example (one that I have in mind) would be based not on a
> simple relationship, but on internal objects representing relationships
> among various objects with additional scalar properties. In this case,
> cell content would be more flexible and somehow derived from the
> properties, e.g. color, icons, formatting, etc.
> 
> Next, I'm able to produce such matrices using a moderately complex
> incantation based on obscure things like arrays and loops, but it's
> O(NxM), needs to be tailored for a particular type of matrix, and look
> awful in general.
> 
> I believe that general-purpose matrix/pivot style result formatter for
> inline queries would be good for SMW. Moreover, I'd like to try to blow
> the dust from my PHP skills and actually produce one. What I'm looking
> for is some informed advice on how to approach this one.
> 
> My initial idea is to create an extension that introduces a
> {{#pivot...}} instruction that actually does underlying query and
> formatting. Does it make sense? Or it is something that can't be built
> outside the SMW core?

That sounds indeed very useful. I'm just a user of SMW, but I think the
best way to implement this would be as an extension similar to Semantic
Result Formats, or even better, within that extension. It would then not
be a separate parser function, but just an output format, that can be
chosen via the 'format' parameter to an #ask query.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4



signature.asc
Description: OpenPGP digital signature
--
Simplify data backup and recovery for your virtual environment with vRanger. 
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Data protection magic?
Nope - It's vRanger. Get your free trial download today. 
http://p.sf.net/sfu/quest-sfdev2dev___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] Problem with SMW and MySQL 5.1.49..52

2011-04-08 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

I first encountered this in October 2010, when I switched to MySQL 5.1.50 on
a testing system (while the production system is still running MySQL
5.0.91). The simple query

{{#ask: [[Category:Freelancers]] [[Joe Smith]] }}

suddenly returned nothing on the testing system, although page "Joe Smith"
is in the Freelancers category.

After lots of digging through all the layers, ruling out one component after
another, I can now say with confidence, that the problem is in MySQL server
versions 5.1.49, 5.1.50, 5.1.51 and 5.1.52. I have been told that it's
caused by a bug in the 'index_merge' behaviour, which is present in these
versions.

For details, have a look at the testcase I built and documented at [1]. A
simple SQL query like "SELECT * FROM smw_inst2 WHERE smw_inst2.s_id=9877 AND
smw_inst2.o_id=650;" exposes the bug.

I have been told that SMW could work around that index_merge bug by changing
the separate indexes to a compound index. I tried it for the smw_inst2
table, and SMW then gives the expected result in the exact query above.
There are other non-compound indexes in various SMW database tables though,
and I don't know enough about the exact problems caused by the index_merge
bug to be sure that transforming the indexes of just the smw_inst2 table
into a compound index will guarantee that no other queries will return
incorrect results. It would be great if someone with deeper knowledge of
MySQL and indexes could clarify.

For now, I recommend to avoid these MySQL server versions.

Patrick.

[1] http://p173.de/gp/index.php?id=7e1bee97ab&view=nl

- -- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.17 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk2fHs4ACgkQyYHmhobjRtQunQCg1kzYcm4kApGJqSFN4FCoWAFr
asIAnRmNgJAayERjkI36a56TM1edOe0T
=STpH
-END PGP SIGNATURE-

--
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [SF] Patch to bring back IDs for SFDateInput

2011-01-19 Thread Patrick Nagel
 Hi Yaron,

 On Wed, 19 Jan 2011 09:26:41 -0500, Yaron Koren wrote:
> Okay - that sounds like a perfect case where jQuery can let you use
> classes instead of IDs. The key is that the buttons have to be
> contained within the same div or span as the date input - if you can
> get that to happen (or maybe thats how it works already), then its
> pretty easy to get each button to affect only its corresponding date
> input, without the use of IDs.
>
> You can see that strategy being used in a few places here:
>
> 
> http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/SemanticForms/libs/SemanticForms.js?view=markup
> [5]
>
>  [6]For instance, this section of code is the beginning of the
> "addInstance" function, which is attached to every "Add another"
> button:
>
> jQuery.fn.addInstance = function() {
>
> ...
>
>  // Create the new instance
>  var new_div = this.closest(".multipleTemplateWrapper")
>  .find(".multipleTemplateStarter")
>  .clone()
>  .removeClass(multipleTemplateStarter)
>  .addClass(multipleTemplateInstance)
>  .addClass(multipleTemplate) // backwards compatibility
>  .removeAttr("id")
>  .css("display", "block");
>
> ...and then elsewhere in the code, theres this line:
>
>  jQuery(.multipleTemplateAdder).click( function() {
> jQuery(this).addInstance(); } );
>
> If I can give a mini-jQuery tutorial: "addInstance" gets defined as a
> function for any page element - in this case, it gets used for "Add
> another" buttons. When the function is triggered (via a click), the
> code looks for the buttons parent div with the appropriate class (the
> closest() function), then finds, within that div, the sibling element
> that it needs to act on (the find() function), then acts on it (all
> the rest). The key to this is that every relevant part of the
> structure needs to have its own class.
>
> It looks a little weird, and it takes a little getting used to this
> way of doing things, but it really makes life simpler over the long
> run - and theres some good documentation for jQuery online.
>
> I hope you can get it working...

 Ok, thanks for the mini tutorial, I'll see how to migrate my extension 
 to jQuery then.

 Thanks,
 Patrick.

-- 
 Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
 Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [SF] Patch to bring back IDs for SFDateInput

2011-01-18 Thread Patrick Nagel
Hi Yaron,

On 2011-01-17 13:56 UTC Yaron Koren wrote:
> Could you explain what your SFDateInput extension does? The general
> approach when using jQuery, which I've tried to get SF to follow, is to
> use classes instead of IDs whenever possible - it leads to significantly
> simpler code. Is it possible that your extension could do the same thing?

It simply adds buttons that let users enter 'today', 'tomorrow', or 
'yesterday' with one click.

I don't know how I could use classes in that case - the buttons next to a date 
input should only enter the date into one specific DateInput, not into all 
DateInputs. I think I need something (IDs?) to uniquely address each field, 
don't I?

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4


signature.asc
Description: This is a digitally signed message part.
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] [SF] Patch to bring back IDs for SFDateInput

2011-01-17 Thread Patrick Nagel
Hi,

today I updated from SF 1.9.1 to 2.0.8, and found my custom SFDateInput
enhancement extension to be no longer working.
Since the extension provides JavaScript to fill in Year/Month/Day with
one click, it requires the year/month/day fields to have IDs. The
attached patch to SF (r80431) re-introduces IDs to year/month/day fields.

I didn't add IDs to hh/mm/ss, but maybe that's also a good idea. Also,
maybe the $input_id parameter to monthDropdownHTML() should be moved to
the left, for consistency, but I didn't want to break any other
(possible) code that calls monthDropdownHTML().

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
--- SemanticForms/includes/SF_FormInputs.php2011-01-17 16:41:09.0 
+0800
+++ SemanticForms.modified/includes/SF_FormInputs.php   2011-01-17 
15:26:53.0 +0800
@@ -645,7 +645,7 @@
 }
 
 class SFDateInput extends SFFormInput {
-  static function monthDropdownHTML( $cur_month, $input_name, $is_disabled ) {
+  static function monthDropdownHTML( $cur_month, $input_name, $is_disabled, 
$input_id = 0 ) {
 global $sfgTabIndex, $wgAmericanDates;
 
 $optionsText = "";
@@ -660,6 +660,7 @@
   $optionsText .= Xml::element( 'option', $optionAttrs, $name );
 }
 $selectAttrs = array(
+  'id' => $input_id . '_month',
   'class' => 'monthInput',
   'name' => $input_name . '[month]',
   'tabindex' => $sfgTabIndex
@@ -703,14 +704,14 @@
 }
 $text = "";
 $disabled_text = ( $is_disabled ) ? "disabled" : "";
-$monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled );
-$dayInput = '  ';
+$monthInput = self::monthDropdownHTML( $month, $input_name, $is_disabled, 
$input_id );
+$dayInput = '  ';
 if ( $wgAmericanDates ) {
   $text .= "$monthInput\n$dayInput\n";
 } else {
   $text .= "$dayInput\n$monthInput\n";
 }
-$text .= '  ' . "\n";
+$text .= '  ' . "\n";
 return $text;
   }
   


signature.asc
Description: OpenPGP digital signature
--
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand 
malware threats, the impact they can have on your business, and how you 
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] How update properties of a page via API?

2010-11-30 Thread Patrick Nagel
Hi,

On 2010-11-23 06:25, mo...@gmx.net wrote:
> My goal is to automatically update the value of a specific property in an 
> article. 
[...]

I use the pywikipedia bot framework for the task, and apply regular
expression search & replace operations on the template calls. It's a bit
slow, but it's reliable and straight forward.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4



signature.asc
Description: OpenPGP digital signature
--
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Slow/redundant refreshLinks queries

2010-09-25 Thread Patrick Nagel
Hi Daniel,

thanks for your performance tuning tip, it's appreciated! I'm running a 
SMW-Wiki that's growing quickly, and I fear that soon a runJobs session will 
take longer than the alotted maintenance interval. Having runJobs during 
operation slows down the system too much, so that's not an option.

Patrick. 

"Daniel Ring"  wrote:

>In case anyone is following this:
>
>I found MySQL didn't always use the new index, even when it
>improved performance (at least in the cases I checked), but
>this was resolved by removing the previous index (which was
>redundant at this point, anyway):
>
>ALTER TABLE smw_rels2 DROP INDEX o_id;
>
>
>Excerpts from Daniel Ring's message of Fri Sep 24 16:31:30 -0400 2010:
>> I've made a bit of progress, I think:
>> 
>> Adding this composite index to smw_rels2 appears to decrease the
>> time of the 'SELECT DISTINCT...' query to about 10% of original,
>> and decreases the time of the 'runJobs' jobs to about 20-25%.
>> 
>> ALTER TABLE smw_rels2 ADD INDEX idx_o_id_p_id USING BTREE (o_id, p_id);
>> 
>> I assume this could replace the existing index on o_id, but I have
>> not actually tried it.  I also don't know what compatibility issues
>> arise with composite indexes.
>> 
>> Excerpts from Daniel Ring's message of Tue Sep 21 13:38:59 -0400 2010:
>> > I'm having an issue with seemingly slow and redundant queries during
>> > runJobs.  I'm using MW 1.15.5 and SMW 1.5.2, upgraded from 1.15.1 and
>> > 1.5.1 respectively.  (The upgrade didn't noticably change the speed 
>> > or redundancy).
>> > 
>> > There are a few templates which are used by many pages, the worst
>> > case so far being ~120k uses of a single template which turns the
>> > ~15 template parameters into ~10 properties, a category, and a page.
>> > It uses #if and uses other templates, (wrapping the other template
>> > calls in 'noinclude' doesn't appear to affect the runtime) and is
>> > basically unremarkable.
>> > 
>> > So, running 'runJobs' gives output like the following:
>> > 
>> > With --procs=1
>> > 
>> > 
>> >   2010-09-21 16:14:17 refreshLinks2 Template:TX_Facility start=361172 
>> > end=362192 t=2407915 good
>> >   2010-09-21 16:53:19 refreshLinks2 Template:TX_Facility start=362193 
>> > end=363233 t=2341932 good
>> > 
>> > (E.g. ~40min per refreshLinks2 with start-end range ~1000)
>> > 
>> > With --procs=? (I don't remember, but with --procs=1, these were
>> > t=~3500 and increase proportionally with procs, so I think the DB
>> > is the bottleneck.)
>> > 
>> > 
>> >   2010-09-18 14:00:07 refreshLinks 42-009-34059_(TX_Facility) t=22856 good
>> >   2010-09-18 14:00:35 refreshLinks 42-001-31705_(TX_Facility) t=28058 good
>> >   2010-09-18 14:01:04 refreshLinks 42-003-01936_(TX_Facility) t=28900 good
>> > 
>> > 
>> > Watching the SQL log, I see it pause at this query:
>> >   SELECT /* SMW::getInProperties 127.0.0.1 */  DISTINCT 
>> > smw_title,smw_sortkey
>> > FROM `smw_ids` INNER JOIN `smw_rels2` AS t1 ON t1.p_id=smw_id  WHERE 
>> > t1.o_id='42720'
>> > 
>> > 
>> > And in the MySQL shell I get:
>> > 
>> > 
>> > mysql> SELECTDISTINCT smw_title,smw_sortkey   FROM `smw_ids` INNER 
>> > JOIN `smw_rels2` AS t1 ON t1.p_id=smw_id  WHERE t1.o_id='42720';
>> > +--+--+
>> > | smw_title| smw_sortkey  |
>> > +--+--+
>> > | Well_number  | Well number  | 
>> > | State_number | State number | 
>> > +--+--+
>> > 2 rows in set (5.98 sec)
>> > 
>> > mysql> SELECTCOUNT(*)   FROM `smw_ids` INNER JOIN `smw_rels2` AS t1 ON 
>> > t1.p_id=smw_id  WHERE t1.o_id='42720';
>> > +--+
>> > | COUNT(*) |
>> > +--+
>> > |   123037 | 
>> > +--+
>> > 1 row in set (5.56 sec)
>> > 
>> > 
>> > The redundancy is that the SELECT DISTINCT output is the same
>> > every time.  MySQL query cache is on, and Memcached is used, but
>> > neither made a noticable difference.  (I assume some other query
>> > during runJobs invalidates it...)
>> > 
>> > So, is this a bug or am I doing something totally wrong?
>> > 
>> > Thanks,
>> > Dan
>
>--
>Start uncovering the many advantages of virtual appliances
>and start using them to simplify application deployment and
>accelerate your shift to cloud computing.
>http://p.sf.net/sfu/novell-sfdev2dev
>___
>Semediawiki-devel mailing list
>Semediawiki-devel@lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

--
Sent from my Android phone with K-9. Please excuse my brevity.

--
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net

Re: [SMW-devel] Adding autocompletion for printouts to Special:Ask

2010-08-16 Thread Patrick Nagel
Hi,

On 2010-08-17 02:16, Yaron Koren wrote:
> Sanyam (who is cc'ed) has been working hard on his Google Summer of Code
> project, which has been about converting SMW and various of its
> extensions to use the jQuery Javascript library, and to generally use
> more Javascript. The project is basically done now, and you'll be
> hearing a lot more about it later, including from Sanyam.

Great news, thanks! :)

> For now, I
> just wanted to ask one question - I'm planning to start checking in a
> lot of Sanyam's code to SVN soon, and there's one change to Semantic
> MediaWiki itself that I wanted to ask about. Sanyam added autocompletion
> for the "additional data/printouts" textarea, which you can see here if
> you start typing:
> 
> http://discoursedb.org/wiki/Special:Ask
> 
> I just wanted to know if anyone thinks this autocompletion is a bad
> idea, or has any comments/criticisms about the specific look-and-feel of it.

It looks very useful, and it will make figuring out a query much much
easier. I often found myself switching between an example page's Browse
properties page and Special:Ask, and copy- and pasting the property
names into the 'additional data to display' field. That is no longer
necessary with this functionality - big improvement for the user!

I see a potential problem with Wikis that have a very large amount of
properties - Special:Ask would then load slowly, because all those
property names are in the page. Would it be possible to choose, like in
SF, between 'autocompletion' and 'remote autocompletion'? Also, the
dropdown does not have its own scrollbar, which looks a bit weird when
there are hundreds of properties in it - but it's not really a problem,
and I don't know if it would actually be better if the dropdown had a
scrollbar.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4



signature.asc
Description: OpenPGP digital signature
--
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev ___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] [SIO] SIO assumes SM is installed and causes DB errors when it's not

2010-06-25 Thread Patrick Nagel
Hi,

I just tried the latest SVN version of SIO, and am getting a database error on 
saving a page containing a #set_internal call:

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 "SIO::deleteCoordsData". MySQL returned error "1146: 
Table 'wiki.sm_coords' doesn't exist (localhost)".

I believe SIO should first make sure, SM is installed (or the relevant tables 
are present in the database), since SM is not a prerequisite for SIO.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4


signature.asc
Description: This is a digitally signed message part.
--
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] Backwards incompatibility of SF 1.9? (was: Re: installing SF with mediaWiki 1.16)

2010-05-18 Thread Patrick Nagel
Hi Jack,

could you please elaborate on

On 2010-05-18 17:46 UTC Jack D. Pond wrote:
[...]
> without issues (except that I'm only half way through a 40+ hour job
> of updating wikis to accomodate the backwards incompatibility of SF
> 1.9).

?

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4


signature.asc
Description: This is a digitally signed message part.
--

___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] (SMW_QueryPrinter.php) SMW::on & SMW::off

2010-02-04 Thread Patrick Nagel
Hi John

On 2010-02-05 09:37, John McClure wrote:
> I've changed L154 of SMW_QueryPrinter.php to:
> --
> # $result = '[[SMW::off]]' . $wgParser->replaceVariables($result) .
> '[[SMW::on]]'; //old line
> $result  = $wgParser->replaceVariables($result);
> if( chr(13) == substr($result,0,1) ) //if there is an initial \r
> $result = substr($result,2);//skip over the initial \r\n
> --
> and it seems to work fine, giving my exactly as expected, that is, after
> adjusting the initial query to:
> {{#ask: [[Business:+]]
> [[Industry::{{FULLPAGENAME}}||[[:Category:+]][[{{#var:industries|+}}}
> }
> 
> Could someone tell me whether this change to SMW_QueryPrinter.php  is a BAD
> IDEA? What is the impact on SMW::parsePropertiesCallback where these tags seem
> (most) operative, via SMW::smwgStoreAnnotations?

I don't know, but I'd like to :)

Currently I use an ugly hack to remove those markers via StringFunctions:

{{#replace:{{#replace:  |[[SMW::off]]|}}|[[SMW::on]]|}}

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4



signature.asc
Description: OpenPGP digital signature
--
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [News] SVN update warning

2010-01-06 Thread Patrick Nagel
Hi Markus,

On 2010-01-06 09:27 UTC Markus Krötzsch wrote:
> The change will also introduce some fixed limit on how many values a
>  multi- valued property can at most have. It is currently set to 5.
>  If you have any such properties with more than 5 values then please
>  let me know.

Is this really necessary? I once had an application that would have used 
around 30 values in one multi-valued property (project details to be 
stored on an invoice page - which can cover multiple projects) - I 
didn't go for multi-valued properties though, since it's impossible to 
get the data out again in a useful way (which has been brought up a lot 
of times on these lists, by me and many others). I'm using Semantic 
Internal Objects now, but as Yaron pointed out, there are issues with 
it, that would require changes in SMW.

I really hope that your recent code changes will finally make it 
possible to have "bundles of values that belong together" stored in a 
property (or an internal object, or whatever other thing), and that it's 
possible to get them out again in a useful way - not introduce new 
limitations to that feature, that is really necessary as soon as you do 
something non-trivial with SMW.

If there must be a fixed limit, couldn't it be something like 2^14 - 
like Excel's maximum amount of columns (iirc)?

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4


signature.asc
Description: This is a digitally signed message part.
--
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev ___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [Semediawiki-user] Poll: How to call error property?

2009-08-03 Thread Patrick Nagel
Hi Markus,

On 2009-08-03 14:57, Markus Krötzsch wrote:
> Strictly speaking, a type is something that only a property has, so it could 
> be confusing to use it for values (I assume what you mean is "some value 
> given 
> to the property 'has' the wrong type").

Ok, scratch that :) I shouldn't write mails about topics like that at 02:48.

> Current proposals:
> 
> (1) Page1   error_for_property   Property:my_date_property
> (2) Page1   input_error_for  Property:my_date_property
> (3) Page1   has_improper_value_for   Property:my_date_property
> (4) Page1   has_wrong_type   Property:my_date_property
> 
> Further opinions are collected until this CET evening (you can also indicate 
> support for some of the existing ones). Then I will move forward with the 
> release.

Of 1-3 (4 being bogus) I like 3 most.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Poll: How to call error property?

2009-08-02 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Markus,

first of all, thanks for the upcoming new release! Highly appreciated :)

On 2009-08-02 21:32, Markus Krötzsch wrote:
> The upcoming SMW release 1.4.3 will introduce a property that helps to find 
> input errors: its value will be the page of the property that the wrong value 
> was assigned to. For example, if you put
> 
> [[my date property::not a date]]
> 
> on page "Test1" (where the property would expect a valid date), then SMW will 
> automatically store the value "Property:my date property" for "Test1". 
> 
> This is surely useful for maintenance. The question is how to call this new 
> special property. Sufficiently descriptive names tend to be unwieldy, as for 
> example "error for property" or "input error for". The point is that the 
> property takes another property as its value, not an error message.
> 
> User poll: How would you prefer this to be called?

How about "Has wrong type"?

Patrick.

- --
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkp132EACgkQyYHmhobjRtSjRgCguOWG814gc8w3sdWgtApzpMuS
ikIAoNIBtvOayPZdIxotqqKrR+s/Vu17
=bLc1
-END PGP SIGNATURE-

--
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] SMW_DV_Time progress report

2009-07-27 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Temlakos,

On Monday 27 July 2009 23:45:44 Temlakos wrote:
> 1.   Internationalize the twelve-hour clock conventions. I should
> mention in this connection that twelve-hour times are present in written
> documents only in America, Latin America (including Brazil), Korea,
> Russia, and China. Everywhere else uses 24-hour conventions in writing.
> For that reason, I do not propose to support this in German, French,
> Italian, or Polish. I do plan to support it in English, Spanish (for
> Latin-American usage), Korean, Russian, and Chinese.

Just a short comment: I have nearly never seen a written time with a.m./p.m. 
in (mainland) China. I have seen 上午/下午 (prefixed, like 上午9:40), but I would 
say 99% of the time they use the 24 hour clock in writing. Have a look at 
[1], it's quite complete and accurate, from what I can tell.

Patrick.

[1]: 
http://en.wikipedia.org/wiki/Date_and_time_notation_by_country#Greater_China

- -- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.11 (GNU/Linux)

iEYEARECAAYFAkpt2OEACgkQyYHmhobjRtQ1SgCfRRPGb9/mtPe9w7AhVc09AYRL
TaUAmwZx8mAimYWsDePZGgTLRmHL79/t
=XTEV
-END PGP SIGNATURE-

--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [SF] Buttons to conveniently fill in date fields

2009-07-26 Thread Patrick Nagel
Hi Yaron,

On 2009-07-25 01:39, Yaron Koren wrote:
[...]
> I would recommend instead following the code in SF itself, such as, as
> you note, the function dateEntryHTML() in /includes/SF_FormInputs.inc.
> If you use that as the model for your function, you should be alright.
> Note that global variables will still be accessible in your function,
> even though it's in a different extension.

Ok, that pointed me into the right direction, thanks!

I have now created my own SFCustomDateInput mini-extension which provides
'input type=customdate' (which adds Today and Yesterday buttons to 'input
type=date'). While I was at it, I also made a 'customdatetime' which reuses the
customdate code and removes the input field for seconds, since we never will
have to input such a precise point in time.

I have attached the extension as it is now. I guess its functionality won't be
very useful to anybody, but it may be useful as a sample for people who want to
create similar mini-extensions. It contains a lot of duplicated code from
includes/SF_FormInputs.inc.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
 __FILE__,
	'name'=> 'SFCustomDateInput',
	'version' => '0.1',
	'author'  => array( 'Patrick Nagel' ),
	'description' => 'Provides a custom date (customdate) and a custom datetime (customdatetime) input for Semantic Forms',
	'descriptionmsg'  => 'SFCustomDateInput-desc',
);

$wgExtensionFunctions[] = 'sfCustomDateInputSetup';

function sfCustomDateInputSetup() {
	global $wgParser, $wgExtensionCredits;

	// add the 'customdate' and 'customdatetime' form input types, if Semantic Forms is installed
	global $sfgFormPrinter;
	if ($sfgFormPrinter) {
		$sfgFormPrinter->setInputTypeHook('customdate', 'sfCustomDateInputHTML', array());
		$sfgFormPrinter->setInputTypeHook('customdatetime', 'sfCustomDateTimeInputHTML', array());
	}
}

function sfCustomDateInputHTML($date, $input_name, $is_mandatory, $is_disabled, $field_args) {
	global $sfgTabIndex, $sfgFieldNum, $sfgJSValidationCalls, $wgAmericanDates;

	// Use the normal dateEntryHTML function
	$normalDateEntryHTML = SFFormInputs::dateEntryHTML($date, $input_name, $is_mandatory, $is_disabled, $field_args);

	// Now add our customisations
	$input_id = "input_$sfgFieldNum";
	$disabled_text = ($is_disabled) ? "disabled" : "";

	// Today button
	$sfgTabIndex++;
	$normalDateEntryHTML[0] .= ' " . "\n";
	
	// Yesterday button
	$normalDateEntryHTML[0] .= ' " . "\n";

	return $normalDateEntryHTML;
}

function sfCustomDateTimeInputHTML($datetime, $input_name, $is_mandatory, $is_disabled, $field_args) {
	global $sfgTabIndex, $sfg24HourTime;

	// The following code is mostly copied from dateTimeEntryHTML (SF version 1.8, 2009-07-27)
	$include_timezone = $other_args['include_timezone'];
			
	if ($datetime) {
	// can show up here either as an array or a string, depending on
	// whether it came from user input or a wiki page
		if (is_array($datetime)) {
		if (isset($datetime['hour'])) $hour = $datetime['hour'];
		if (isset($datetime['minute'])) $minute = $datetime['minute'];
		if (! $sfg24HourTime) {
			if (isset($datetime['ampm24h'])) $ampm24h = $datetime['ampm24h'];
		}
		if (isset($datetime['timezone'])) $timezone = $datetime['timezone'];
		} else {
			$actual_date = strtotime($datetime);
			if ($sfg24HourTime) {
$hour = date("G", $actual_date);
			} else {
$hour = date("g", $actual_date);
			}
			$minute = date("i", $actual_date);
			if (! $sfg24HourTime) {
$ampm24h = date("A", $actual_date);
			}
			$timezone = date("T", $actual_date);
		}
	} else {
		$cur_date = getdate();
		$hour = null;
		$minute = null;
		$ampm24h = "";
		$timezone = "";
	}

	list($text, $_javascript__text) = sfCustomDateInputHTML($datetime, $input_name, $is_mandatory, $is_disabled, $other_args);
	$disabled_text = ($is_disabled) ? "disabled" : "";
	$text .= '   ';
	$sfgTabIndex++;
	$text .= '  :';

	if (! $sfg24HourTime) {
		$sfgTabIndex++;
		$text .= '   \n";
		$ampm24h_options = array('', 'AM', 'PM');
		foreach ($ampm24h_options as $value) {
			$text .= "$value\n";
		}
		$text .= "  \n";
	}

	if ($include_timezone) {
		$sfgTabIndex++;
		$text .= '  ' . "\n";
	}

	return array($text, $_javascript__text);
}
--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [SF] Buttons to conveniently fill in date fields

2009-07-22 Thread Patrick Nagel
Hi Yaron,

On 2009-07-22 22:06, Yaron Koren wrote:
> My personal opinion is that this doesn't seem like a useful feature -
> first, because I've never seen such a thing on a web date input; and
> second, because the SF date input already presets the current month and
> year, so (unless you're on the 1st of the month) it just saves you the
> trouble of writing the day. If anyone disagrees, feel free to chime in.

Fair enough.

> Having to maintain a patch for an extension is not good, though, so, if
> you want to keep this functionality even if it doesn't get added to SF,
> I would suggest creating a new mini-extension that defines this as a new
> form input, using SF's hook to add it to the system.

Sounds like a good solution. I had a look at SemanticGoogleMaps' code [1], but
I'm not clear about how to put everything together. How would I get
$sfgFieldNum just at the time when a dateEntryHTML had been called? Is there
some documentation on how everything works together that you could recommend?

Patrick.

[1]:
http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/SemanticGoogleMaps/

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] [SF] Buttons to conveniently fill in date fields

2009-07-22 Thread Patrick Nagel
Hi,

I brought this up before on the old Semantic Forms list [1]. At the time I
thought it was a viable solution to put my own custom made buttons into the
forms where I need them, and I used the HTMLets extension for that.

The problem with this solution is, that it's quite unmaintainable. I have to
specify the ID numbers of the HTML input elements, and as soon as I change the
form, those change, and have to be adjusted in the files that get included via
the HTMLets extension. So I thought it would be much better to have that
functionality directly in Semantic Forms (where the ID numbers are known).

Today I got around adding this to Semantic Forms, the patch against a recent
SVN checkout is attached. It adds a button titled "Today" and a button titled
"Yesterday" next to each date input. In our SMW/SF application it is desirable
to have this for all date input fields, but I guess in others, where the dates
are historical ones, or otherwise never "today" or "yesterday", they would be
useless. So this should probably be configurable, or maybe there should be two
new input types, 'date_buttons' and 'datetime_buttons', or something like that.

Or is this feature so useless to anyone else, that it should not be included in
Semantic Forms? Yaron, what do you think?

Patrick.

[1]: http://groups.google.com/group/semantic-forms/msg/eda41d40bda28d26?

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
Index: includes/SF_FormInputs.inc
===
--- includes/SF_FormInputs.inc	(revision 53634)
+++ includes/SF_FormInputs.inc	(working copy)
@@ -479,6 +479,24 @@
   $text .= SFFormInputs::monthDropdownHTML($month, $input_name, $is_disabled);
 }
 $text .= '  ' . "\n";
+
+// Button to conveniently input current date
+$sfgTabIndex++;
+$text .= '";
 return array($text, null);
   }
--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Adding n-ary relations/internal properties to SMW: a proposal

2009-03-09 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

(re-arranging the cited mail a bit, so that it can be read from top to 
bottom...)

> On Mon, Feb 2, 2009 at 2:02 PM, Markus Krötzsch 
>  wrote:
> 
>> Some brief comments from my side:
>> 
>> * What Yaron proposes is possible and makes sense.
>> 
>> * The reason that this was not implemented already was that we initially 
>> went for multi-valued properties as one way of allowing "complex
>> subobjects". I acknowledge that the use-cases for both approaches are
>> slightly different.
>> 
>> * There is no major technical challenge in implementing the idea Yaron 
>> proposes. In particular, multi-valued properties are already implemented
>> in a way that is very similar to what you would do for the proposed
>> "internal objects".
>> 
>> * The reason why multi-valued properties are not used a lot is, I think, 
>> the restricted way in which they can be used in queries, especially in 
>> printouts: you cannot display their components individually. The internal
>> object proposal addresses this by allowing queries to return internal
>> objects. I note that the same could be done for the values of
>> multi-valued properties.
>> 
>> * The previous change has many consequences on the API-level, and might 
>> affect a great amount of code in SMW and in extension. Currently, any
>> property has one datatype, where "Relations" point to wiki pages. The new
>> proposal would allow some properties to point to either a wiki page or to
>> an internal object. So one would need a unified API and processing for
>> both. This is the main work.
>> 
>> * I have another input syntax proposal: one could have a parser function 
>> #smwsection (the name is immaterial) that simply encloses normal wiki
>> text, but that associates all annotations that are contained therein with
>> an internal sub-object instead of with the page. The advantage is:
>> minimal syntax to memorize, usage of displayable or hidden properties
>> just like anywhere else. The disadvantage is: I have no idea how to
>> achieve this behaviour.
>> 
>> * Maybe most importantly: the proposal requires changes in the very core
>> of SMW, with good coordination with some extensions. I cannot take up
>> such a large extension project at the moment, since SMW needs to reduce
>> the size and complexity of its code (to support code review by
>> WikiMedia).
>> 
>> * Regarding Blank Nodes: No, this has nothing to do with blank nodes 
>> (bnodes). A bnode in RDF is syntactic object that is not referred to with
>> a URI. This is independent of the particular usage of that object in
>> modelling: as long as you have only a single document, you may exchange
>> URI-referenced objects with blank nodes without changing the semantics of
>> the document a lot (at least as long as the document is used as a
>> knowledge base that is "asserted", as opposed to "queried for"). The
>> advantage of using bnodes to represent "internal objects" is that is
>> saves the cost of coining new URIs. The disadvantage is that internal
>> objects then could not be identified across documents (e.g. when
>> comparing partial ontology exports) and that it reduces compatibility
>> with OWL DL. I think if we manage to come up with a name for displaing
>> the internal objects to the user, it won't be too hard to get them some
>> proper URIs, too.

On 2009-03-10 01:59, Yaron Koren wrote:
> I've thought more about this implementation. Given that (a) I still think a
>  parser function like "#internal_set" is the best approach to take, (b) no 
> one has brought up any major problems with the scheme, and (c) there's
> still an effort to keep SMW to a minimum size, I'm considering creating a
> separate extension, possibly called "Semantic Internal Objects", that would
> just handle an "#internal_set" function and, possibly, any special querying
>  (hopefully none) needed to display the data it would store. Are there any 
> objections to that idea?

Fiction:
Yaron implements this (what I consider core-)funtionality and SMW gets
code-reviewed by WikiMedia, and it gets into Wikipedia (which seems the reason
for this and other important improvements not being implemented in SMW itself,
kind of hindering the development):
People would then start to use SMW on a big scale. Thousands of annotations
and queries would be written within weeks. Very quickly the need for
multi-valued properties would arise and people would realise that they can't
get the data out again in a useful way, which would maybe lead to Yaron's
Semantic Internal Objects extension getting into Wikipedia as well.
How would this functionality ever get into SMW then?

What I'm trying to say: Once SMW gets widely used, such a change would be even
harder - and putting every new feature in yet another extension won't make the
system easier to understand and use, let alone deploy and maintain (on the
administration AND development side).

Markus, is there a roadmap for SMW?

Is SMW considered "ready for the 

Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi,

On 2009-03-05 20:15, Markus Krötzsch wrote:
>> There is one thing I'm not 100% sure about though: Your implementation
>> always prints out a complete date, like '2009-03-05' by printing out a
>> default of '01' for the MM and DD parts when they are undefined.
>>
>> The Wikipedia article describing ISO8601, section "General principles" [2]
>> says: "For reduced accuracy, any number of values may be dropped from any
>> of the date and time representations, but in the order from the least to
>> the most significant."
>>
>> So it would be possible to just omit the '-DD' or '-MM-DD' part when they
>> are undefined. I would prefer this over SMW implying that the date is "on
>> January the 1st" even though the precise point in time may actually be
>> unknown. What do you think?
> 
> I also read that article :-) I decided against using partial dates because I 
> assumed that it would complicate the life of people who use parser functions 
> to post-process the dates (I think this is the main application of using ISO 
> right now). Also, the old behaviour was to complete the date, so it recovers 
> the kind of downwards compatibility that was asked for.

Hm... but do you really think it's the right thing™ to let SMW invent a part
of the date even though that missing part may have been omitted deliberately?
As it is now, whenever you see "-01-01" you have to wonder: is it really
January 1st or did SMW make that up? I just don't feel very comfortable with 
that.

> One could introduce more strings than "ISO" to have more fine-grained 
> formatting options. But this gets us into the hell of date formatting (there 
> are far too many options there) and of localization (man common formatting 
> directives for dates are heavily biased towards English).

To be honest, I think we NEED to get into the "hell of date formatting". SMW
is nice and all, enabling us to store and query - but what does it help when
we can't get the stuff in exactly the way we need it out again? Maybe we could
extend the SRF extension and add all the date formatters there? Another
approach would be to let the *user* specify the output template (like it was
in some older SMW version, where strftime date formatting strings were
accepted, or based on MediaWiki's template "language" with a few
well-documented magic words that return the date parts, like
"__SMWYEAR4D__"...). I know there were problems because of a limited date
range with strftime, but for some (maybe many) users those problems are
actually more acceptable than just not having any options when it comes to
formatting dates.

I think this is really important - finding out that you can't get your queries
to return exactly what you want is a huge show-stopper for people trying to
*really* make use of SMW (more than just some proof of concept).

Patrick.

- --
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmwyEgACgkQyYHmhobjRtR4GACfdPYlcxCLTVDQlMGz1xlg5G6y
MO0An0AcCy3qKj1yVBRRZmXNbjK2jmnO
=3srF
-END PGP SIGNATURE-

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi Markus,

On 2009-03-05 20:10, Markus Krötzsch wrote:
> * I can imagine a global "date format" switch that may be set to ISO to make 
> it a default for all dates. But I do not know which printout modifier to use 
> for "normal" dates then (note that "ISO" is rather language neutral). I am 
> thus inclined to opt against this extension.

What about my proposal "localized"? Or maybe just "standard" or "normal"?

Patrick.

- --
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmvwjUACgkQyYHmhobjRtSkuwCfQtMPUex/n0W6XQMsmT0YZ/JL
qUUAoJF5J5KjCC1qExIyRtUvsFlQLJFH
=4tau
-END PGP SIGNATURE-

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
Hi Dmitriy,

On 2009-03-05 16:51, CNIT wrote:
>> I think it would be best to also have a possibility to set the 
>> SMW-wide default to ISO8601, like in my proposal. Adding a possible 
>> printout modifier value "localized" (which would override the SMW-wide 
>> default setting) would then give all possibilities.
[...]
> Only optionally. My users need localized dates.

Yes, it should be optional (as in a global variable that can be set in 
LocalSettings.php), imo. The default should stay at 'localized', for backwards 
compatibility.

 > I wonder whether the input of ISO8601 is accepted
 > (because the ISO8601 output may be given as input to another #ask
 > template)..
 > ISO should be interesting for templating (both input and output).
 > Dmitriy

There are a number of problems I discovered during a quick check:
Time zone designators are interpreted in the wrong way (try 
'2009-03-05T12:12:34+02:00', which should be output as '2009-03-05T10:12:34' on 
a Wiki that's running with UTC time and as '2009-03-05T18:12:34' on a Wiki 
that's running with China Standard Time timezone set). Or they cause the string 
to not be understood (try '2009-03-05T12:12:34+0200').

I'll try to come up with a patch that makes SMW understand more ISO8601 dates. 
I will only implement the (recommended) "extended format" (with hyphens / 
colons), not the "basic format" (without hyphens / colons). I don't know about 
week dates and ordinal dates yet, maybe in a second step.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-05 Thread Patrick Nagel
Hi,

it's me again... I thought some more about

On 2009-03-05 03:09, Markus Krötzsch wrote:
> I suggest a slightly different control interface, though. The output is 
> only a problem for #ask queries, right?My suggestion is to use the existing 
> "printout modifier" mechanism that works for #ask printouts, so that one can 
> choose for each single printout which format to use. Example:
> 
> {{#ask: ...
> | ?start date
> | ?end date#ISO
> }}

I think it would be best to also have a possibility to set the SMW-wide default 
to ISO8601, like in my proposal. Adding a possible printout modifier value 
"localized" (which would override the SMW-wide default setting) would then give 
all possibilities.

My reason behind this: I think users who are accustomed to the ISO8601 date 
format will find it peculiar to see the localised dates, which are still the 
unchangeable default in your implementation, and they show up in the Browse 
Properties output, for example.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-04 Thread Patrick Nagel
Hi Markus,

On 2009-03-05 03:09, Markus Krötzsch wrote:
>> Could something like this be included in SMW?
> 
> Yes. I suggest a slightly different control interface, though. The output is 
> only a problem for #ask queries, right? My suggestion is to use the existing 
> "printout modifier" mechanism that works for #ask printouts, so that one can 
> choose for each single printout which format to use. Example:
> 
> {{#ask: ...
> | ?start date
> | ?end date#ISO
> }}

That's probably better for most. I have to go through all #ask queries then, 
and append '#ISO' everywhere, but that's ok :)

> This will show a three column table with start date in localized format and 
> end date in ISO 8601 format. The ISO date is always completed (assuming 
> January and 01 as defaults for month and day as in sorting). The time 
> component may be omitted. If given, the time is separated by "T" as defined 
> in 
> the spec. Years are padded up to four digits, so you get things like 
> "0010-05-06". Negative years, as suggested by ISO, represent BC dates, with 0 
> corresponding to 1 BC, -1 corresponding to 2 BC, and so on.

Good catch, without the 'T' as separator between date and time it's not really 
ISO8601. Or at least something like "-MM-DD hh:mm:ss" (like in my patch) - 
according to [1] - "is considered two separate, but acceptable, representations 
- one for date and the other for time. It is then left to the reader to 
interpret the two separate representations as meaning a single time point based 
on the context".

> All implemented in SVN.

That was fast, thanks! :)

There is one thing I'm not 100% sure about though: Your implementation always 
prints out a complete date, like '2009-03-05' by printing out a default of '01' 
for the MM and DD parts when they are undefined.

The Wikipedia article describing ISO8601, section "General principles" [2] 
says: "For reduced accuracy, any number of values may be dropped from any of 
the date and time representations, but in the order from the least to the most 
significant."

So it would be possible to just omit the '-DD' or '-MM-DD' part when they are 
undefined. I would prefer this over SMW implying that the date is "on January 
the 1st" even though the precise point in time may actually be unknown. What do 
you think?

Patrick.

[1]: http://en.wikipedia.org/wiki/ISO8601#Combined_date_and_time_representations
[2]: http://en.wikipedia.org/wiki/ISO8601#General_principles

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] Patch to make SMW output ISO8601 dates

2009-03-04 Thread Patrick Nagel

Hi,

since I need our SMW to output ISO8601 date output (see [1]) I wrote a quick 
patch to SMW_DV_Time.php that honours the (newly introduced) 
$smwgISO8601DateOutput variable.


Could something like this be included in SMW?

Patrick.

[1]: 
http://sourceforge.net/mailarchive/forum.php?thread_name=49A223B5.1090608%40patrick-nagel.net&forum_name=semediawiki-user


--
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4
--- SMW_DV_Time.php.original	2009-03-04 18:13:46.0 +0800
+++ SMW_DV_Time.php	2009-03-04 18:07:15.0 +0800
@@ -404,7 +404,7 @@
 	 * from the store.
 	 */
 	protected function makePrintoutValue() {
-		global $smwgContLang;
+		global $smwgContLang, $smwgISO8601DateOutput;
 		if ($this->m_printvalue === false) {
 			//MediaWiki date function is not applicable any more (no support for BC Dates)
 			if ($this->m_year > 0) {
@@ -413,10 +413,18 @@
 $this->m_printvalue = number_format(-($this->m_year-1), 0, '.', '') . ' BC'; // note: there should be no digits after the comma anyway
 			}
 			if ($this->m_month) {
-$this->m_printvalue =  $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_printvalue;
+if($smwgISO8601DateOutput === false) {
+	$this->m_printvalue =  $smwgContLang->getMonthLabel($this->m_month) . " " . $this->m_printvalue;
+} else {
+	$this->m_printvalue =  $this->m_printvalue . '-' . str_pad($this->m_month, 2, "0", STR_PAD_LEFT);
+}
 			}
 			if ($this->m_day) {
-$this->m_printvalue =  $this->m_day . " " . $this->m_printvalue;
+if($smwgISO8601DateOutput === false) {
+	$this->m_printvalue =  $this->m_day . " " . $this->m_printvalue;
+} else {
+	$this->m_printvalue =  $this->m_printvalue . '-' . str_pad($this->m_day, 2, "0", STR_PAD_LEFT);
+}
 			}
 			if ($this->m_time) {
 $this->m_printvalue .= " " . $this->m_time;
--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Adding 'headers' parameter to CSV format

2009-03-04 Thread Patrick Nagel
Hi,

On 2009-03-04 04:46, Yaron Koren wrote:
> Alright, since no one objected (and there was some support), I added in 
> code to SMW that prints out a header row for the CSV format, 
> conveniently suitable for the "CSV with header" option in the External 
> Data extension. If you're using the very latest version, you can get rid 
> of the header row by adding "|headers=hide" to the query.

This is great :)

I recommend the following procedure to preserve the original behaviour 
throughout a Wiki:

* Install the ReplaceText extension
   (http://www.mediawiki.org/wiki/Extension:Replace_Text)
* In a browser go to 
WIKI_BASE_URL/Special:ReplaceText?title=Special%3AReplaceText&target_str=format%3Dcsv&replacement_str=headers%3Dhide+|+format%3Dcsv

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

--
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] PHP Fatal error after changing n-ary property to normal property

2008-10-04 Thread Patrick Nagel
I just tried to reproduce this in the SMW sandbox, but there it works as 
expected.

Has this bug been fixed in the (not-yet-released) SMW 1.4a running on the
sandbox server, or is it not a bug, but a problem with my setup?

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] [Semediawiki-user] n-ary relations - how to escape semicolons?

2008-09-26 Thread Patrick Nagel
Patrick Nagel wrote:
> I need to enter values which contain semicolons (specifically:  ) into
> n-ary properties - but SMW will interpret the semicolons as divider. How to 
> get
> around this?

I made a bug report for this:
https://bugzilla.wikimedia.org/show_bug.cgi?id=15732

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] n-ary relations - how to escape semicolons?

2008-09-26 Thread Patrick Nagel
Hi,

I need to enter values which contain semicolons (specifically:  ) into
n-ary properties - but SMW will interpret the semicolons as divider. How to get
around this?

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] PHP Fatal error after changing n-ary property to normal property

2008-09-24 Thread Patrick Nagel
Hi,

I discovered a serious issue while playing with n-ary relations... I suspect
it's a bug in SMW.

I simply changed

Property:Instant messenger
 == Type ==
 [[Has type::String; String]]

to

Property:Instant messenger
 == Type ==
 [[Has type::String]]

and since then I get blank pages whenever I try to access a page where this
property is being used. Apache's error log contains messages like this:

[Thu Sep 25 06:20:54 2008] [error] [client 192.168.0.117] PHP Fatal error:
Call to undefined method SMWStringValue::setDVs() in
/path/wiki-experimental/extensions/SemanticMediaWiki/includes/storage/SMW_SQLStore2.php
on line 270

When I change the property back to n-ary, I can access the pages again.

Patrick.

-- 
Key ID: 0x86E346D4http://patrick-nagel.net/key.asc
Fingerprint: 7745 E1BE FA8B FBAD 76AB 2BFC C981 E686 86E3 46D4

-
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel