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 <laurent@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" <laurent@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