On 07/30/2011 06:44 PM, Markus Krötzsch wrote:
> On 30/07/11 01:10, Samuel Lampa wrote:
>> <snip>
>
> You may want to take advantage of our extensive API documentation at
>
> http://semantic-mediawiki.org/doc/classSMWDIWikiPage.html

Right, thanks ... have been too busy the last year, to really follow the 
architecture updates :-o
Just now read again your summary of the 1.6 arch changes [1] (Very 
useful overview btw! ... would be nice stuff for the Architecture guide 
[2] soon, I guess :) )

> The normal way to create DI objects is to use the constructor
> (__construct()). If your "title" is a DBKey (normalised) then this
> should work best for you.The method newFromSerialization() is only used
> to re-create DIs from the output of getSerialization(). Another way to
> get a data item is to call the method getDataItem() that any
> SMWDataValue object has (but making a DataValue in the first place is
> more work). The SMWDIWikiPage also has newFromTitle() that is based on a
> Title *object*, not a title string.

Ah, right ... the dbkey including the NS (I saw now).

Well, I actually has the title and the NS separated in PageHandler, so I 
suppose I better go with the Title::makeTitle( $ns, $title, ...) one for 
now? (Though skipping the creation of a title object would be a little 
optimization).

> Some of your above code creates some very strange (to my eye)
> SMWWikiPageValue objects that might actually be invalid (check with
> isValid()). Namely, you try to use "false" as a title string, but a
> title string should be a valid MediaWiki page title.

I agree ... can't really remember why I did in this way... It does not 
follow Denny's code examples for SMWWriter either [3]. I feel there's a 
lot of such ugly code in RDFIO that I'd need to fix ... isValid() does 
return true though. Have to see over these things more in detail.

[1] 
http://www.mail-archive.com/semediawiki-devel@lists.sourceforge.net/msg02798.html
[2] http://www.semantic-mediawiki.org/wiki/Architecture_guide
[3] http://semantic-mediawiki.org/wiki/Help:SMWWriter#Examples

Cheers
// Samuel





-- 
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