* Markus Krötzsch <[EMAIL PROTECTED]> [2007-11-23 16:14]:
> thanks for the work (and good to hear the SpieleWiki runs on the new 
> version)! 
> We agree and also would prefer the full negation patch. Our current roadmap 
> is to finish 1.0 first, which mainly hinges upon the inclusion (or 
> reimplementation) of the {{#ask}}-patch and some further fixes (service 
> links, Type:Boolean). 

I think that's okay. I can live with the patch being out-of-tree for a
while (I had patched SMW 0.7 more heavily than I have 1.0RC2 now, so
things are improving for me :)

> After that, we will go for new releases and new features. I would expect that 
> your patch remains compatible for that time -- major changes of querying as 
> in 0.7->1.0 are not scheduled so soon. What might be revisited, however, is 
> the concrete syntax used for expressing negations.

OK. Just one note, as I'm not sure it was clear from the mail I sent:
The present patch allows <n> at every place where <q> is allowed. It
acts the same (starts a subquery) except that it negates everything.

> If I can manage to review 
> your patch before 1.0, then I will certainly add it right away -- the fact 
> that you successfully worked through our Storage API already impresses me 
> quite a lot :-) 

Thanks :)

> And, given that you are one of the few people who ever 
> actually read that code: we are also happy about any suggestions towards 
> improving the storage performance.
> 
> Btw another possibility to work-around your problem for now could be to 
> filter 
> for the respective property values *on printout*. This is inefficient but OK 
> as long as the result set is not too large. To do this, one would use a 
> templated printout (format="template" template="...") and include an {{#if }} 
> into the template that checks the conditions to decide whether or not to 
> create any output. Note that one can also use format="template" for printing 
> tables by setting intro="{|" and using a template that defines table-rows in 
> wiki pipe syntax. It is also possible to use a template call for intro, so as 
> to get styling parameters set. Of course it's as ugly as any advanced 
> formatting in MediaWiki ...

Ah :) I had used this, but with an extra "outro" parameter to close the
table again. Didn't realize that MediaWiki's parser allows the closing
tag to be omitted. One patch less :)

The only addition I need there is the following patch:

--- a/SMW_QP_Template.php
+++ b/SMW_QP_Template.php
@@ -25,6 +25,7 @@ class SMWTemplateResultPrinter extends SMWResultPrinter {
        }

        public function getHTML($res) {
+               global $wgParser;
                // handle factbox
                global $smwgStoreActive, $wgTitle;

@@ -41,6 +42,8 @@ class SMWTemplateResultPrinter extends SMWResultPrinter {
                $parser_options = new ParserOptions();
                $parser_options->setEditSection(false);  // embedded sections 
should not have edit links
                $parser = new Parser();
+               $parser->mFunctionHooks = $wgParser->mFunctionHooks;
+               $parser->mFunctionSynonyms = $wgParser->mFunctionSynonyms;
                while ( $row = $res->getNext() ) {
                        $wikitext = '';
                        $firstcol = true;

It copies the parser functions from the main parser, so they can be used
in the templates given to <ask>. Maybe this can be added to SMW.

Regards,
Thomas
 
> On Dienstag, 20. November 2007, Thomas Bleher wrote:
> > * Thomas Bleher <[EMAIL PROTECTED]> [2007-11-15 20:36]:
> > > * Thomas Bleher <[EMAIL PROTECTED]> [2007-11-14 08:48]:
> > > > 1) Implement negations in queries - then I could ask "(NOT
> > > > maxTeilnehmer <= 9) AND (NOT minTeilnehmer >= 11)". I used this
> > > > solution with SMW 0.7 (patch below), but looking at the 1.0RC2 code,
> > > > I'm not quite sure how to implement it cleanly.
> > >
> > > I looked at the code again and tried to implement negation support. The
> > > patch below adds a <n> </n> pair which negates the query in between. It
> > > also adds a SMWNegation class (derived from SMWDescription), which
> > > encapsulates the negation.
> >
> > OK, I took another stab at this, and in my limited tests the code works
> > correctly now :)
> >
> > The code is online at http://pwiki.j-crew.de/wiki/Test, feel free to
> > play around with it (it's just a test-wiki).
> >
> > Technical details:
> > To work around the problems with INNER JOINs and negations, all INNER
> > JOINs of the form "SELECT a INNER JOIN b ON a.c=b.d" are replaced by
> > "SELECT a,b WHERE a.c=b.d". This may not be the most elegant solution,
> > but the only workable I found.
> >
> > To make this work, addJoin now has an additional $where parameter.
> >
> > Beware: I still don't understand all the internals of query processing,
> > so no guarantees for this code. I would really appreciate it if someone
> > more knowledgeable than me would look over the code.
> >
> > Regards,
> > Thomas
> 
> 
> 
> -- 
> Markus Krötzsch
> Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe
> phone +49 (0)721 608 7362        fax +49 (0)721 608 5998
> [EMAIL PROTECTED]        www  http://korrekt.org

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Semediawiki-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to