Problems with "template" query format

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems with "template" query format

Yaron Koren
Hi,

Besides the issue I wrote about before, there's one other SMW feature
I'm having problems with: the new "template" format for inline
queries. Discourse DB had its own handling for templated queries,
which I'd gotten used to, and I think it had some key advantages over
the current implementation.

Essentially, the code I wrote for handling templated queries did its
own parsing of the template: if the template being used had text
somewhere that read, say, "{{{Is capital of}}}", the parser looked for
an attribute or relation for that page with that name, and, if it
found it, replaced the tag with the string value of that attribute or
relation. The code being used in SMW seems to instead use the standard
template parser for handling the query template. This approach, while
it makes more sense conceptually, seems to lead to at least three
problems:

- it appears a query template has to use indexes for fields (1, 2, 3,
etc.), instead of attribute/relation names.

- because of special handling for the '=' sign, data values that have
'='s within them (in my case, there are URLs that contain one or more
of them) don't get handled correctly

- URLs in general get displayed in the standard form, meaning they
show up as a link already. This is fine for normal query results, but
I don't think it's good enough for templated queries, where the user
wants complete control over the display. The URL should be returned
just as a string, so the user can set whatever link text they want.

For these reasons, I think the handling of templated queries should be
changed. Any thoughts?

(By the way, since there doesn't seem to be a demonstration of
templated queries on Ontoworld, see
http://discoursedb.org/wiki/Template:ItemQuery and
http://discoursedb.org/wiki/Sarbanes-Oxley_Act_/_Act_should_be_repealed
for examples of what I'm talking about.)

-Yaron

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with "template" query format

Markus Krötzsch
On Monday 30 April 2007 20:42, Yaron Koren wrote:

> Hi,
>
> Besides the issue I wrote about before, there's one other SMW feature
> I'm having problems with: the new "template" format for inline
> queries. Discourse DB had its own handling for templated queries,
> which I'd gotten used to, and I think it had some key advantages over
> the current implementation.
>
> Essentially, the code I wrote for handling templated queries did its
> own parsing of the template: if the template being used had text
> somewhere that read, say, "{{{Is capital of}}}", the parser looked for
> an attribute or relation for that page with that name, and, if it
> found it, replaced the tag with the string value of that attribute or
> relation. The code being used in SMW seems to instead use the standard
> template parser for handling the query template. This approach, while
> it makes more sense conceptually, seems to lead to at least three
> problems:
>
> - it appears a query template has to use indexes for fields (1, 2, 3,
> etc.), instead of attribute/relation names.
True. But on the other hand, it enables you to reuse templates more widely
(e.g. I have a template "mailing list" on my wiki, formatting data as "Name
<[hidden email]>" and I reuse it for many queries of different attributes).

>
> - because of special handling for the '=' sign, data values that have
> '='s within them (in my case, there are URLs that contain one or more
> of them) don't get handled correctly

I agree that this is a major problem. Could we escape "=" so that it works in
the template and still works in the URL?

>
> - URLs in general get displayed in the standard form, meaning they
> show up as a link already. This is fine for normal query results, but
> I don't think it's good enough for templated queries, where the user
> wants complete control over the display. The URL should be returned
> just as a string, so the user can set whatever link text they want.

I think this should be no big problem: you can format them inside the template
just like anywhere else in the wiki (e.g. by writing "<nowiki>" to prevent
autolinking, or by using [{{{1}}} some label] to change the label.

>
> For these reasons, I think the handling of templated queries should be
> changed. Any thoughts?

I changed your implementation for various other reasons. Using the standard
template mechanism simplifies the implementation and enables full support for
<includeonly> and <noinclude>. But the "=" bug (and similar bugs related to
other symbols not allowed in template parameters) need to be addressed.

>
> (By the way, since there doesn't seem to be a demonstration of
> templated queries on Ontoworld, see

True. The documentation still needs to be updated.

Cheers,

Markus

> http://discoursedb.org/wiki/Template:ItemQuery and
> http://discoursedb.org/wiki/Sarbanes-Oxley_Act_/_Act_should_be_repealed
> for examples of what I'm talking about.)
>
> -Yaron
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Semediawiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
--
Markus Krötzsch
Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
[hidden email]        phone +49 (0)721 608 7362
www.aifb.uni-karlsruhe.de/WBS/     fax +49 (0)721 693  717

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with "template" query format

Yaron Koren
Okay, I guess the problems with the template-query system aren't
nearly as big as I thought they were. There are advantages to using
indexes for fields, it's true; and it's easy to change the label of a
URL field (I didn't realize that was possible). For the problem with
the equal signs, I got it to work now by changing the replacement code
for them from '&#x007C;' to '&#61;', in the file
'/includes/SWM_QueryPrinters.php', around line 535. I don't know if
this is a good general solution, but it works for me.

As you note, a URL (or any other field) that contains a pipe ("|") or
brackets would also cause problems, but such a field would cause
problems in general, not just for queries, so it's really outside the
scope of query-handling, I think.

Thanks very much for your help,
Yaron

On 5/2/07, Markus Krötzsch <[hidden email]> wrote:

> On Monday 30 April 2007 20:42, Yaron Koren wrote:
> > Hi,
> >
> > Besides the issue I wrote about before, there's one other SMW feature
> > I'm having problems with: the new "template" format for inline
> > queries. Discourse DB had its own handling for templated queries,
> > which I'd gotten used to, and I think it had some key advantages over
> > the current implementation.
> >
> > Essentially, the code I wrote for handling templated queries did its
> > own parsing of the template: if the template being used had text
> > somewhere that read, say, "{{{Is capital of}}}", the parser looked for
> > an attribute or relation for that page with that name, and, if it
> > found it, replaced the tag with the string value of that attribute or
> > relation. The code being used in SMW seems to instead use the standard
> > template parser for handling the query template. This approach, while
> > it makes more sense conceptually, seems to lead to at least three
> > problems:
> >
> > - it appears a query template has to use indexes for fields (1, 2, 3,
> > etc.), instead of attribute/relation names.
>
> True. But on the other hand, it enables you to reuse templates more widely
> (e.g. I have a template "mailing list" on my wiki, formatting data as "Name
> <[hidden email]>" and I reuse it for many queries of different attributes).
>
> >
> > - because of special handling for the '=' sign, data values that have
> > '='s within them (in my case, there are URLs that contain one or more
> > of them) don't get handled correctly
>
> I agree that this is a major problem. Could we escape "=" so that it works in
> the template and still works in the URL?
>
> >
> > - URLs in general get displayed in the standard form, meaning they
> > show up as a link already. This is fine for normal query results, but
> > I don't think it's good enough for templated queries, where the user
> > wants complete control over the display. The URL should be returned
> > just as a string, so the user can set whatever link text they want.
>
> I think this should be no big problem: you can format them inside the template
> just like anywhere else in the wiki (e.g. by writing "<nowiki>" to prevent
> autolinking, or by using [{{{1}}} some label] to change the label.
>
> >
> > For these reasons, I think the handling of templated queries should be
> > changed. Any thoughts?
>
> I changed your implementation for various other reasons. Using the standard
> template mechanism simplifies the implementation and enables full support for
> <includeonly> and <noinclude>. But the "=" bug (and similar bugs related to
> other symbols not allowed in template parameters) need to be addressed.
>
> >
> > (By the way, since there doesn't seem to be a demonstration of
> > templated queries on Ontoworld, see
>
> True. The documentation still needs to be updated.
>
> Cheers,
>
> Markus
>
> > http://discoursedb.org/wiki/Template:ItemQuery and
> > http://discoursedb.org/wiki/Sarbanes-Oxley_Act_/_Act_should_be_repealed
> > for examples of what I'm talking about.)
> >
> > -Yaron
> >
> > -------------------------------------------------------------------------
> > This SF.net email is sponsored by DB2 Express
> > Download DB2 Express C - the FREE version of DB2 express and take
> > control of your XML. No limits. Just data. Click to get it now.
> > http://sourceforge.net/powerbar/db2/
> > _______________________________________________
> > Semediawiki-devel mailing list
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>
> --
> Markus Krötzsch
> Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
> [hidden email]        phone +49 (0)721 608 7362
> www.aifb.uni-karlsruhe.de/WBS/     fax +49 (0)721 693  717
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Reply | Threaded
Open this post in threaded view
|

Re: Problems with "template" query format

Markus Krötzsch
On Wednesday 02 May 2007 18:35, Yaron Koren wrote:
> Okay, I guess the problems with the template-query system aren't
> nearly as big as I thought they were. There are advantages to using
> indexes for fields, it's true; and it's easy to change the label of a
> URL field (I didn't realize that was possible). For the problem with
> the equal signs, I got it to work now by changing the replacement code
> for them from '&#x007C;' to '&#61;', in the file
> '/includes/SWM_QueryPrinters.php', around line 535. I don't know if
> this is a good general solution, but it works for me.

Ah, great. I will consider this for the next update.

Glad to hear that you can live with SMW0.7 -- I know that migrating from a
slightly forked version is not so easy ...

Best regards,

Markus

>
> As you note, a URL (or any other field) that contains a pipe ("|") or
> brackets would also cause problems, but such a field would cause
> problems in general, not just for queries, so it's really outside the
> scope of query-handling, I think.
>
> Thanks very much for your help,
> Yaron
>
> On 5/2/07, Markus Krötzsch <[hidden email]> wrote:
> > On Monday 30 April 2007 20:42, Yaron Koren wrote:
> > > Hi,
> > >
> > > Besides the issue I wrote about before, there's one other SMW feature
> > > I'm having problems with: the new "template" format for inline
> > > queries. Discourse DB had its own handling for templated queries,
> > > which I'd gotten used to, and I think it had some key advantages over
> > > the current implementation.
> > >
> > > Essentially, the code I wrote for handling templated queries did its
> > > own parsing of the template: if the template being used had text
> > > somewhere that read, say, "{{{Is capital of}}}", the parser looked for
> > > an attribute or relation for that page with that name, and, if it
> > > found it, replaced the tag with the string value of that attribute or
> > > relation. The code being used in SMW seems to instead use the standard
> > > template parser for handling the query template. This approach, while
> > > it makes more sense conceptually, seems to lead to at least three
> > > problems:
> > >
> > > - it appears a query template has to use indexes for fields (1, 2, 3,
> > > etc.), instead of attribute/relation names.
> >
> > True. But on the other hand, it enables you to reuse templates more
> > widely (e.g. I have a template "mailing list" on my wiki, formatting data
> > as "Name <[hidden email]>" and I reuse it for many queries of different
> > attributes).
> >
> > > - because of special handling for the '=' sign, data values that have
> > > '='s within them (in my case, there are URLs that contain one or more
> > > of them) don't get handled correctly
> >
> > I agree that this is a major problem. Could we escape "=" so that it
> > works in the template and still works in the URL?
> >
> > > - URLs in general get displayed in the standard form, meaning they
> > > show up as a link already. This is fine for normal query results, but
> > > I don't think it's good enough for templated queries, where the user
> > > wants complete control over the display. The URL should be returned
> > > just as a string, so the user can set whatever link text they want.
> >
> > I think this should be no big problem: you can format them inside the
> > template just like anywhere else in the wiki (e.g. by writing "<nowiki>"
> > to prevent autolinking, or by using [{{{1}}} some label] to change the
> > label.
> >
> > > For these reasons, I think the handling of templated queries should be
> > > changed. Any thoughts?
> >
> > I changed your implementation for various other reasons. Using the
> > standard template mechanism simplifies the implementation and enables
> > full support for <includeonly> and <noinclude>. But the "=" bug (and
> > similar bugs related to other symbols not allowed in template parameters)
> > need to be addressed.
> >
> > > (By the way, since there doesn't seem to be a demonstration of
> > > templated queries on Ontoworld, see
> >
> > True. The documentation still needs to be updated.
> >
> > Cheers,
> >
> > Markus
> >
> > > http://discoursedb.org/wiki/Template:ItemQuery and
> > > http://discoursedb.org/wiki/Sarbanes-Oxley_Act_/_Act_should_be_repealed
> > > for examples of what I'm talking about.)
> > >
> > > -Yaron
> > >
> > > -----------------------------------------------------------------------
> > >-- This SF.net email is sponsored by DB2 Express
> > > Download DB2 Express C - the FREE version of DB2 express and take
> > > control of your XML. No limits. Just data. Click to get it now.
> > > http://sourceforge.net/powerbar/db2/
> > > _______________________________________________
> > > Semediawiki-devel mailing list
> > > [hidden email]
> > > https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
> >
> > --
> > Markus Krötzsch
> > Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
> > [hidden email]        phone +49 (0)721 608 7362
> > www.aifb.uni-karlsruhe.de/WBS/     fax +49 (0)721 693  717
--
Markus Krötzsch
Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
[hidden email]        phone +49 (0)721 608 7362
www.aifb.uni-karlsruhe.de/WBS/     fax +49 (0)721 693  717

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

attachment0 (196 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with "template" query format

Yaron Koren
I can more than "live with" version 0.7 - I think it's great! The new
"browse" functionality is fantastic, and well-integrated with the
other special pages. And the new API-like code for handling data types
is, I think, a big step in SMW becoming an enterprise-level
application.

-Yaron

>
> Glad to hear that you can live with SMW0.7 -- I know that migrating from a
> slightly forked version is not so easy ...
>

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel