Thanks, James! I have successfully fetched sub-objects properties thanks to your advice!
03.06.2013 19:58, James HK пишет: > Hi, > >>> new Subobject( $title ) > > This won't work because you a just created a new instance which at > this point has nothing to to with the store. > >>> $subObject->getSemanticData()->getProperties(); > > This won't work because the instance you just created as now > properties added therefore it won't return any properties. > > Stored data are generally accessed through the Store/StoreEngine. In > order to get access to those data you can use either the > SMW\ParserData object (see at [1], the test will show how to access > data from a $title/$parserOutput object) or you dig deeper into [2] > which shows how to access the data directly from the store. > > [1] > https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=blob;f=tests/phpunit/includes/parserhooks/SubobjectParserFunctionTest.php;HEAD#l278 > > [2] > https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/SemanticMediaWiki.git;a=blob;f=includes/specials/SMW_SpecialBrowse.php;hb=HEAD#l106 > > PS: Tests deployed with SMW 1.9 will generally show how to access or > interact with those objects therefore a general advise is to use those > sources to verify their use cases. > > Cheers > > On 6/4/13, Alexey Klimovich <god.vedm...@gmail.com> wrote: >> Hi, everyone! >> I have a little question about Sub-objects in SMW 1.9. >> >> I am trying to fetch sub-object properties list, like a page properties >> list, but unsuccessful. >> >> I have a sub-objects $title variable (received from semantic query), >> which holds Title with mFragment holding sub-object name. This is what i >> am trying to do: >> >> $subObject = new Subobject( $title ); >> >> //also tried: new Subobject( $title, $title->getFragment() ); >> >> $propList = $subObject->getSemanticData()->getProperties(); >> >> Looks like this is wrong way to create subobject instance and read its >> properties? Can anyone point me to right way? >> >> >> ------------------------------------------------------------------------------ >> Get 100% visibility into Java/.NET code with AppDynamics Lite >> It's a free troubleshooting tool designed for production >> Get down to code-level detail for bottlenecks, with <2% overhead. >> Download for free and get started troubleshooting in minutes. >> http://p.sf.net/sfu/appdyn_d2d_ap2 >> _______________________________________________ >> Semediawiki-devel mailing list >> Semediawiki-devel@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel >> > > ------------------------------------------------------------------------------ > Get 100% visibility into Java/.NET code with AppDynamics Lite > It's a free troubleshooting tool designed for production > Get down to code-level detail for bottlenecks, with <2% overhead. > Download for free and get started troubleshooting in minutes. > http://p.sf.net/sfu/appdyn_d2d_ap2 > ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel