Hi,

I got a reported bug (per mail) with the initSMWWriter function in the 
PageHandler class in RDFIO [1] (For complete code, see: [2]), which seem 
to be due to some API changes in SMW, for which I'd need some guidance.

When trying to import the test data (from the "paste test data link") on 
the Special:RDFImport page, one gets:

Catchable fatal error: Argument 1 passed to 
SMWSemanticData::__construct() must be an instance of SMWDIWikiPage, 
instance of SMWWikiPageValue given, called in 
/home/samuel/www/smw-trunk/extensions/RDFIO/classes/PageHandler.php on 
line 171 and defined in 
/home/samuel/www/smw-trunk/extensions/SemanticMediaWiki/includes/SMW_SemanticData.php
 
on line 103

Below is the relevant code from PageHandler.php. (line 171 highlighted):


$page = SMWWikiPageValue::makePage( $this->m_wikititle, $this->m_ns );

$this->m_smwwriter = new SMWWriter( $page->getTitle() );
if ( $delete ) {
   // We are not adding anything, so create a "page" with "false" title
   $this->m_smwwriter_add    = new SMWSemanticData(
                  SMWWikiPageValue::makePage( false, $this->m_ns ) );
   $this->m_smwwriter_remove = new SMWSemanticData( $page );
} else {
   *$this->m_smwwriter_add    = new SMWSemanticData( $page );*
   // We are not removing anything, so create a "page" with "false" title
   $this->m_smwwriter_remove = new SMWSemanticData(
     SMWWikiPageValue::makePage( false, $this->m_ns ) );
}


The problem is obviously that SMWWikiPageValue::makePage( false, 
$this->m_ns ) returns an SMWWikiPageValue, while I need an SMWDIWikiPage 
for creating the new SMWSemanticData:s.

So, how can I go about creating new SMWDIWikiPage, when I have the title 
and the namespace (like I have in the code above)?

There is SMWDIWikiPage::newFromTitle($title), but that does not take the 
namespace (which I'll need to specify, not?), and there is 
SMWDIWikiPage::newFromSerialization($diType, $serialization) ... but 
unfortunately don't have a clue how to get the correct $diType and 
$serialization ...


Cheers,
// Samuel

[1] http://localhost/smw-dev/index.php/Extension:RDFIO
[2] 
http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/RDFIO/classes/PageHandler.php

-- 
Samuel Lampa
---------------------------------------
  Bioinformatician @ Uppsala University
    Blog: http://saml.rilspace.org
---------------------------------------

------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to