Re: [SMW-devel] Minor issues with inline errors
On Sonntag, 2. Dezember 2007, Thomas Bleher wrote: > Hi! > > Stumbled across another issue today: > If an annotation is incorrect an error text is added, even if > $smwgNamespacesWithSemanticLinks is set to false for this particular > namespace. > > Example: > http://www.ppoe.at/leiter/wiwo/wiki/index.php/MediaWiki:Neuemethode-grundge >ruest (This page is read by a special page where all the <> > are replaced by real data) > > I looked into the code (includes/SMW_Hooks.php) but found no really nice > solution - basically, the code in smwfParserHook > > $text = preg_replace_callback($semanticLinkPattern, > 'smwfParsePropertiesCallback', $text); > > should pass either $parser or the value of > > smwfIsSemanticsProcessed($parser->getTitle()->getNamespace()) > > to smwfParsePropertiesCallback() so it can remove the error message if > the namespace should have no semantic links. But as PHP supports neither > callbacks with additional arguments nor closures, we are a bit stuck. > Using $wgParser in the callback function is possible, though potentially > buggy, as smwfParserHook may be called with another parser than the > global one. (I have an extension that does this :-/ ) > > Suggestions welcome. OK; I will have a look at this later. > > Two other questions: > 65 //extract annotations and create tooltip > 66 $properties = preg_split('/:[=|:]/', $property); > > This also matches :|, because | is not special in character classes. I > think what you want is '/:[=:]/'. Indeed. Fixed. I found a similar bug on line 27. > > 67 foreach($properties as $singleprop) { > 68 $dv = > SMWFactbox::addProperty($singleprop,$value,$valueCaption); 69 } > > $dv is overwritten here on each iteration of the loop. This looks fishy. Yes, but normally there is only one iteration anyway. What would you suggest instead? Best regards, Markus -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362fax +49 (0)721 608 5998 [EMAIL PROTECTED]www http://korrekt.org signature.asc Description: This is a digitally signed message part. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] swedish collation error on semantic-mediawiki.org with category query and some pages
On Mittwoch, 12. Dezember 2007, cnit wrote: > > Oops. Same old collation issue. I applied the fix given in [1]. I think > > some DB backup must have caused this. > > The best way to get rid of these problems (which initially gave me a > lots of headache) is to stop using precompiled RPM or windows > installer versions of mysql server, which use latin1 charset and > swedish collation by default. > > Instead, I configure mysql with the following options > ./configure\ > '--with-charset=utf8'\ > '--with-collation=utf8_unicode_ci'\ > > and compile it myself. Well, not sure ... in general, SMW and MW have rather similar ways of creating tables, and normally they just come out having the same settings (it does not matter if they use Swedish collation, as long as they use the same). I believe that the observed problems stem from having a database where settings somehow changed between MW and SMW installation, so that SMW used other default collation settings than MW used when making its tables. I assume it should be possible to have a script that just changes the collation of all text-fields in all tables to whatever value some admin wants. > The cons - you have to be a root (have colocation or something like > that). > > Also, you may find an mysql access class of MW and patch it yourself > with > 'SET collation_connection = utf8_unicode_ci' > > MySQL is frustrating to don't use UTF8 by default. Note that the UTF8-DB-encoding option (referring to the one offered during install now) is considered experimental for MediaWiki. And choosing it currently is a sure way to get these problems in any case. So to all you users who read this message later: unless you are comfortable with compiling your own DB servers as well, please be careful with such settings ;-) The default settings should normally work. Markus -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362fax +49 (0)721 608 5998 [EMAIL PROTECTED]www http://korrekt.org signature.asc Description: This is a digitally signed message part. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] {{#ask}}
The reason is that SMW can only sort by properties that are part of the core query. Print statements such as "?Date" may or may not lead to one (or more) outputs per query result, but are not used in the initial SQL query (so as not to increase the number of result rows via printouts). So what you need to do is to add Date to the query: {{#ask: [[Category:News]] [[Date::+]] | ... I guess we should add this automatically if "sort" is used, but the potentially complex recursive query structure makes this a little difficult. But note that this is not a change in behaviour as compared to . Cheers, Markus On Mittwoch, 12. Dezember 2007, cnit wrote: > Markus (or perhaps someone else), > Can you please give a hint, why with my query > > > {{#ask: [[Category:News]] | > ?Date| > sort=Date| > order=descending| > limit=3| > format=template| > template=newsrow| > default=There was no news| > searchlabel=Browse all news...| > }} > > In the SMWSQLStore::createSQLQuery() > $description is NEVER an instance of SMWSomeProperty, so it doesn't > even have a chance to set $this->m_sortfield :-( > > I've either tried ?Date=*| > ?Date=+| > but no luck.. > > So, when it gets to the > in SMW_SQLStore.php, where's the following code: > > if ( $smwgQSortingSupport ) { > $order = $query->ascending ? 'ASC' : 'DESC'; > if ( ($this->m_sortfield == false) && > ($this->m_sortkey == false) ) { $sql_options['ORDER BY'] = > "$pagetable.page_title $order "; // default } elseif ($this->m_sortfield != > false) { > $sql_options['ORDER BY'] = > $this->m_sortfield . " $order "; } // else: sortkey given but not found: do > not sort } > > > my case is always "sortkey given but not found: do not sort" ? > > My Property:Date does exists and correctly defined, and it has the > lists of pages that use this property. > Dmitriy -- Markus Krötzsch Institut AIFB, Universät Karlsruhe (TH), 76128 Karlsruhe phone +49 (0)721 608 7362fax +49 (0)721 608 5998 [EMAIL PROTECTED]www http://korrekt.org signature.asc Description: This is a digitally signed message part. - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] {{#ask}}
Markus (or perhaps someone else), Can you please give a hint, why with my query {{#ask: [[Category:News]] | ?Date| sort=Date| order=descending| limit=3| format=template| template=newsrow| default=There was no news| searchlabel=Browse all news...| }} In the SMWSQLStore::createSQLQuery() $description is NEVER an instance of SMWSomeProperty, so it doesn't even have a chance to set $this->m_sortfield :-( I've either tried ?Date=*| ?Date=+| but no luck.. So, when it gets to the in SMW_SQLStore.php, where's the following code: if ( $smwgQSortingSupport ) { $order = $query->ascending ? 'ASC' : 'DESC'; if ( ($this->m_sortfield == false) && ($this->m_sortkey == false) ) { $sql_options['ORDER BY'] = "$pagetable.page_title $order "; // default } elseif ($this->m_sortfield != false) { $sql_options['ORDER BY'] = $this->m_sortfield . " $order "; } // else: sortkey given but not found: do not sort } my case is always "sortkey given but not found: do not sort" ? My Property:Date does exists and correctly defined, and it has the lists of pages that use this property. Dmitriy - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel
Re: [SMW-devel] swedish collation error on semantic-mediawiki.org with category query and some pages
> Oops. Same old collation issue. I applied the fix given in [1]. I think some > DB backup must have caused this. The best way to get rid of these problems (which initially gave me a lots of headache) is to stop using precompiled RPM or windows installer versions of mysql server, which use latin1 charset and swedish collation by default. Instead, I configure mysql with the following options ./configure\ '--with-charset=utf8'\ '--with-collation=utf8_unicode_ci'\ and compile it myself. The cons - you have to be a root (have colocation or something like that). Also, you may find an mysql access class of MW and patch it yourself with 'SET collation_connection = utf8_unicode_ci' MySQL is frustrating to don't use UTF8 by default. Dmitriy - SF.Net email is sponsored by: Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php ___ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel