From: Van de B. <van...@gm...> - 2011-07-22 22:44:27
|
Hi, I have one-to-many relationship in my database. For example, several people together can visit a region. To handle such information, I use input field with multiple values and handle them with array functions. Everything works good. But I found that some names confuse templates. The system fails to handle names with a comma, for example: "Dow, Jones", or "Indiana Jones, Jr.". I started to use semicolon as a delimiter (Semantic Forms and Arrays allow specifying custom delimiter), and was happy for some time. The problem is in inline queries. For example: {{ #ask: ...some conditions... | ?# | ?Date | ?Location | ?Visitor | format=template | template=my_template }} Note that Many visitors are associated with the same Visit, so #ask passes a COMMA-separated list of visitors as the 4th argument to my_template. I tried to use "sep" parameter, but it separates entire records, not items within a multi-value. I probably can workaround the issue with nested queries (e. g. drop "?Visitor" printout statement and request Visitors within my_template by {{ #show: {{{1}}} | ?Visitor }}), but is there another way to handle this issue? Thanks, Van. |
From: Patrick N. <ma...@pa...> - 2011-07-23 02:50:41
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Van, On 2011-07-23 06:44, Van de Bugger wrote: > I have one-to-many relationship in my database. For example, several > people together can visit a region. To handle such information, I use > input field with multiple values and handle them with array functions. > Everything works good. But I found that some names confuse templates. The > system fails to handle names with a comma, for example: "Dow, Jones", or > "Indiana Jones, Jr.". I started to use semicolon as a delimiter (Semantic > Forms and Arrays allow specifying custom delimiter), and was happy for > some time. The problem is in inline queries. For example: > > {{ #ask: ...some conditions... | ?# | ?Date | ?Location | ?Visitor | > format=template | template=my_template }} > > Note that Many visitors are associated with the same Visit, so #ask > passes a COMMA-separated list of visitors as the 4th argument to > my_template. I tried to use "sep" parameter, but it separates entire > records, not items within a multi-value. > > I probably can workaround the issue with nested queries (e. g. drop > "?Visitor" printout statement and request Visitors within my_template by > {{ #show: {{{1}}} | ?Visitor }}), but is there another way to handle this > issue? I have run into the same issue, and opened a bug report about it, some time ago: https://bugzilla.wikimedia.org/show_bug.cgi?id=22777 The patch in the bug report works against 1.5.6 (I think), but not against current trunk / 1.6 - but I'm sure it won't be hard to adjust it. I hope the 'itemsep' parameter can be integrated into SMW at some point, it makes working with multiple values in one property more flexible. Patrick. - -- Key ID: 0x86E346D4 http://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/ iEYEARECAAYFAk4qNvUACgkQyYHmhobjRtSg8ACfRwUE1FNzv0ppljAVi25r70S/ fH8AoJH8eKz2i/JeISH0808R9KwgEWqd =0Ux3 -----END PGP SIGNATURE----- |
From: Van de B. <van...@gm...> - 2011-07-23 09:09:03
|
Hi Patrick, Thanks for the info. Markus, Do you have any progress on 22777? Do you have any objections against Patrick's patch? Do you need any help (e. g. for testing the patch)? Semantic Forms and ArrayExtension use term "delimiter" for such kind of separator. I think it would be good to have the same naming conventions across Semantic MediaWiki, Semantic Forms,and ArrayExtension. Thanks, Van. On Sat, 2011-07-23 at 10:50 +0800, Patrick Nagel wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi Van, > > On 2011-07-23 06:44, Van de Bugger wrote: > > I have one-to-many relationship in my database. For example, several > > people together can visit a region. To handle such information, I use > > input field with multiple values and handle them with array functions. > > Everything works good. But I found that some names confuse templates. The > > system fails to handle names with a comma, for example: "Dow, Jones", or > > "Indiana Jones, Jr.". I started to use semicolon as a delimiter (Semantic > > Forms and Arrays allow specifying custom delimiter), and was happy for > > some time. The problem is in inline queries. For example: > > > > {{ #ask: ...some conditions... | ?# | ?Date | ?Location | ?Visitor | > > format=template | template=my_template }} > > > > Note that Many visitors are associated with the same Visit, so #ask > > passes a COMMA-separated list of visitors as the 4th argument to > > my_template. I tried to use "sep" parameter, but it separates entire > > records, not items within a multi-value. > > > > I probably can workaround the issue with nested queries (e. g. drop > > "?Visitor" printout statement and request Visitors within my_template by > > {{ #show: {{{1}}} | ?Visitor }}), but is there another way to handle this > > issue? > > I have run into the same issue, and opened a bug report about it, some time > ago: https://bugzilla.wikimedia.org/show_bug.cgi?id=22777 > > The patch in the bug report works against 1.5.6 (I think), but not against > current trunk / 1.6 - but I'm sure it won't be hard to adjust it. > > I hope the 'itemsep' parameter can be integrated into SMW at some point, it > makes working with multiple values in one property more flexible. > > Patrick. > > - -- > Key ID: 0x86E346D4 http://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/ > > iEYEARECAAYFAk4qNvUACgkQyYHmhobjRtSg8ACfRwUE1FNzv0ppljAVi25r70S/ > fH8AoJH8eKz2i/JeISH0808R9KwgEWqd > =0Ux3 > -----END PGP SIGNATURE----- > > ------------------------------------------------------------------------------ > Storage Efficiency Calculator > This modeling tool is based on patent-pending intellectual property that > has been used successfully in hundreds of IBM storage optimization engage- > ments, worldwide. Store less, Store more with what you own, Move data to > the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/ > _______________________________________________ > Semediawiki-user mailing list > Sem...@li... > https://lists.sourceforge.net/lists/listinfo/semediawiki-user |
From: Van de B. <van...@gm...> - 2011-07-23 23:29:22
|
BTW, Just a thought: I thing we can solve most of the issues with delimiters using named template parameters. For example: {{ #ask: ...query... | ?Prop1 | ?Prop2 | ?Prop3 | template=my_template}} Currently my_template is called with positional parameters: {{{1}}} is value of Prop1, {{{2}}} is value of Prop2, {{{3}}} is value of Prop3 etc. (Yes, I know that {{{1}}} is name of page, but let us ignore it for the moment.) My proposal is using not positional, but named arguments, so {{{Prop1}}} is value of Prop1, {{{Prop2}}} is value of Prop2, etc. Advantages are: 1. It is easier to write template. 2. Template code is much more readable. 3. It is possible to vary order of printout statements without need to rewrite template. 4. The same template may be used for different queries. Ok, what about delimiters? If we have multiple values for one printout statement (e. g. in case of one-to-many relationship), multiple arguments will be passed to template. All the parameters will have the same prefix "Prop" and different suffixes: [1], [2], [3], etc. Template can use #forargs parser function (from Loops extension) for handle all the values. Alternatively, we can extend ArrayExtension to create an array from template arguments. Any comments? Van. On Sat, 2011-07-23 at 13:08 +0400, Van de Bugger wrote: > Hi Patrick, > > Thanks for the info. > > Markus, > > Do you have any progress on 22777? Do you have any objections against > Patrick's patch? Do you need any help (e. g. for testing the patch)? > > Semantic Forms and ArrayExtension use term "delimiter" for such kind of > separator. I think it would be good to have the same naming conventions > across Semantic MediaWiki, Semantic Forms,and ArrayExtension. > > Thanks, > Van. > > On Sat, 2011-07-23 at 10:50 +0800, Patrick Nagel wrote: > > -----BEGIN PGP SIGNED MESSAGE----- > > Hash: SHA1 > > > > Hi Van, > > > > On 2011-07-23 06:44, Van de Bugger wrote: > > > I have one-to-many relationship in my database. For example, several > > > people together can visit a region. To handle such information, I use > > > input field with multiple values and handle them with array functions. > > > Everything works good. But I found that some names confuse templates. The > > > system fails to handle names with a comma, for example: "Dow, Jones", or > > > "Indiana Jones, Jr.". I started to use semicolon as a delimiter (Semantic > > > Forms and Arrays allow specifying custom delimiter), and was happy for > > > some time. The problem is in inline queries. For example: > > > > > > {{ #ask: ...some conditions... | ?# | ?Date | ?Location | ?Visitor | > > > format=template | template=my_template }} > > > > > > Note that Many visitors are associated with the same Visit, so #ask > > > passes a COMMA-separated list of visitors as the 4th argument to > > > my_template. I tried to use "sep" parameter, but it separates entire > > > records, not items within a multi-value. > > > > > > I probably can workaround the issue with nested queries (e. g. drop > > > "?Visitor" printout statement and request Visitors within my_template by > > > {{ #show: {{{1}}} | ?Visitor }}), but is there another way to handle this > > > issue? > > > > I have run into the same issue, and opened a bug report about it, some time > > ago: https://bugzilla.wikimedia.org/show_bug.cgi?id=22777 > > > > The patch in the bug report works against 1.5.6 (I think), but not against > > current trunk / 1.6 - but I'm sure it won't be hard to adjust it. > > > > I hope the 'itemsep' parameter can be integrated into SMW at some point, it > > makes working with multiple values in one property more flexible. > > > > Patrick. > > > > - -- > > Key ID: 0x86E346D4 http://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/ > > > > iEYEARECAAYFAk4qNvUACgkQyYHmhobjRtSg8ACfRwUE1FNzv0ppljAVi25r70S/ > > fH8AoJH8eKz2i/JeISH0808R9KwgEWqd > > =0Ux3 > > -----END PGP SIGNATURE----- > > > > ------------------------------------------------------------------------------ > > Storage Efficiency Calculator > > This modeling tool is based on patent-pending intellectual property that > > has been used successfully in hundreds of IBM storage optimization engage- > > ments, worldwide. Store less, Store more with what you own, Move data to > > the right place. Try It Now! http://www.accelacomm.com/jaw/sfnl/114/51427378/ > > _______________________________________________ > > Semediawiki-user mailing list > > Sem...@li... > > https://lists.sourceforge.net/lists/listinfo/semediawiki-user > |
From: Patrick N. <ma...@pa...> - 2011-07-24 04:04:45
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, On 2011-07-24 07:29, Van de Bugger wrote: > BTW, Just a thought: I thing we can solve most of the issues with > delimiters using named template parameters. For example: > > {{ #ask: ...query... | ?Prop1 | ?Prop2 | ?Prop3 | template=my_template}} > > Currently my_template is called with positional parameters: {{{1}}} is > value of Prop1, {{{2}}} is value of Prop2, {{{3}}} is value of Prop3 > etc. (Yes, I know that {{{1}}} is name of page, but let us ignore it for > the moment.) My proposal is using not positional, but named arguments, > so {{{Prop1}}} is value of Prop1, {{{Prop2}}} is value of Prop2, etc. > Advantages are: > > 1. It is easier to write template. 2. Template code is much more > readable. 3. It is possible to vary order of printout statements without > need to rewrite template. 4. The same template may be used for different > queries. > > Ok, what about delimiters? If we have multiple values for one printout > statement (e. g. in case of one-to-many relationship), multiple > arguments will be passed to template. All the parameters will have the > same prefix "Prop" and different suffixes: [1], [2], [3], etc. Template > can use #forargs parser function (from Loops extension) for handle all > the values. Alternatively, we can extend ArrayExtension to create an > array from template arguments. > > Any comments? Having an option for an #ask query to call a template with named parameters is actually a really great idea. It would have to be implemented in a backwards compatible way though - for big Wiki applications like the one I'm working on it is not feasible to quickly rewrite all templates - it would be a process of many days or even weeks. So how about this: {{#ask: [[Somepage]] | mainlabel=X | PropertyY=PY | PropertyZ | format=nptemplate | template=demo}} which would call {{demo |X=Somepage |PY=<value(s) of PropertyY in Somepage> |PropertyZ=<value(s) of PropertyZ in Somepage> }} If 'mainlabel' is not specified, the named parameter for the pagename would automatically be 'Subject'. As for your proposition to have each value of the same property in a separate named template parameter, with a sequence number added: I think that's not so good, considering that it would *require* the Loops extension to be used in every such template. I think with the delimiter parameter (that I called itemsep before), and the named parameter template (format=nptemplate) result format, all problems would be solved. Patrick. - -- Key ID: 0x86E346D4 http://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/ iEYEARECAAYFAk4rmc4ACgkQyYHmhobjRtSNKACfVI5K7aqmKVml/vuRG5leofSO jKcAoMXCjgYP5XoqpKGyImn6WuNdlwSD =O9G2 -----END PGP SIGNATURE----- |
From: Van de B. <van...@gm...> - 2011-11-05 22:41:24
|
Hi Markus, Is there any progress or decision on the topic? It gets to be a showstopper to me. Some of my properties can be multi-value, which are passed as comma-separated lists to a template, while comma is a legal character. For example, comma may be used in names: "Zeiss, Carl" or "Henry Jones, Jr.". In some languages comma is a decimal character: "0,5" (a half), "1,5" (one and a half). SemanticForms and ArrayExtension allow to specify alternative list separator, but #show function does not. I need some solution for the problem: either ability to specify alternative list separator, or passing every value as a separate template parameter (as I proposed some time ago). Probably I am able to implement it, but which one? Thanks, Van. On Sun, 2011-07-24 at 12:04 +0800, Patrick Nagel wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi, > > On 2011-07-24 07:29, Van de Bugger wrote: > > BTW, Just a thought: I thing we can solve most of the issues with > > delimiters using named template parameters. For example: > > > > {{ #ask: ...query... | ?Prop1 | ?Prop2 | ?Prop3 | template=my_template}} > > > > Currently my_template is called with positional parameters: {{{1}}} is > > value of Prop1, {{{2}}} is value of Prop2, {{{3}}} is value of Prop3 > > etc. (Yes, I know that {{{1}}} is name of page, but let us ignore it for > > the moment.) My proposal is using not positional, but named arguments, > > so {{{Prop1}}} is value of Prop1, {{{Prop2}}} is value of Prop2, etc. > > Advantages are: > > > > 1. It is easier to write template. 2. Template code is much more > > readable. 3. It is possible to vary order of printout statements without > > need to rewrite template. 4. The same template may be used for different > > queries. > > > > Ok, what about delimiters? If we have multiple values for one printout > > statement (e. g. in case of one-to-many relationship), multiple > > arguments will be passed to template. All the parameters will have the > > same prefix "Prop" and different suffixes: [1], [2], [3], etc. Template > > can use #forargs parser function (from Loops extension) for handle all > > the values. Alternatively, we can extend ArrayExtension to create an > > array from template arguments. > > > > Any comments? > > Having an option for an #ask query to call a template with named parameters > is actually a really great idea. It would have to be implemented in a > backwards compatible way though - for big Wiki applications like the one I'm > working on it is not feasible to quickly rewrite all templates - it would be > a process of many days or even weeks. > > So how about this: > > {{#ask: [[Somepage]] | mainlabel=X | PropertyY=PY | PropertyZ | > format=nptemplate | > template=demo}} > > which would call > > {{demo > |X=Somepage > |PY=<value(s) of PropertyY in Somepage> > |PropertyZ=<value(s) of PropertyZ in Somepage> > }} > > If 'mainlabel' is not specified, the named parameter for the pagename would > automatically be 'Subject'. > > As for your proposition to have each value of the same property in a > separate named template parameter, with a sequence number added: I think > that's not so good, considering that it would *require* the Loops extension > to be used in every such template. > I think with the delimiter parameter (that I called itemsep before), and the > named parameter template (format=nptemplate) result format, all problems > would be solved. > > Patrick. > > - -- > Key ID: 0x86E346D4 http://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/ > > iEYEARECAAYFAk4rmc4ACgkQyYHmhobjRtSNKACfVI5K7aqmKVml/vuRG5leofSO > jKcAoMXCjgYP5XoqpKGyImn6WuNdlwSD > =O9G2 > -----END PGP SIGNATURE----- |