Re: [SMW-devel] Ask query in extension

2014-11-01 Thread Jason Ji
If your extension includes a JavaScript component, and you need to make the
ask query in the JavaScript, SMW includes the ask query as an API module
(action=ask or action=askargs, depending on what format you prefer to send
in the query).

--
Jason Ji
jason.y...@gmail.com

On Sat, Nov 1, 2014 at 8:38 PM, Jeroen De Dauw 
wrote:

> Hey,
>
> So you'd have something like
>
> {{#gimmeh_datas_in_a_table: [[Category:Some category]]}}
>
> that results in the same output as the #ask call you posted? If that's all
> you're doing you can of course just use a template. Which indeed does not
> work if you want to modify the result in certain ways.
>
> Your parser function would hand the query string to the QueryProcessor,
> get back the result, and then hand the result over to the formatting thing
> (can't recall where this code is). And in between you could try modifying
> the result. Be warned though, the result data structure is... odd... So it
> might not be trivial to do this.
>
> Cheers
>
> --
> Jeroen De Dauw - http://www.bn2vs.com
> Software craftsmanship advocate
> Evil software architect at Wikimedia Germany
> ~=[,,_,,]:3
>
>
> --
>
> ___
> Semediawiki-devel mailing list
> Semediawiki-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
>
>
--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


Re: [SMW-devel] Ask query in extension

2014-11-01 Thread Jeroen De Dauw
Hey,

So you'd have something like

{{#gimmeh_datas_in_a_table: [[Category:Some category]]}}

that results in the same output as the #ask call you posted? If that's all
you're doing you can of course just use a template. Which indeed does not
work if you want to modify the result in certain ways.

Your parser function would hand the query string to the QueryProcessor, get
back the result, and then hand the result over to the formatting thing
(can't recall where this code is). And in between you could try modifying
the result. Be warned though, the result data structure is... odd... So it
might not be trivial to do this.

Cheers

--
Jeroen De Dauw - http://www.bn2vs.com
Software craftsmanship advocate
Evil software architect at Wikimedia Germany
~=[,,_,,]:3
--
___
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel


[SMW-devel] Ask query in extension

2014-11-01 Thread James Montalvo
I'm creating a parser function in which I'm going to include an ask query.
In this particular case I'd like it just return a normal HTML table of
results, as if I were to do:

{{#ask: [[Category:Some category]]
|? Property 1
|? Property 2
| limit = 10
| sort = Property 2
}}

Once I understand this I'll probably have cases where I need to modify the
results of the query before passing it to a result formatter or formatting
the results manually. What is the best way to do this using existing SMW
methods?

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