Thanks for the analysis and patch. This issue is well known and is going to be resolved by rewriting the whole redirect-resolving code. This code in fact is not just buggy but also quite inefficient. Another quick workaround for the issue is to switch off redirecting in queries in your SMWLocalSettings.php. I hope I can fix this for the upcoming release (which also fixes another bug with namespace usage in fixed subject queries).
Best regards,
Markus
On Monday 06 November 2006 00:53, Christopher Baker wrote:
> i noticed that as well, but that wasnt what caused the problem. The problem
> was caused by the way in which relations are matched. SMW first checks to
> see if the relation name being searched is a redirect. if so, it adds the
> redirect to a list, which already contained the name of the relation being
> searched. It then iterates through the list to see if any of those pages
> are directed to from other redirects. if it finds any, it adds them all to
> the list. it then seaches for articles with any relation names (with the
> given relation) from that list.
>
> the problem is that none of this takes namespaces into account. I have
> upwards of 10 pages called "Main Page", tho each is in a different
> namespace (the page called just the name of the namespace redirects to to
> "Main Page" under that namespace). The relation name that it was searching
> redirected to one of those "main pages" then the software found all the
> "main page"s and added them all to the list.
>
> In order to fix this, i merely added the namespace (as the number) to the
> page added to the list. code follows if anybody cares to fix it (or add it
> to the official repository?)
>
> tho i cant tell you why i didnt encounter this before... i did make changes
> before i checked the affected pages and that may have triggered it or
> something... ??
>
> This is the entire function in SMW_InlineQueries.php. The changed lines are
> in bold.
>
> function normalizeRedirects(&$articles) {
> global $smwgIQRedirectNormalization;
> if (!$smwgIQRedirectNormalization) {
> return $articles;
> }
> $stable = FALSE;
> $check_articles = array(); # this entire bold
> segment was
> foreach( $articles as $article ) { #$check_articles =
> array_diff( $articles , array() ); // Copies the array
> if( strpos( $article , ":" ) === false ) $check_articles[] =
> "0:".$article;
> else $check_articles[] = $article;
> }
> while (!$stable) {
> $new_articles = array();
> foreach ( $check_articles as $article ) {
> // there...
> $article = explode(":",$articlent);
> print_r($articlent);
> $res = $this->dbr->select(
> array( 'page' , 'pagelinks' ),
> array( 'pl_title','pl_namespace' ), # was
> array( 'pl_title' ),
> array( 'page_title = ' . $this->dbr->addQuotes(
> $article[1] ),
> 'page_namespace = ' . $this->dbr->addQuotes(
> $article[0] ),
> 'page_is_redirect = 1',
> 'page_id = pl_from' ) ,
> "SMW::NormalizeRedirects" );
> if ( $res ) {
> while ( $res && $row = $this->dbr->fetchRow( $res )) {
> if ( array_key_exists( 'pl_title', $row) &&
> array_key_exists( 'pl_namespace', $row) ) {
> $new_article = $row[ 'pl_namespace' ].":".$row[
> 'pl_title' ]; # was $new_article = $row[ 'pl_title' ];
> if (!in_array( $new_article , $articles)) {
> $new_articles[] = $new_article;
> }
> }
> }
> }
> $this->dbr->freeResult( $res );
>
> // ... and back again
> $res = $this->dbr->select(
> array( 'page' , 'pagelinks' ),
> array( 'page_title','page_namespace' ), # was
> array( 'page_title' ),
> array( 'pl_title = '. $this->dbr->addQuotes(
> $article[1] ),
> 'pl_namespace = ' . $this->dbr->addQuotes(
> $article[0] ),
> 'page_is_redirect = 1',
> 'page_id = pl_from' ) ,
> "SMW::NormalizeRedirects" );
> if ( $res ) {
> while ( $res && $row = $this->dbr->fetchRow( $res )) {
> if ( array_key_exists( 'page_title', $row) ) {
> $new_article = $row[ 'page_namespace'
> ].":".$row[ 'page_title' ]; # was $new_article = $row[ 'page_title' ];
> if (!in_array( $new_article , $articles)) {
> $new_articles[] = $new_article;
> }
> }
> }
> }
> $this->dbr->freeResult( $res );
> }
> $stable = (count($new_articles)==0);
> $articles = array_merge( $articles, $new_articles );
> $check_articles = array_diff( $new_articles , array() );
> }
> return $articles;
> }
>
> On 11/5/06, Markus Krötzsch <[EMAIL PROTECTED]> wrote:
> > On Saturday 04 November 2006 09:11, Christopher Baker wrote:
> > > I previously had my site served locally off my laptop, as I yet had not
> > > obtained a domain. Now that I have done so, I migrated everything over.
> >
> > For
> >
> > > the wiki, i copied the files over and exported the sql database then
> > > imported it onto the server (as i have done in the past). This time,
> > > however, there is a problem. There were a couple, tho this is all im
> > > worried about for the moment. The images that i upload to my wiki are
> >
> > given
> >
> > > special relations, relating to the image (like tagging it with multiple
> > > tags for classification). I then have various image galleries that
> >
> > display
> >
> > > them based on the wanted tag(s).
> >
> > http://dieloreley.dreamhosters.com/twiki/index.php?title=Special%3ASearch
> >Tr
> >
> > >iple&relation=Tags&do=Search+Relationsshows all tags currently in use (i
> > > have refrained from uploading all my
> > > images till everything is working smoothly...). I ran an ask looking
> > > for each tag from that list, then removed the asks that were working
> >
> > properly.
> >
> > > There are three that do not work properly. They can be seen here
> > > http://dieloreley.dreamhosters.com/twiki/index.php?title=Sandbox2 . The
> > > first is "Mathematica", the second is "Temari", and the third is
> >
> > "Flora",
> >
> > > as can be seen. The final line is "<ask>[[Tags::+]]</ask>" to display
> >
> > all
> >
> > > tagged pages. As you can see, the first three display all but the
> > > senior pictures, a (seeming?) oddity. I transfered all this on tuesday
> > > and have not been able to figure out a solution. If anybody can provide
> > > any help,
> >
> > it
> >
> > > would be greatly appreciated.
> >
> > Apparently, the import did mess up some internals of your database. The
> > questions marks appearing when conducting the above simple semantic
> > search indicate that there are annotations stored in the database for
> > article-ids that do not belong to any existing article any more now. This
> > should not happen in normal operation, since article-ids do not change
> > (even when pages
> > are moved). Storing the problematic articles should restore all
> > annotaitons
> > for them, but it will not delete the orphaned "?" annotations (which do
> > not
> > belong to any article). You probably have to delete those manually from
> > the
> > database. The respective table is called "smwrelations" and it does not
> > contain "?" but numbers. It is not problematic if you delete more entries
> > than necessary: storing an article again will always restore its
> > anontations
> > in the DB.
> >
> > Best regards,
> >
> > Markus
> >
> > > Thank you very much,
> > > Christopher Baker
> >
> > --
> > Markus Krötzsch
> > Institute AIFB, University of Karlsruhe, D-76128 Karlsruhe
> > [EMAIL PROTECTED] 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
[EMAIL PROTECTED] phone +49 (0)721 608 7362
www.aifb.uni-karlsruhe.de/WBS/ fax +49 (0)721 693 717
pgpNLYP68645m.pgp
Description: PGP signature
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ Semediawiki-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/semediawiki-user
