Thanks Markus I have used the API documentation a lot while digging through these questions.
I am already using GetStore to retrieve all properties on a page and I am scanning each property to find the one I want. That doesn't seem very efficient to me and I am wondering if there is a more direct (faster) way to retrieve values if I already know a page and a property. Something like getPagePropertyValues($page,$property) if you want. I was not able to find something close to that in the documentation, so I assumed that method does not exist. - Laurent On Jul 30, 2009, at 4:42 PM, Markus Krötzsch wrote: > The direct way to access data from the store is to use the various > functions > of SMWStore, the current instance of which you obtain via > smwfGetStore(); see > the API documentation [1] for details. In your case, you would call > getPropertyValues($subject, $property), where $property is an > SMWPropertyValue > object that you can create with the static methods make...() in this > class > (again, see API docs). $subject is just a usual SMWWikiPageValue > object, also > creatable using static methods of this class. > > I hope the API documentation is of some use to you (I find it quite > detailed > when compared to some other software I have seen ;-). If you find > some docs > unclear or insufficient, please do not hesitate to point this out to > us. It > might also be helpful to provide further resources for developers > that use SMW > code. These could be a good addition to semantic-mediawiki.org; > contributions > are welcome. > > Cheers, > > Markus > > > [1] http://semantic-mediawiki.org/doc/ > > > > On Sonntag, 26. Juli 2009, Laurent Alquier wrote: >> Thanks - I will give it a try during the week. >> >> I am trying to find a way to get the value of a page-property pair >> without having to loop through all properties on a page only to get >> the value of one property. >> >> This is to streamline my customized semantic search results. One of >> the bottlenecks is the performance hit from accessing properties for >> each page in the list of matches from the search. I am trying to >> reduce that hit to the absolute minimal number of property I need >> from >> each page. >> >> I managed to reduce the performance hit to 5 to 8 seconds per >> search... which is ok as long as it is under 10 seconds... but I >> would >> feel better about it if I could reduce it down to under 5 seconds per >> search. >> >> - Laurent >> >> On Jul 25, 2009, at 10:53 PM, Yaron Koren wrote: >>> Yes, you can use the API. If you go to Special:Ask, recreate the >>> query and select "CSV export" as the format, then hit "Find >>> results", you should get a URL for the CSV export you need. You then >>> just need to have the PHP retrieve and parse that URL; you can see >>> the getCSVData() function in the External Data extension for how to >>> do that (though your code can probably be simpler). >>> >>> -Yaron >>> >>> >>> On Sat, Jul 25, 2009 at 3:39 PM, Laurent Alquier >>> <laur...@alquier.org> wrote: >>> Actually, I thought about a way that could work, except I still have >>> to find an example in PHP. >>> >>> In case someone already knows the answer, how would I go about >>> getting the results of a #show or #ask query in PHP ? >>> >>> Something like : >>> >>> $propertyValuesArray = GetQueryResults("{{#show:Some page|?Some >>> property}}") >>> >>> Is this possible with the SMW API ? >>> >>> - Laurent >>> >>> From: "Laurent Alquier" <laur...@alquier.org> >>> Sent: Saturday, July 25, 2009 6:43 AM >>> To: "Semantic MediaWiki Developers List" >>> <semediawiki-devel@lists.sourceforge.net >>> >>> Subject: [SMW-devel] How about retrieving a single triple ? >>> >>> >>> >>> Related to a recent question about retrieving all triples on a page >>> - is there a quick way to retrieve a single triple on a page ? >>> >>> More precisely - If I have a page name and a property name, is there >>> a direct way to get the values for that pair (page, property name) >>> without having to declare the supporting structures such as : >>> >>> $page = SMWDataValueFactory::newTypeIDValue( '_wpg', $title- >>> >>>> getFullText()); >>> >>> $semdata = smwfGetStore()->getSemanticData($page- >>> >>>> getTitle() ); >>> >>> - Laurent >>> >>> >>> ------------------------------------------------------------------------- >>> ----- >>> >>> _______________________________________________ >>> Semediawiki-devel mailing list >>> Semediawiki-devel@lists.sourceforge.net >>> https://lists.sourceforge.net/lists/listinfo/semediawiki-devel > > > -- > Markus Krötzsch > Semantic MediaWiki http://semantic-mediawiki.org > http://korrekt.org mar...@semantic-mediawiki.org > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel