InlineQueryParserFunction

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

InlineQueryParserFunction

Jim R. Wilson
Hi all,

I'm currently working on an InlineQuery Parser Function called {{#ask}}

So this: <ask format="ul">[[friend of::*]]</ask>

Becomes this: {{#ask:format=ul|[[friend of::*]]}}

I thought I was done, having basically written a wrapper around <ask> that simply uses the Parser Function interface instead of an extension tag.  Unfortunately this will not work as a general purpose solution since the output of <ask> is raw HTML, not Wikitext.

So, it's not going to be as easy as I'd hoped. :(   However, there are at least two solutions:

1) Continue to wrap <ask> and parse the resultant HTML back to wikitext (dirty, dirty hack, but requires no core changes and no core functionality duplication)

2) Implement a range of new SMWQueryPrinter classes, one for each existing type, but outputting the wikitext equivalents of the raw HTML.  So SMWWikiTablePrinter would correspond to SMWTablePrinter, etc.

I'm heavily leaning towards the latter, but because it requires more code, I am again faced with a few options:

1) Duplicate whatever I need to get the job done - for example a new SMWInlineQueries class (SMWInlineWikiQueries) that inherits from the original, but with a "getWikiResult" method.  This option requires no core SMW changes, but results in duplicate code that would have to be kept in sync with newer SMW releases (dirty hack)

2) Add hooks into the SMW core to reduce duplication, but still keep the functionality separate.  An example hook would be at the end of "getHTMLResult" - right after the "switch($this->mFormat)" block.  Something like :

wgRunHooks("SMWInlineQueryGetHTMLResultBeforePrint", array( &$this, &$printer, &$sq ));

Then anyone could plug any printer they wanted in, no questions asked.  This option requires minimal acceptance by the community as the patches would be only a few lines.

3) Actually contribute all this work directly into the SMW core (most elegant solution, but requires buy-in from the community).

So, dear community, what would you have me do?  One way or another, I will have my {{#ask}} function, as I need it for my own site, and I plan to release the code OSS. Is it worth trying to integrate this with the SMW core?

Thank you for considering this - and thanks in advance for your replies!

-- Jim R. Wilson (jimbojw)

-------------------------------------------------------------------------
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: InlineQueryParserFunction

Jim R. Wilson
Hi again,

Since no one responded, I took the "least community involvement" route.

Version 0.1 of SMW_InlineQueryParserFunction is now available for download:

http://jimbojw.com/wiki/index.php?title=SMW_InlineQueryParserFunction_Extension

I hope to engage a core SMW dev on the possibility of integrating this functionality into the core.  Thanks for taking the time to respond.

-- Jim R. Wilson (jimbojw)

On 5/18/07, Jim Wilson <[hidden email]> wrote:
Hi all,

I'm currently working on an InlineQuery Parser Function called {{#ask}}

So this: <ask format="ul">[[friend of::*]]</ask>

Becomes this: {{#ask:format=ul|[[friend of::*]]}}

I thought I was done, having basically written a wrapper around <ask> that simply uses the Parser Function interface instead of an extension tag.  Unfortunately this will not work as a general purpose solution since the output of <ask> is raw HTML, not Wikitext.

So, it's not going to be as easy as I'd hoped. :(   However, there are at least two solutions:

1) Continue to wrap <ask> and parse the resultant HTML back to wikitext (dirty, dirty hack, but requires no core changes and no core functionality duplication)

2) Implement a range of new SMWQueryPrinter classes, one for each existing type, but outputting the wikitext equivalents of the raw HTML.  So SMWWikiTablePrinter would correspond to SMWTablePrinter, etc.

I'm heavily leaning towards the latter, but because it requires more code, I am again faced with a few options:

1) Duplicate whatever I need to get the job done - for example a new SMWInlineQueries class (SMWInlineWikiQueries) that inherits from the original, but with a "getWikiResult" method.  This option requires no core SMW changes, but results in duplicate code that would have to be kept in sync with newer SMW releases (dirty hack)

2) Add hooks into the SMW core to reduce duplication, but still keep the functionality separate.  An example hook would be at the end of "getHTMLResult" - right after the "switch($this->mFormat)" block.  Something like :

wgRunHooks("SMWInlineQueryGetHTMLResultBeforePrint", array( &$this, &$printer, &$sq ));

Then anyone could plug any printer they wanted in, no questions asked.  This option requires minimal acceptance by the community as the patches would be only a few lines.

3) Actually contribute all this work directly into the SMW core (most elegant solution, but requires buy-in from the community).

So, dear community, what would you have me do?  One way or another, I will have my {{#ask}} function, as I need it for my own site, and I plan to release the code OSS. Is it worth trying to integrate this with the SMW core?

Thank you for considering this - and thanks in advance for your replies!

-- Jim R. Wilson (jimbojw)


-------------------------------------------------------------------------
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: InlineQueryParserFunction

cnit
In reply to this post by Jim R. Wilson
Hi Jim!
ask parser function is a great idea, I think it may be used
to overcome horrible MW parser limitation, which doesn't allow to use
template parameters in parser extension tags, like <ask> :-(
What Markus and S Page would think about this idea?!
Dmitriy


-------------------------------------------------------------------------
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: InlineQueryParserFunction

Jim R. Wilson
Thanks cnit!

I'm glad someone else would find this useful.  I'll be happy to integrate my code into the SMW codebase and create a patch ... I would just like some assurance from a core dev that my patch has a chance of being applied before I go through the work of making it.

-- Jim

On 5/22/07, cnit <[hidden email]> wrote:
Hi Jim!
ask parser function is a great idea, I think it may be used
to overcome horrible MW parser limitation, which doesn't allow to use
template parameters in parser extension tags, like <ask> :-(
What Markus and S Page would think about this idea?!
Dmitriy


-------------------------------------------------------------------------
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


-------------------------------------------------------------------------
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: InlineQueryParserFunction

Jim R. Wilson
Update:

I've logged bug 10021 as an enhancement request for an Inline Query Parser Function {{#ask}} and created a patch implement the change:

http://bugzilla.wikimedia.org/show_bug.cgi?id=10021

Dear core SMW devs, PLEASE review my patch at your convenience - I'll be happy to answer any questions.  Thanks!

-- Jim R. Wilson (jimbojw)

On 5/22/07, Jim Wilson <[hidden email]> wrote:
Thanks cnit!

I'm glad someone else would find this useful.  I'll be happy to integrate my code into the SMW codebase and create a patch ... I would just like some assurance from a core dev that my patch has a chance of being applied before I go through the work of making it.

-- Jim


On 5/22/07, cnit <[hidden email]> wrote:
Hi Jim!
ask parser function is a great idea, I think it may be used
to overcome horrible MW parser limitation, which doesn't allow to use
template parameters in parser extension tags, like <ask> :-(
What Markus and S Page would think about this idea?!
Dmitriy


-------------------------------------------------------------------------
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.
<a href="http://sourceforge.net/powerbar/db2/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://sourceforge.net/powerbar/db2/
_______________________________________________
Semediawiki-devel mailing list
[hidden email]
<a href="https://lists.sourceforge.net/lists/listinfo/semediawiki-devel" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)"> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel



-------------------------------------------------------------------------
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: InlineQueryParserFunction

Daniel M. Herzig
Hi Jim!
 
Your idea of Inline Query Parser Functions is great.
We discussed it briefly at our meeting on Wednesday and we will review it
soon.
The Inline Query Parse Process is an upcoming subject of remodelling and
your contribution is appreciated!
Thanks!
 
Daniel
 
 

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf Of Jim
Wilson
Sent: Thursday, May 24, 2007 7:12 AM
To: [hidden email]
Subject: Re: [SMW-devel] InlineQueryParserFunction


Update:

I've logged bug 10021 as an enhancement request for an Inline Query Parser
Function {{#ask}} and created a patch implement the change:

http://bugzilla.wikimedia.org/show_bug.cgi?id=10021

Dear core SMW devs, PLEASE review my patch at your convenience - I'll be
happy to answer any questions.  Thanks!

-- Jim R. Wilson (jimbojw)


On 5/22/07, Jim Wilson <[hidden email]> wrote:

Thanks cnit!

I'm glad someone else would find this useful.  I'll be happy to integrate my
code into the SMW codebase and create a patch ... I would just like some
assurance from a core dev that my patch has a chance of being applied before
I go through the work of making it.

-- Jim



On 5/22/07, cnit < [hidden email] <mailto:[hidden email]> > wrote:

Hi Jim!
ask parser function is a great idea, I think it may be used
to overcome horrible MW parser limitation, which doesn't allow to use
template parameters in parser extension tags, like <ask> :-(
What Markus and S Page would think about this idea?!
Dmitriy


-------------------------------------------------------------------------
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/  <http://sourceforge.net/powerbar/db2/>

_______________________________________________
Semediawiki-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
<https://lists.sourceforge.net/lists/listinfo/semediawiki-devel>






-------------------------------------------------------------------------
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: InlineQueryParserFunction

Markus Krötzsch
On Monday 28 May 2007 11:22, Daniel M. Herzig wrote:
> Hi Jim!
>
> Your idea of Inline Query Parser Functions is great.
> We discussed it briefly at our meeting on Wednesday and we will review it
> soon.
> The Inline Query Parse Process is an upcoming subject of remodelling and
> your contribution is appreciated!

Maybe some further comments of what we currently do with queries. I am about
to split the evil monolithic query processing and printing into several
components: a query parser (creating an object presentation of the query), a
query executor (obtaining preprocessing results for a given query), and a
printing architecture (which serialises query results in whatever way).

The query execution is mostly ready, as is part of the new printing
architecture and some printers. The query parsing still needs to be
implemented.

Based on those improvements, we will hopefully be able to extend our querying
capabilities and to reuse the query mechanism more easily. Until this is
done, however, all extensions/changes of the query components will have to
wait. I am confident to finish the whole restructuring by end of this month.

Cheers,

Markus



> Thanks!
>
> Daniel
>
>
>
> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of Jim
> Wilson
> Sent: Thursday, May 24, 2007 7:12 AM
> To: [hidden email]
> Subject: Re: [SMW-devel] InlineQueryParserFunction
>
>
> Update:
>
> I've logged bug 10021 as an enhancement request for an Inline Query Parser
> Function {{#ask}} and created a patch implement the change:
>
> http://bugzilla.wikimedia.org/show_bug.cgi?id=10021
>
> Dear core SMW devs, PLEASE review my patch at your convenience - I'll be
> happy to answer any questions.  Thanks!
>
> -- Jim R. Wilson (jimbojw)
>
>
> On 5/22/07, Jim Wilson <[hidden email]> wrote:
>
> Thanks cnit!
>
> I'm glad someone else would find this useful.  I'll be happy to integrate
> my code into the SMW codebase and create a patch ... I would just like some
> assurance from a core dev that my patch has a chance of being applied
> before I go through the work of making it.
>
> -- Jim
>
>
>
> On 5/22/07, cnit < [hidden email] <mailto:[hidden email]> > wrote:
>
> Hi Jim!
> ask parser function is a great idea, I think it may be used
> to overcome horrible MW parser limitation, which doesn't allow to use
> template parameters in parser extension tags, like <ask> :-(
> What Markus and S Page would think about this idea?!
> Dmitriy
>
>
> -------------------------------------------------------------------------
> 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/ 
> <http://sourceforge.net/powerbar/db2/>
>
> _______________________________________________
> Semediawiki-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
> <https://lists.sourceforge.net/lists/listinfo/semediawiki-devel>
>
>
>
>
>
>
> -------------------------------------------------------------------------
> 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